From 9a13be895f47de39c2a35d309ba87d1fa1966b55 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Wed, 7 Feb 2024 21:33:43 +0000 Subject: [PATCH 01/18] fix: error with summarizeSensitivity Profiles on LongTables where it assumes paramaters --- R/methods-summarizeSensitivityProfiles.R | 37 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/R/methods-summarizeSensitivityProfiles.R b/R/methods-summarizeSensitivityProfiles.R index 9119471a..40109c06 100755 --- a/R/methods-summarizeSensitivityProfiles.R +++ b/R/methods-summarizeSensitivityProfiles.R @@ -32,12 +32,13 @@ #' @importMethodsFrom CoreGx summarizeSensitivityProfiles #' @export setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), - function(object, sensitivity.measure="auc_recomputed", cell.lines, + function(object, sensitivity.measure="auc_recomputed", cell.lines, profiles_assay = "profiles", + treatment_col = "treatmentid", sample_col = "sampleid", drugs, summary.stat=c("mean", "median", "first", "last", "max", "min"), fill.missing=TRUE, verbose=TRUE) { if (is(treatmentResponse(object), 'LongTable')) - .summarizeSensProfiles(object, sensitivity.measure, - cell.lines, drugs, summary.stat, fill.missing) + .summarizeSensProfiles(object, sensitivity.measure, profiles_assay = profiles_assay, + treatment_col, sample_col, cell.lines, drugs, summary.stat, fill.missing) else .summarizeSensitivityProfilesPharmacoSet(object, sensitivity.measure, cell.lines, drugs, summary.stat, @@ -52,19 +53,27 @@ setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), #' @import data.table #' @keywords internal .summarizeSensProfiles <- function(object, - sensitivity.measure='auc_recomputed', cell.lines, drugs, summary.stat, + sensitivity.measure='auc_recomputed', profiles_assay = "profiles", + treatment_col = "treatmentid", sample_col = "sampleid", cell.lines, drugs, summary.stat, fill.missing=TRUE) { # handle missing if (missing(cell.lines)) cell.lines <- sampleNames(object) if (missing(drugs)) drugs <- treatmentNames(object) - if (missing(summary.stat)) summary.stat <- 'mean' + if (missing(summary.stat) || length(summary.stat)>1) summary.stat <- 'mean' + checkmate::assert_class(treatmentResponse(object), 'LongTable') + checkmate::assert_string(sensitivity.measure) + checkmate::assert_string(profiles_assay) # get LongTable object longTable <- treatmentResponse(object) + checkmate::assert((profiles_assay %in% names(longTable)), + msg = paste0("[PharmacoGx::summarizeSensivitiyProfiles,LongTable-method] ", + "The assay '", profiles_assay, "' is not in the LongTable object.")) + # extract the sensitivty profiles - sensProfiles <- assay(longTable, 'profiles', withDimnames=TRUE, key=FALSE) + sensProfiles <- assay(longTable, profiles_assay, withDimnames=TRUE, key=FALSE) profileOpts <- setdiff(colnames(sensProfiles), idCols(longTable)) # compute max concentration and add it to the profiles @@ -101,22 +110,26 @@ setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), "min" = { min(as.numeric(x), na.rm=TRUE)} ) } + sensProfiles <- data.table::as.data.table(sensProfiles) # do the summary profSummary <- sensProfiles[, summary.function(get(sensitivity.measure)), - by=.(treatmentid, sampleid)] + by=c(treatment_col, sample_col)] + print(profSummary) + # NA pad the missing cells and drugs if (fill.missing) { allCombos <- data.table(expand.grid(drugs, cell.lines)) - colnames(allCombos) <- c("treatmentid", "sampleid") - profSummary <- profSummary[allCombos, on=c("treatmentid", "sampleid")] + colnames(allCombos) <- c(treatment_col, sample_col) + profSummary <- profSummary[allCombos, on=c(treatment_col, sample_col)] + print(profSummary) } # reshape and convert to matrix - setorderv(profSummary, c("sampleid", "treatmentid")) - profSummary <- dcast(profSummary, treatmentid ~ sampleid, value.var='V1') - summaryMatrix <- as.matrix(profSummary, rownames="treatmentid") + setorderv(profSummary, c(sample_col, treatment_col)) + profSummary <- dcast(profSummary, get(treatment_col) ~ get(sample_col), value.var='V1') + summaryMatrix <- as.matrix(profSummary, rownames='treatment_col') return(summaryMatrix) } From 3d54535c54ff697a5ea2de3fe7c023ea0a1d193d Mon Sep 17 00:00:00 2001 From: Jermiah Date: Thu, 8 Feb 2024 20:07:13 +0000 Subject: [PATCH 02/18] add column arguments to drugDoseResponseCurve --- R/drugDoseResponseCurve.R | 52 +++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/R/drugDoseResponseCurve.R b/R/drugDoseResponseCurve.R index d5385f37..83e4e30a 100755 --- a/R/drugDoseResponseCurve.R +++ b/R/drugDoseResponseCurve.R @@ -91,7 +91,9 @@ function(drug, cex = 0.7, cex.main = 0.9, legend.loc = "topright", - verbose=TRUE) { + verbose=TRUE, + sample_col = "sampleid", + treatment_col = "treatmentid") { if(!missing(pSets)){ if (!is(pSets, "list")) { if (is(pSets, "PharmacoSet")) { @@ -167,28 +169,42 @@ function(drug, } } - common.range.star <- FALSE - if (missing(plot.type)) { plot.type <- "Actual" } + if(is(treatmentResponse(pSets[[1]]), "LongTable")){ + pSets[[1]] <- subsetByTreatment(pSets[[1]], treatments=drug) + } + pSets[[1]] <- subsetBySample(pSets[[1]], samples=cellline) + doses <- list(); responses <- list(); legend.values <- list(); j <- 0; pSetNames <- list() if(!missing(pSets)){ for(i in seq_len(length(pSets))) { - exp_i <- which(sensitivityInfo(pSets[[i]])[ ,"sampleid"] == cellline & sensitivityInfo(pSets[[i]])[ ,"treatmentid"] == drug) + exp_i <- which(sensitivityInfo(pSets[[i]])[ ,sample_col] == cellline & sensitivityInfo(pSets[[i]])[ ,treatment_col] == drug) if(length(exp_i) > 0) { if (summarize.replicates) { pSetNames[[i]] <- name(pSets[[i]]) - if (length(exp_i) == 1) { - drug.responses <- as.data.frame(cbind("Dose"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Dose"])), + drug.responses <- as.data.frame(cbind("Dose"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Dose"])), "Viability"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Viability"]))), stringsAsFactors=FALSE) - drug.responses <- drug.responses[complete.cases(drug.responses), ] - }else{ - drug.responses <- as.data.frame(cbind("Dose"=apply(sensitivityRaw(pSets[[i]])[exp_i, , "Dose"], 2, function(x){median(as.numeric(x), na.rm=TRUE)}), - "Viability"=apply(sensitivityRaw(pSets[[i]])[exp_i, , "Viability"], 2, function(x){median(as.numeric(x), na.rm=TRUE)})), stringsAsFactors=FALSE) - drug.responses <- drug.responses[complete.cases(drug.responses), ] - } + drug.responses <- drug.responses[complete.cases(drug.responses), ] + # tryCatch( + # drug.responses <- as.data.frame(cbind("Dose"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Dose"])), + # "Viability"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Viability"]))), stringsAsFactors=FALSE) + # drug.responses <- drug.responses[complete.cases(drug.responses), ] + # , error = function(e) { + # if (length(exp_i) == 1) { + # drug.responses <- as.data.frame(cbind("Dose"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Dose"])), + # "Viability"=as.numeric(as.vector(sensitivityRaw(pSets[[i]])[exp_i, , "Viability"]))), stringsAsFactors=FALSE) + # drug.responses <- drug.responses[complete.cases(drug.responses), ] + # }else{ + # drug.responses <- as.data.frame(cbind("Dose"=apply(sensitivityRaw(pSets[[i]])[exp_i, , "Dose"], 1, function(x){median(as.numeric(x), na.rm=TRUE)}), + # "Viability"=apply(sensitivityRaw(pSets[[i]])[exp_i, , "Viability"], 2, function(x){median(as.numeric(x), na.rm=TRUE)})), stringsAsFactors=FALSE) + # drug.responses <- drug.responses[complete.cases(drug.responses), ] + # } + # }) + + doses[[i]] <- drug.responses$Dose responses[[i]] <- drug.responses$Viability names(doses[[i]]) <- names(responses[[i]]) <- seq_len(length(doses[[i]])) @@ -201,7 +217,7 @@ function(drug, legend.values[[i]] <- sprintf("%s = %s", legends.label, round(as.numeric(sensitivityProfiles(pSets[[i]])[exp_i, legends.label]), digits=2)) } } else { - legend.values[[i]] <- "" + legend.values[i] <- "" } }else { for (exp in exp_i) { @@ -224,7 +240,7 @@ function(drug, } } else { tt <- unlist(strsplit(rownames(sensitivityInfo(pSets[[i]]))[exp], split="_")) - if (tt[1] == "treatmentid") { + if (tt[1] == treatment_col) { legend.values[[j]] <- tt[2] }else{ legend.values[[j]] <- rownames(sensitivityInfo(pSets[[i]]))[exp] @@ -323,13 +339,7 @@ function(drug, legends<- c(legends, sprintf("%s%s", pSetNames[[i]], legend.values[[i]])) legends.col <- c(legends.col, mycol[i]) } - if (common.range.star) { - if (length(doses) > 1) { - for (i in seq_len(length(doses))) { - points(common.ranges[[i]], responses[[i]][names(common.ranges[[i]])], pch=8, col=mycol[i]) - } - } - } + legend(legend.loc, legend=legends, col=legends.col, bty="n", cex=cex, pch=c(15,15)) return(invisible(NULL)) } From 650d0e533636b959e0c3dffa43d2b6d4f99b0cb8 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Wed, 21 Feb 2024 17:12:12 +0000 Subject: [PATCH 03/18] Update cellline parameter in drugDoseResponseCurve function --- R/drugDoseResponseCurve.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/drugDoseResponseCurve.R b/R/drugDoseResponseCurve.R index 83e4e30a..59a43fc3 100755 --- a/R/drugDoseResponseCurve.R +++ b/R/drugDoseResponseCurve.R @@ -18,7 +18,7 @@ #' #' # Generate a plot from one or more PSets #' data(GDSCsmall) -#' drugDoseResponseCurve(drug="Doxorubicin", cellline="22RV", pSets=GDSCsmall) +#' drugDoseResponseCurve(drug="Doxorubicin", cellline="22RV1", pSets=GDSCsmall) #' } #' #' @param drug `character(1)` A drug name for which the drug response curve should be From ed19577329a0ac492ef9da3de45f1c2804d1f9bc Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 1 Mar 2024 01:56:00 +0000 Subject: [PATCH 04/18] docs: add documentation for summarizeSensitivityProfiles --- R/methods-summarizeSensitivityProfiles.R | 48 +++++++++++------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/R/methods-summarizeSensitivityProfiles.R b/R/methods-summarizeSensitivityProfiles.R index 40109c06..f3508ad4 100755 --- a/R/methods-summarizeSensitivityProfiles.R +++ b/R/methods-summarizeSensitivityProfiles.R @@ -11,38 +11,32 @@ #' sensitivity.measure='auc_published') #' #' @param object [PharmacoSet] The PharmacoSet from which to extract the data -#' @param sensitivity.measure `character` which sensitivity sensitivity.measure -#' to use? Use the sensitivityMeasures function to find out what measures are -#' available for each object. -#' @param cell.lines \code{character} The cell lines to be summarized. -#' If any cell lines has no data, it will be filled with -#' missing values -#' @param drugs \code{character} The drugs to be summarized. -#' If any drugs has no data, it will be filled with -#' missing values -#' @param summary.stat \code{character} which summary method to use if there are repeated -#' cell line-drug experiments? Choices are "mean", "median", "first", or "last" -#' @param fill.missing \code{boolean} should the missing cell lines not in the -#' molecular data object be filled in with missing values? -#' @param verbose Should the function print progress messages? +#' @param sensitivity.measure [character] The sensitivity measure to use. Use the sensitivityMeasures function to find out what measures are available for each object. +#' @param cell.lines [character] The cell lines to be summarized. If any cell lines have no data, they will be filled with missing values. +#' @param profiles_assay [character] The name of the assay in the PharmacoSet object that contains the sensitivity profiles. +#' @param treatment_col [character] The name of the column in the profiles assay that contains the treatment IDs. +#' @param sample_col [character] The name of the column in the profiles assay that contains the sample IDs. +#' @param drugs [character] The drugs to be summarized. If any drugs have no data, they will be filled with missing values. +#' @param summary.stat [character] The summary method to use if there are repeated cell line-drug experiments. Choices are "mean", "median", "first", "last", "max", or "min". +#' @param fill.missing [boolean] Should the missing cell lines not in the molecular data object be filled in with missing values? +#' @param verbose [boolean] Should the function print progress messages? #' -#' @return [matrix] A matrix with cell lines going down the rows, drugs across -#' the columns, with the selected sensitivity statistic for each pair. +#' @return [matrix] A matrix with cell lines going down the rows, drugs across the columns, with the selected sensitivity statistic for each pair. #' #' @importMethodsFrom CoreGx summarizeSensitivityProfiles #' @export setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), - function(object, sensitivity.measure="auc_recomputed", cell.lines, profiles_assay = "profiles", - treatment_col = "treatmentid", sample_col = "sampleid", - drugs, summary.stat=c("mean", "median", "first", "last", "max", "min"), - fill.missing=TRUE, verbose=TRUE) { - if (is(treatmentResponse(object), 'LongTable')) - .summarizeSensProfiles(object, sensitivity.measure, profiles_assay = profiles_assay, - treatment_col, sample_col, cell.lines, drugs, summary.stat, fill.missing) - else - .summarizeSensitivityProfilesPharmacoSet(object, - sensitivity.measure, cell.lines, drugs, summary.stat, - fill.missing, verbose) + function(object, sensitivity.measure="auc_recomputed", cell.lines, profiles_assay = "profiles", + treatment_col = "treatmentid", sample_col = "sampleid", + drugs, summary.stat=c("mean", "median", "first", "last", "max", "min"), + fill.missing=TRUE, verbose=TRUE) { + if (is(treatmentResponse(object), 'LongTable')) + .summarizeSensProfiles(object, sensitivity.measure, profiles_assay = profiles_assay, + treatment_col, sample_col, cell.lines, drugs, summary.stat, fill.missing) + else + .summarizeSensitivityProfilesPharmacoSet(object, + sensitivity.measure, cell.lines, drugs, summary.stat, + fill.missing, verbose) }) #' Summarize the sensitivity profiles when the sensitivity slot is a LongTable From 4e382997a54d0058929c15a69e6970460d7cabfc Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:00:35 +0000 Subject: [PATCH 05/18] fix: Refactor buildComboProfiles function in computeSynergy.R example line to be under 100 chars --- R/computeSynergy.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/computeSynergy.R b/R/computeSynergy.R index 3d6a8c7c..123f959c 100755 --- a/R/computeSynergy.R +++ b/R/computeSynergy.R @@ -1126,7 +1126,9 @@ setMethod("computeZIPdelta", signature(object = "TreatmentResponseExperiment"), #' @examples #' \dontrun{ #' ## ZIP is optional. Will be recomputed if not provided. -#' combo_profiles <- CoreGx::buildComboProfiles(tre, c("HS", "EC50", "E_inf", "ZIP", "combo_viability")) +#' combo_profiles <- CoreGx::buildComboProfiles( +#' tre, +#' c("HS", "EC50", "E_inf", "ZIP", "combo_viability")) #' combo_profiles[, #' .computeZIPdelta( #' treatment1id = treatment1id, From a7d85652ba8015858909610ee2bdaf55133b8dc3 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:00:43 +0000 Subject: [PATCH 06/18] fix: Add sample_col and treatment_col arguments to drugDoseResponseCurve function --- R/drugDoseResponseCurve.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/drugDoseResponseCurve.R b/R/drugDoseResponseCurve.R index 59a43fc3..370bda36 100755 --- a/R/drugDoseResponseCurve.R +++ b/R/drugDoseResponseCurve.R @@ -61,6 +61,8 @@ #' @param legend.loc And argument passable to xy.coords for the position to place the legend. #' @param trunc `logical(1)` Should the viability values be truncated to lie in \[0-100\] before doing the fitting #' @param verbose `logical(1)` Should warning messages about the data passed in be printed? +#' @param sample_col `character(1)` The name of the column in the profiles assay that contains the sample IDs. +#' @param treatment_col `character(1)` The name of the column in the profiles assay that contains the treatment IDs. #' #' @return Plots to the active graphics device and returns an invisible NULL. #' From 5e17a0ca1bc81e12eb9c6a9e313bb82f071eaa9c Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:01:06 +0000 Subject: [PATCH 07/18] fix: remove unlinked [boolean] term as it causes warnings --- R/methods-summarizeSensitivityProfiles.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/methods-summarizeSensitivityProfiles.R b/R/methods-summarizeSensitivityProfiles.R index f3508ad4..b3cb4256 100755 --- a/R/methods-summarizeSensitivityProfiles.R +++ b/R/methods-summarizeSensitivityProfiles.R @@ -18,8 +18,8 @@ #' @param sample_col [character] The name of the column in the profiles assay that contains the sample IDs. #' @param drugs [character] The drugs to be summarized. If any drugs have no data, they will be filled with missing values. #' @param summary.stat [character] The summary method to use if there are repeated cell line-drug experiments. Choices are "mean", "median", "first", "last", "max", or "min". -#' @param fill.missing [boolean] Should the missing cell lines not in the molecular data object be filled in with missing values? -#' @param verbose [boolean] Should the function print progress messages? +#' @param fill.missing Should the missing cell lines not in the molecular data object be filled in with missing values? +#' @param verbose Should the function print progress messages? #' #' @return [matrix] A matrix with cell lines going down the rows, drugs across the columns, with the selected sensitivity statistic for each pair. #' From c197d9dfb02089932368ecf11a2ccc9bd92af1d8 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:01:20 +0000 Subject: [PATCH 08/18] chore: delete CreatingPharmacoSet.R Remove CreatingPharmacoSet.R vignette --- vignettes/CreatingPharmacoSet.R | 35 --------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 vignettes/CreatingPharmacoSet.R diff --git a/vignettes/CreatingPharmacoSet.R b/vignettes/CreatingPharmacoSet.R deleted file mode 100644 index 41083b65..00000000 --- a/vignettes/CreatingPharmacoSet.R +++ /dev/null @@ -1,35 +0,0 @@ -## ----setup, include=FALSE, cache=FALSE, message = FALSE----------------------- - -library("knitr") - -### Chunk options: see http://yihui.name/knitr/options/ ### - -## Text results -opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE, include = TRUE) - -## Code decoration -opts_chunk$set(tidy = FALSE, comment = NA, highlight = TRUE) - - -## ----knitcitation, include=FALSE---------------------------------------------- -library(knitcitations) -cleanbib() -cite_options(citation_format = "pandoc") - -## ----eval=FALSE--------------------------------------------------------------- -# SE@annotation <- "rna" - -## ----eval=FALSE--------------------------------------------------------------- -# PharmacoSet(name, -# molecularProfiles=list(), -# sample=data.frame(), -# treatment=data.frame(), -# sensitivityInfo=data.frame(), -# sensitivityRaw=array(dim=c(0,0,0)), -# sensitivityProfiles=matrix(), -# curationTreatment=data.frame(), -# curationSample=data.frame(), -# curationTissue=data.frame(), -# datasetType=c("sensitivity", "perturbation", "both"), -# verify = TRUE) - From 7361b1e5a51840f28290074cc6d91aa000ded0d4 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:01:36 +0000 Subject: [PATCH 09/18] fix: Update CreatingPharmacoSet.Rmd to install required packages if not already installed --- vignettes/CreatingPharmacoSet.Rmd | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vignettes/CreatingPharmacoSet.Rmd b/vignettes/CreatingPharmacoSet.Rmd index 4d71dd37..de2230e9 100755 --- a/vignettes/CreatingPharmacoSet.Rmd +++ b/vignettes/CreatingPharmacoSet.Rmd @@ -30,11 +30,11 @@ vignette: | \vspace{5pt} \footnotesize ```{r setup, include=FALSE, cache=FALSE, message = FALSE} - +if (!requireNamespace("knitr", quietly = TRUE)) { + install.packages("knitr") +} library("knitr") -### Chunk options: see http://yihui.name/knitr/options/ ### - ## Text results opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE, include = TRUE) @@ -45,7 +45,11 @@ opts_chunk$set(tidy = FALSE, comment = NA, highlight = TRUE) ```{r knitcitation, include=FALSE} +if (!requireNamespace("knitcitations", quietly = TRUE)) { + install.packages("knitcitations") +} library(knitcitations) + cleanbib() cite_options(citation_format = "pandoc") ``` From f9eb62e1f883bf87d81045998cac768da9da6b29 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:41:51 +0000 Subject: [PATCH 10/18] docs: update Vignette to reflect new changes --- vignettes/CreatingPharmacoSet.Rmd | 125 +++++++++++++++++++++++------- 1 file changed, 99 insertions(+), 26 deletions(-) diff --git a/vignettes/CreatingPharmacoSet.Rmd b/vignettes/CreatingPharmacoSet.Rmd index de2230e9..a0e358b4 100755 --- a/vignettes/CreatingPharmacoSet.Rmd +++ b/vignettes/CreatingPharmacoSet.Rmd @@ -84,12 +84,25 @@ Previously called `@cell`. This slot contains a `data.frame` which contains information about all the cells profiles across all the data types in the PharamcoSet, including both perturbation and sensitivity experiments. It is crucial for the rownames of each -entry in the data frame to be the **unique cell identifier** used across all the +entry in the data frame to be the **unique sample identifier** used across all the datatypes for each cell type. The content of this data frame will vary based on what information each dataset provides. Mandatory columns in this data frame must be `sampleid`, which should be equivalent to the rownames and `tissueid`, which contains a curated annotation of the source tissue for each cell line. +An example of a `sample` slot is shown below: + +```{R} +sample <- data.frame( + sampleid = c("A549", "MCF7", "PC3"), + tissueid = c("lung", "breast", "prostate"), + cellosaurus.accession = c("CVCL_0023", "CVCL_0031", "CVCL_0035"), + row.names = c("A549", "MCF7", "PC3")) + +sample +``` + + ## `treatment` Previously called `@drug`. @@ -98,15 +111,25 @@ This slot contains a `data.frame` which contains information about all the drugs profiled across all the data types in the PharmacoSet, including both perturbation and sensitivity experiments. Similar to the `sample` slot, it is crucial for the rownames of each entry in the data frame to be the -**unique compound identifier** used across all the datatypes for each compound. +**unique treatment identifier** used across all the datatypes for each compound. Once again, the content in this data frame will vary based on information provided by each dataset. Mandatory columns must be `treatmentid`, which should be equivalent to the object rownames. +```{R} +treatment <- data.frame( + treatmentid = c("Doxorubicin", "Tamoxifen", "Docetaxel"), + chembl.MechanismOfAction = c("DNA topoisomerase II inhibitor", "Estrogen receptor antagonist", "Microtubule inhibitor"), + row.names = c("Doxorubicin", "Tamoxifen", "Docetaxel")) + +treatment +``` + + ## `curation`: -This slot contains three data.frames, one for drugs, tissues, and cells. Each -contains two columns, the first with the unique identifier that is used between +This slot contains three data.frames, one for `sample`, `treatment`, and `tissue`. +Each contains two columns, the first with the unique identifier that is used between all PharmacoSet objects for this drug, and the second with the identifier used within the dataset. At this time there is no set method to find the unique identifiers between all PharmacoSets for arbitrary drugs, as much labour @@ -121,9 +144,14 @@ used in the datasets, to allow for at least some matching to be done. * `tissue`: data.frame annotating all tissues investigated in the study. ## `molecularProfiles`: -* List of `SummarizedExperiment` objects containing the -molecular profiles of the cell lines, such as mutations, gene expressions, or -copy number variations. + +Either a: + +* List of `SummarizedExperiment` objects +* `MultiAssayExperiment` object + +containing the molecular profiles of the samples, such as mutations, +gene expressions, or copy number variations. The molecular profiles slot of a PharmacoSet object contains all the molecular expression data profiled in the dataset. Each type of data is kept in a separate @@ -170,9 +198,13 @@ concentration. Should be 0 for controls. Otherwise each SummarizedExperiment object should be constructed as specified by the SummarizedExperiment package. -Once these SummarizedExperiment objects are created, they should be added to a -list, with the name of each object in the list being descriptive of the type of -data contained. +Once these SummarizedExperiment objects are created, they should be: + +1. added to a list, with the name of each object in the list being descriptive of the type of +data contained; OR +2. added to a `MultiAssayExperiment` object, with the name of each assay being +descriptive of the type of data contained. + ## `datasetType` @@ -190,16 +222,34 @@ to be aware of what data types they should be looking for. Previously called `@sensitivity` this slot contains viability measurements for cell-lines treated with different therapeutic compounds. +### New in `PharmacoGx 2.0` + +In `PharmacoGx 2.0` this slot now takes an object of the +[`CoreGx::treatmentResponseExperiment`]( + https://bioconductor.org/packages/release/bioc/vignettes/CoreGx/inst/doc/TreatmentResponseExperiment.html) +class. +This class is a container for drug dose response data, and adds a layer of +functionality to incorporate drug combination data while also being able to +perform computations efficiently. + +The design takes the aspects of the `SummarizedExperiment` and `MultiAssayExperiment` +classes and implements them using the `data.table` package, which provides an R API +to a rich set of tools for scalable, high performance data processing implemented in C. + +To create a `TreatmentResponseExperiment` object, please refer to the +[The TreatmentResponseExperiment Class Documentation](https://bioconductor.org/packages/release/bioc/vignettes/CoreGx/inst/doc/TreatmentResponseExperiment.html). + +### Old in `PharmacoGx 1.0` + +In `PharmacoGx 1.0`, this was a list of `data.frame` objects, each containing +the following slots: + * `n`: Number of experiments for each cell line treated with a given drug. * `info`: Metadata for each pharmacological experiment. * `raw`: All cell viability measurements at each drug concentration from the drug dose-response curves. * `profiles`: Drug sensitivity values summarizing each dose-response curve (IC$_{50}$, AUC, etc.) - -This slot is currently being redesigned to support drug combination experiments. -See the `LongTable` vignette for information about the new data strucutre. - This is a list containing all the data pertaining to drug dose response experiments, usually only present in `sensitivity` or `both` type datasets. This includes the names the following names slots in the list: @@ -283,19 +333,42 @@ the PharmacoSet, which is passed to the constructor. Once all the data is in the proper format, it can be passed to a the constructor function as below: +## PharmacoGx 2.0 + +```{r eval=FALSE} +PharmacoGx::PharmacoSet2( + name = "emptySet", + treatment = data.frame(), + sample = data.frame(), + molecularProfiles = MultiAssayExperiment::MultiAssayExperiment(), + treatmentResponse = CoreGx::TreatmentResponseExperiment(), + perturbation = list(), + curation = list( + sample = data.frame(), + treatment = data.frame(), + tissue = data.frame()), + datasetType = "sensitivity" +) + + +``` + +## PharmacoGx 1.0 + ```{r eval=FALSE} -PharmacoSet(name, - molecularProfiles=list(), - sample=data.frame(), - treatment=data.frame(), - sensitivityInfo=data.frame(), - sensitivityRaw=array(dim=c(0,0,0)), - sensitivityProfiles=matrix(), - curationTreatment=data.frame(), - curationSample=data.frame(), - curationTissue=data.frame(), - datasetType=c("sensitivity", "perturbation", "both"), - verify = TRUE) +PharmacoGx::PharmacoSet( + name, + molecularProfiles=list(), + sample=data.frame(), + treatment=data.frame(), + sensitivityInfo=data.frame(), + sensitivityRaw=array(dim=c(0,0,0)), + sensitivityProfiles=matrix(), + curationTreatment=data.frame(), + curationSample=data.frame(), + curationTissue=data.frame(), + datasetType=c("sensitivity", "perturbation", "both"), + verify = TRUE) ``` Here, `name` is the name of the PharmacoSet as described in annotations above, From 048e9135e60d87bfe552b11b723dde802a967eb1 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 19:42:12 +0000 Subject: [PATCH 11/18] chore: .Rbuildignore and DESCRIPTION Update .Rbuildignore and DESCRIPTION files --- .Rbuildignore | 1 + DESCRIPTION | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index fb7c0dc9..1d126be0 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,3 +6,4 @@ CONTRIBUTING.md ^docs$ ^pkgdown$ ^LICENSE\.md$ +.github diff --git a/DESCRIPTION b/DESCRIPTION index 623ac2eb..249bef97 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: PharmacoGx Type: Package Title: Analysis of Large-Scale Pharmacogenomic Data -Version: 3.7.2 -Date: 2024-02-02 +Version: 3.7.3 +Date: 2024-04-08 Authors@R: c( person(given="Petr", family="Smirnov", email="petr.smirnov@uhnresearch.ca", role=c("aut")), From f5ae5e1a008bb3088f5bb45228f05e4ff675db1e Mon Sep 17 00:00:00 2001 From: Jermiah Date: Mon, 8 Apr 2024 20:19:36 +0000 Subject: [PATCH 12/18] update CreatingPharmacoSet.Rmd Refactor vignette code to install required packages if not already installed --- vignettes/CreatingPharmacoSet.Rmd | 6 ------ 1 file changed, 6 deletions(-) diff --git a/vignettes/CreatingPharmacoSet.Rmd b/vignettes/CreatingPharmacoSet.Rmd index a0e358b4..065836ad 100755 --- a/vignettes/CreatingPharmacoSet.Rmd +++ b/vignettes/CreatingPharmacoSet.Rmd @@ -30,9 +30,6 @@ vignette: | \vspace{5pt} \footnotesize ```{r setup, include=FALSE, cache=FALSE, message = FALSE} -if (!requireNamespace("knitr", quietly = TRUE)) { - install.packages("knitr") -} library("knitr") ## Text results @@ -45,9 +42,6 @@ opts_chunk$set(tidy = FALSE, comment = NA, highlight = TRUE) ```{r knitcitation, include=FALSE} -if (!requireNamespace("knitcitations", quietly = TRUE)) { - install.packages("knitcitations") -} library(knitcitations) cleanbib() From c52e6c6ba0c41d3b155f20412eee2dcc809f9e87 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 12 Apr 2024 13:41:40 +0000 Subject: [PATCH 13/18] Update version to 3.7.5 in DESCRIPTION file --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 249bef97..30c76998 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: PharmacoGx Type: Package Title: Analysis of Large-Scale Pharmacogenomic Data -Version: 3.7.3 +Version: 3.7.5 Date: 2024-04-08 Authors@R: c( person(given="Petr", family="Smirnov", email="petr.smirnov@uhnresearch.ca", From b71fff2a5fba82605d0bf5bf783fb766594fd1e8 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 12 Apr 2024 13:42:09 +0000 Subject: [PATCH 14/18] docs: update all docs with roxygen. Add sample_col and treatment_col arguments to drugDoseResponseCurve function --- NAMESPACE | 16 ---------- man/dot-computeZIPdelta.Rd | 4 ++- man/dot-summarizeSensProfiles.Rd | 3 ++ man/drugDoseResponseCurve.Rd | 10 +++++-- ...eSensitivityProfiles-PharmacoSet-method.Rd | 30 +++++++++---------- man/updateObject-PharmacoSet-method.Rd | 5 ++++ 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 329cd28b..6e04c614 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -111,8 +111,6 @@ importClassesFrom(CoreGx,CoreSet) importClassesFrom(CoreGx,LongTable) importClassesFrom(CoreGx,TreatmentResponseExperiment) importClassesFrom(MultiAssayExperiment,MultiAssayExperiment) -importClassesFrom(S4Vectors,DataFrame) -importClassesFrom(S4Vectors,List) importFrom(Biobase,AnnotatedDataFrame) importFrom(BiocParallel,bplapply) importFrom(CoreGx,"sampleInfo<-") @@ -145,7 +143,6 @@ importFrom(CoreGx,sampleNames) importFrom(CoreGx,subsetByFeature) importFrom(CoreGx,treatmentNames) importFrom(CoreGx,updateSampleId) -importFrom(MultiAssayExperiment,MultiAssayExperiment) importFrom(S4Vectors,DataFrame) importFrom(S4Vectors,SimpleList) importFrom(S4Vectors,metadata) @@ -162,22 +159,11 @@ importFrom(SummarizedExperiment,colData) importFrom(SummarizedExperiment,rowData) importFrom(boot,boot) importFrom(boot,boot.ci) -importFrom(checkmate,assert) -importFrom(checkmate,assertCharacter) -importFrom(checkmate,assertClass) -importFrom(checkmate,assertDataFrame) importFrom(checkmate,assertDataTable) importFrom(checkmate,assertInt) -importFrom(checkmate,assertList) importFrom(checkmate,assertLogical) importFrom(checkmate,assertNumeric) -importFrom(checkmate,assertSubset) importFrom(coop,pcor) -importFrom(data.table,":=") -importFrom(data.table,as.data.table) -importFrom(data.table,data.table) -importFrom(data.table,merge.data.table) -importFrom(data.table,tstrsplit) importFrom(downloader,download) importFrom(grDevices,dev.off) importFrom(grDevices,palette) @@ -225,8 +211,6 @@ importFrom(utils,sessionInfo) importFrom(utils,setTxtProgressBar) importFrom(utils,txtProgressBar) importFrom(utils,write.table) -importMethodsFrom(BiocGenerics,"annotation<-") -importMethodsFrom(BiocGenerics,annotation) importMethodsFrom(CoreGx,"annotation<-") importMethodsFrom(CoreGx,"curation<-") importMethodsFrom(CoreGx,"datasetType<-") diff --git a/man/dot-computeZIPdelta.Rd b/man/dot-computeZIPdelta.Rd index 0990ba73..a396fd79 100644 --- a/man/dot-computeZIPdelta.Rd +++ b/man/dot-computeZIPdelta.Rd @@ -78,7 +78,9 @@ See reference for details. \examples{ \dontrun{ ## ZIP is optional. Will be recomputed if not provided. -combo_profiles <- CoreGx::buildComboProfiles(tre, c("HS", "EC50", "E_inf", "ZIP", "combo_viability")) +combo_profiles <- CoreGx::buildComboProfiles( + tre, + c("HS", "EC50", "E_inf", "ZIP", "combo_viability")) combo_profiles[, .computeZIPdelta( treatment1id = treatment1id, diff --git a/man/dot-summarizeSensProfiles.Rd b/man/dot-summarizeSensProfiles.Rd index 8d1c44a1..54262dcd 100644 --- a/man/dot-summarizeSensProfiles.Rd +++ b/man/dot-summarizeSensProfiles.Rd @@ -7,6 +7,9 @@ .summarizeSensProfiles( object, sensitivity.measure = "auc_recomputed", + profiles_assay = "profiles", + treatment_col = "treatmentid", + sample_col = "sampleid", cell.lines, drugs, summary.stat, diff --git a/man/drugDoseResponseCurve.Rd b/man/drugDoseResponseCurve.Rd index 631c5325..45a917e4 100644 --- a/man/drugDoseResponseCurve.Rd +++ b/man/drugDoseResponseCurve.Rd @@ -25,7 +25,9 @@ drugDoseResponseCurve( cex = 0.7, cex.main = 0.9, legend.loc = "topright", - verbose = TRUE + verbose = TRUE, + sample_col = "sampleid", + treatment_col = "treatmentid" ) } \arguments{ @@ -87,6 +89,10 @@ are summarized and replicates are plotted individually otherwise} \item{legend.loc}{And argument passable to xy.coords for the position to place the legend.} \item{verbose}{\code{logical(1)} Should warning messages about the data passed in be printed?} + +\item{sample_col}{\code{character(1)} The name of the column in the profiles assay that contains the sample IDs.} + +\item{treatment_col}{\code{character(1)} The name of the column in the profiles assay that contains the treatment IDs.} } \value{ Plots to the active graphics device and returns an invisible NULL. @@ -109,7 +115,7 @@ drugDoseResponseCurve(concentrations=list("Experiment 1"=c(.008, .04, .2, 1)), # Generate a plot from one or more PSets data(GDSCsmall) -drugDoseResponseCurve(drug="Doxorubicin", cellline="22RV", pSets=GDSCsmall) +drugDoseResponseCurve(drug="Doxorubicin", cellline="22RV1", pSets=GDSCsmall) } } diff --git a/man/summarizeSensitivityProfiles-PharmacoSet-method.Rd b/man/summarizeSensitivityProfiles-PharmacoSet-method.Rd index bb5ab1d8..942e99a7 100644 --- a/man/summarizeSensitivityProfiles-PharmacoSet-method.Rd +++ b/man/summarizeSensitivityProfiles-PharmacoSet-method.Rd @@ -9,6 +9,9 @@ drug vs cell line table} object, sensitivity.measure = "auc_recomputed", cell.lines, + profiles_assay = "profiles", + treatment_col = "treatmentid", + sample_col = "sampleid", drugs, summary.stat = c("mean", "median", "first", "last", "max", "min"), fill.missing = TRUE, @@ -18,29 +21,26 @@ drug vs cell line table} \arguments{ \item{object}{\link{PharmacoSet} The PharmacoSet from which to extract the data} -\item{sensitivity.measure}{\code{character} which sensitivity sensitivity.measure -to use? Use the sensitivityMeasures function to find out what measures are -available for each object.} +\item{sensitivity.measure}{\link{character} The sensitivity measure to use. Use the sensitivityMeasures function to find out what measures are available for each object.} -\item{cell.lines}{\code{character} The cell lines to be summarized. -If any cell lines has no data, it will be filled with -missing values} +\item{cell.lines}{\link{character} The cell lines to be summarized. If any cell lines have no data, they will be filled with missing values.} -\item{drugs}{\code{character} The drugs to be summarized. -If any drugs has no data, it will be filled with -missing values} +\item{profiles_assay}{\link{character} The name of the assay in the PharmacoSet object that contains the sensitivity profiles.} -\item{summary.stat}{\code{character} which summary method to use if there are repeated -cell line-drug experiments? Choices are "mean", "median", "first", or "last"} +\item{treatment_col}{\link{character} The name of the column in the profiles assay that contains the treatment IDs.} -\item{fill.missing}{\code{boolean} should the missing cell lines not in the -molecular data object be filled in with missing values?} +\item{sample_col}{\link{character} The name of the column in the profiles assay that contains the sample IDs.} + +\item{drugs}{\link{character} The drugs to be summarized. If any drugs have no data, they will be filled with missing values.} + +\item{summary.stat}{\link{character} The summary method to use if there are repeated cell line-drug experiments. Choices are "mean", "median", "first", "last", "max", or "min".} + +\item{fill.missing}{Should the missing cell lines not in the molecular data object be filled in with missing values?} \item{verbose}{Should the function print progress messages?} } \value{ -\link{matrix} A matrix with cell lines going down the rows, drugs across -the columns, with the selected sensitivity statistic for each pair. +\link{matrix} A matrix with cell lines going down the rows, drugs across the columns, with the selected sensitivity statistic for each pair. } \description{ This function creates a table with cell lines as rows and drugs as columns, diff --git a/man/updateObject-PharmacoSet-method.Rd b/man/updateObject-PharmacoSet-method.Rd index c49e907c..f0be1d38 100644 --- a/man/updateObject-PharmacoSet-method.Rd +++ b/man/updateObject-PharmacoSet-method.Rd @@ -15,3 +15,8 @@ \description{ Update the PharmacoSet class after changes in it struture or API } +\examples{ +data(GDSCsmall) +updateObject(GDSCsmall) + +} From 032e8644b745e699cbc7221402f826973b88694d Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 12 Apr 2024 13:42:25 +0000 Subject: [PATCH 15/18] refactor: Refactor code in R/methods-[.R, R/updateObject-methods.R, src/metaPermC.c, and R/methods-summarizeSensitivityProfiles.R --- R/PharmacoSet-class.R | 124 ----------------------- R/methods-[.R | 2 - R/methods-summarizeSensitivityProfiles.R | 29 +++--- R/updateObject-methods.R | 6 +- src/metaPermC.c | 4 +- 5 files changed, 19 insertions(+), 146 deletions(-) diff --git a/R/PharmacoSet-class.R b/R/PharmacoSet-class.R index 7c987224..08f18baa 100755 --- a/R/PharmacoSet-class.R +++ b/R/PharmacoSet-class.R @@ -341,130 +341,6 @@ checkPsetStructure <- } } -# ##### -# # Checking cell -# ##### -# if('tissueid' %in% colnames(sampleInfo(object))) { -# if('unique.tissueid' %in% colnames(curation(object)$tissue)) -# { -# if(length(intersect(rownames(curation(object)$tissue), -# sampleNames(object)) != nrow(sampleInfo(object))) { -# message('rownames of curation tissue slot should be the same as cell -# slot (curated cell ids)') -# } else{ -# if(length(intersect(sampleInfo(object)$tissueid, -# curation(object)$tissue$unique.tissueid)) != -# length(table(sampleInfo(object)$tissueid))){ -# message('tissueid should be the same as unique tissue id from tissue -# curation slot') -# } -# } -# } else { -# message('unique.tissueid which is curated tissue id across data set -# should be a column of tissue curation slot') -# } -# if(any(is.na(sampleInfo(object)[,'tissueid']) | sampleInfo(object)[,'tissueid']=='', -# na.rm=TRUE)){ -# message(sprintf('There is no tissue type for this cell line(s): %s', -# paste(rownames(sampleInfo(object))[which(is.na( -# sampleInfo(object)[,'tissueid']) | -# sampleInfo(object)[,'tissueid']=='')], collapse=' '))) -# } -# } else { -# warning('tissueid does not exist in cell slot') -# } -# -# if('unique.sampleid' %in% colnames(curation(object)$cell)) { -# if(length(intersect(curation(object)$cell$unique.sampleid, -# sampleNames(object)) != nrow(sampleInfo(object))) { -# print('rownames of cell slot should be curated cell ids') -# } -# } else { -# print('unique.sampleid which is curated cell id across data set should be a -# column of cell curation slot') -# } -## if("sampleid" %in% colnames(sampleInfo(object))) { -## if(length(intersect(curation(object)$cell$sampleid, sampleNames(object)) -## != nrow(sampleInfo(object))) { -## print('values of sampleid column should be curated cell line ids') -## } -## } else { -## print('sampleid which is curated cell id across data set should be a column of cell slot') -## } -# -# if(length(intersect(rownames(curation(object)$cell), -# sampleNames(object)) != nrow(sampleInfo(object))) { -# print('rownames of curation cell slot should be the same as cell slot -# (curated cell ids)') -# } -# -# if('unique.treatmentid' %in% colnames(curation(object)$treatment)) { -# if(length(intersect(curation(object)$treatment$unique.treatmentid, -# rownames(treatmentInfo(drug)))) != nrow(treatmentInfo(drug))) { -# print('rownames of drug slot should be curated drug ids') -# } -# } else { -# print('unique.treatmentid which is curated drug id across data set should be a -# column of drug curation slot') -# } -# -## if("treatmentid" %in% colnames(treatmentInfo(drug))) { -## if(length(intersect(curation(object)$treatment$treatmentid, -## rownames(treatmentInfo(drug)))) != nrow(treatmentInfo(drug))) { -## print('values of treatmentid column should be curated drug ids') -## } -## } else { -## print('treatmentid which is curated drug id across data set should be a -## column of drug slot') -## } -# -# if(length(intersect(rownames(curation(object)$cell), -# sampleNames(object)) != nrow(sampleInfo(object))) { -# print('rownames of curation drug slot should be the same as drug -# slot (curated drug ids)') -# } -# -# if(!is(sampleInfo(object), 'data.frame')) { -# warning('cell slot class type should be dataframe') -# } -# if(!is(treatmentInfo(drug), 'data.frame')) { -# warning('drug slot class type should be dataframe') -# } -# if(datasetType(object) %in% c('sensitivity', 'both')) -# { -# if(!is(sensitivityInfo(object), 'data.frame')) { -# warning('sensitivity info slot class type should be dataframe') -# } -# if("sampleid" %in% colnames(sensitivityInfo(object))) { -# if(!all(sensitivityInfo(object)[,"sampleid"] %in% sampleNames(object)){ -# warning('not all the cell lines in sensitivity data are in cell slot') -# } -# }else { -# warning('sampleid does not exist in sensitivity info') -# } -# if("treatmentid" %in% colnames(sensitivityInfo(object))) { -# drug.ids <- unique(sensitivityInfo(object)[,"treatmentid"]) -# drug.ids <- drug.ids[grep('///',drug.ids, invert=TRUE)] -# if(!all(drug.ids %in% rownames(treatmentInfo(drug)))) { -# print('not all the drugs in sensitivity data are in drug slot') -# } -# }else { -# warning('treatmentid does not exist in sensitivity info') -# } -# -# if(any(!is.na(sensitivityRaw(object)))) { -# if(!all(dimnames(sensitivityRaw(object))[[1]] %in% -# rownames(sensitivityInfo(object)))) { -# warning('For some experiments there is raw sensitivity data but no -# experiment information in sensitivity info') -# } -# } -# if(!all(rownames(sensitivityProfiles(object)) %in% -# rownames(sensitivityInfo(object)))) { -# warning('For some experiments there is sensitivity profiles but no -# experiment information in sensitivity info') -# } -# } } diff --git a/R/methods-[.R b/R/methods-[.R index 8b2313e3..cf24e4fb 100755 --- a/R/methods-[.R +++ b/R/methods-[.R @@ -1,6 +1,4 @@ # ==== PharmacoSet Class - - #'`[` #' #' @examples diff --git a/R/methods-summarizeSensitivityProfiles.R b/R/methods-summarizeSensitivityProfiles.R index b3cb4256..3c2e312d 100755 --- a/R/methods-summarizeSensitivityProfiles.R +++ b/R/methods-summarizeSensitivityProfiles.R @@ -26,10 +26,18 @@ #' @importMethodsFrom CoreGx summarizeSensitivityProfiles #' @export setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), - function(object, sensitivity.measure="auc_recomputed", cell.lines, profiles_assay = "profiles", - treatment_col = "treatmentid", sample_col = "sampleid", - drugs, summary.stat=c("mean", "median", "first", "last", "max", "min"), - fill.missing=TRUE, verbose=TRUE) { + function( + object, + sensitivity.measure="auc_recomputed", + cell.lines, + profiles_assay = "profiles", + treatment_col = "treatmentid", + sample_col = "sampleid", + drugs, + summary.stat=c("mean", "median", "first", "last", "max", "min"), + fill.missing=TRUE, + verbose=TRUE + ) { if (is(treatmentResponse(object), 'LongTable')) .summarizeSensProfiles(object, sensitivity.measure, profiles_assay = profiles_assay, treatment_col, sample_col, cell.lines, drugs, summary.stat, fill.missing) @@ -177,16 +185,6 @@ setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), rownames(result) <- drugs colnames(result) <- cell.lines - # if(verbose){ - - # message(sprintf("Summarizing %s sensitivity data for:\t%s", sensitivity.measure, annotation(object)$name)) - # total <- length(drugs)*length(cell.lines) - # # create progress bar - # pb <- utils::txtProgressBar(min=0, max=total, style=3) - # i <- 1 - - - # } if(is.factor(dd[, sensitivity.measure]) | is.character(dd[, sensitivity.measure])){ warning("Sensitivity measure is stored as a factor or character in the pSet. This is incorrect.\n Please correct this and/or file an issue. Fixing in the call of this function.") @@ -213,9 +211,6 @@ setMethod("summarizeSensitivityProfiles", signature(object="PharmacoSet"), pp_dd <- pp_dd[pp_dd[,"sampleid"] %in% cell.lines & pp_dd[,"treatmentid"]%in%drugs,] tt <- reshape2::acast(pp_dd, treatmentid ~ sampleid, fun.aggregate=summary.function, value.var="sensitivity.measure") - # tt <- tt[drugs, cell.lines] - - result[rownames(tt), colnames(tt)] <- tt diff --git a/R/updateObject-methods.R b/R/updateObject-methods.R index a862def8..7eebb159 100755 --- a/R/updateObject-methods.R +++ b/R/updateObject-methods.R @@ -3,7 +3,11 @@ #' @param object A `PharmacoSet` object to update the class structure for. #' #' @return `PharmacoSet` with update class structure. -#' +#' +#' @examples +#' data(GDSCsmall) +#' updateObject(GDSCsmall) +#' #' @md #' @importMethodsFrom CoreGx updateObject #' @export diff --git a/src/metaPermC.c b/src/metaPermC.c index e43061ac..9aec07ca 100755 --- a/src/metaPermC.c +++ b/src/metaPermC.c @@ -140,7 +140,7 @@ void runPerm(double *out, - uint64_t num_larger = 0; + // uint64_t num_larger = 0; // Unused uint64_t cur_success = 0; uint64_t cur_iter = 1; @@ -325,7 +325,7 @@ SEXP partialCorQUICKSTOP(SEXP pin_x, int log_decision_boundary = *INTEGER(plog_decision_boundary); - double temp; + // double temp; // Unused uint64_t N = (uint64_t) Ndouble; uint64_t max_iter = (uint64_t) MaxIterdouble; From 592a42e15fb6c1a3a89e168421507560edea6396 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 12 Apr 2024 13:42:38 +0000 Subject: [PATCH 16/18] ci: update R-CMD-check-bioc.yml Update branch filter in R-CMD-check-bioc.yml workflow --- .github/workflows/R-CMD-check-bioc.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check-bioc.yml b/.github/workflows/R-CMD-check-bioc.yml index 94ecc788..48ec680d 100755 --- a/.github/workflows/R-CMD-check-bioc.yml +++ b/.github/workflows/R-CMD-check-bioc.yml @@ -23,9 +23,7 @@ on: push: branches: - - master - - main - - devel + - [ * ] pull_request: branches: - master From 9324b7defbbc0a9a6816dff85e4eb19665d57832 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 12 Apr 2024 13:43:20 +0000 Subject: [PATCH 17/18] Update branch filter in R-CMD-check-bioc.yml workflow --- .github/workflows/R-CMD-check-bioc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-bioc.yml b/.github/workflows/R-CMD-check-bioc.yml index 48ec680d..8ae09aff 100755 --- a/.github/workflows/R-CMD-check-bioc.yml +++ b/.github/workflows/R-CMD-check-bioc.yml @@ -23,7 +23,7 @@ on: push: branches: - - [ * ] + - [ "*" ] pull_request: branches: - master From 4a80e0b0354cc4fa085c3e3b1106cbc006bf4492 Mon Sep 17 00:00:00 2001 From: Jermiah Date: Fri, 12 Apr 2024 13:43:41 +0000 Subject: [PATCH 18/18] Update branch filter in R-CMD-check-bioc.yml workflow --- .github/workflows/R-CMD-check-bioc.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/R-CMD-check-bioc.yml b/.github/workflows/R-CMD-check-bioc.yml index 8ae09aff..1e949c41 100755 --- a/.github/workflows/R-CMD-check-bioc.yml +++ b/.github/workflows/R-CMD-check-bioc.yml @@ -22,8 +22,6 @@ on: push: - branches: - - [ "*" ] pull_request: branches: - master