From 025e423e0959c17abb454456ae88dd8abd4f02a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Pag=C3=A8s?= Date: Fri, 28 Feb 2020 22:03:53 -0800 Subject: [PATCH] resync with SummarizedExperiment 1.17.3 --- DESCRIPTION | 4 ++-- R/ZscoreMatrix.R | 2 +- R/class-OutriderDataSet.R | 16 ++++++++-------- R/filterExpression.R | 2 +- R/getNSetterFuns.R | 6 +++--- R/getNSetterFunsInternal.R | 2 +- R/method-counts.R | 4 ++-- R/method-gridSearch.R | 8 ++++---- tests/testthat/helper_test_data_set.R | 6 +++--- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 836426a..da6bf16 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: OUTRIDER Title: OUTRIDER - OUTlier in RNA-Seq fInDER Type: Package -Version: 1.5.0 -Date: 2019-09-24 +Version: 1.5.1 +Date: 2020-02-29 URL: https://github.com/gagneurlab/OUTRIDER BugRepots: https://github.com/gagneurlab/OUTRIDER/issues Authors@R: c( diff --git a/R/ZscoreMatrix.R b/R/ZscoreMatrix.R index 3992301..38513d1 100644 --- a/R/ZscoreMatrix.R +++ b/R/ZscoreMatrix.R @@ -59,7 +59,7 @@ ZscoreMatrix <- function(ods, peerResiduals){ Zscore <- (residuals - rowMeans(residuals)) / rowSds(residuals) } - assay(ods, "l2fc") <- log2fc + assay(ods, "l2fc", withDimnames=FALSE) <- log2fc zScore(ods) <- Zscore validObject(ods) return(ods) diff --git a/R/class-OutriderDataSet.R b/R/class-OutriderDataSet.R index b7bd95e..50c7bd2 100644 --- a/R/class-OutriderDataSet.R +++ b/R/class-OutriderDataSet.R @@ -210,12 +210,12 @@ makeExampleOutriderDataSet <- function(n=200, m=80, q=10, freq=1E-3, zScore=6, colnames(countData) <- paste0("sample_", seq_len(m)) ods <- OutriderDataSet(countData=countData) - assay(ods, "trueMean") <- mu - assay(ods, "trueSd") <- matrix(true_sd, nrow=n, ncol=m) - mcols(ods)[,"trueTheta"] <- theta - colData(ods)[['trueSizeFactor']] <- sf - metadata(ods)[['optimalEncDim']] <- q - metadata(ods)[['encDimTable']] <- data.table( + assay(ods, "trueMean", withDimnames=FALSE) <- mu + assay(ods, "trueSd", withDimnames=FALSE) <- matrix(true_sd, nrow=n, ncol=m) + mcols(ods)[,"trueTheta"] <- theta + colData(ods)[['trueSizeFactor']] <- sf + metadata(ods)[['optimalEncDim']] <- q + metadata(ods)[['encDimTable']] <- data.table( encodingDimension=q, evaluationLoss=1, evalMethod='simulation') # @@ -254,9 +254,9 @@ makeExampleOutriderDataSet <- function(n=200, m=80, q=10, freq=1E-3, zScore=6, } mode(k) <- "integer" - assay(ods, 'trueCounts') <- counts(ods) + assay(ods, 'trueCounts', withDimnames=FALSE) <- counts(ods) counts(ods) <- k - assay(ods, "trueOutliers") <- indexOut + assay(ods, "trueOutliers", withDimnames=FALSE) <- indexOut return(ods) } diff --git a/R/filterExpression.R b/R/filterExpression.R index 7862333..17ea8ff 100644 --- a/R/filterExpression.R +++ b/R/filterExpression.R @@ -65,7 +65,7 @@ filterExp <- function(ods, fpkmCutoff, percentile, filterGenes, savefpkm, addExpressedGenes){ fpkm <- fpkm(ods) if(savefpkm){ - assays(ods)[['fpkm']] <- fpkm + assays(ods, withDimnames=FALSE)[['fpkm']] <- fpkm } passed <- rowQuantiles(fpkm, probs=percentile) > fpkmCutoff mcols(ods)['passedFilter'] <- passed diff --git a/R/getNSetterFuns.R b/R/getNSetterFuns.R index 6af7b11..b41c5e8 100644 --- a/R/getNSetterFuns.R +++ b/R/getNSetterFuns.R @@ -36,7 +36,7 @@ zScore <- function(ods){ `zScore<-` <- function(ods, value){ stopifnot(is.matrix(value)) stopifnot(dim(ods) == dim(value)) - assay(ods, 'zScore') <- value + assay(ods, 'zScore', withDimnames=FALSE) <- value return(ods) } @@ -52,7 +52,7 @@ pValue <- function(ods){ `pValue<-` <- function(ods, value){ stopifnot(is.matrix(value)) stopifnot(dim(ods) == dim(value)) - assay(ods, 'pValue') <- value + assay(ods, 'pValue', withDimnames=FALSE) <- value return(ods) } @@ -69,7 +69,7 @@ padj <- function(ods){ `padj<-` <- function(ods, value){ stopifnot(is.matrix(value)) stopifnot(dim(ods) == dim(value)) - assay(ods, 'padjust') <- value + assay(ods, 'padjust', withDimnames=FALSE) <- value return(ods) } diff --git a/R/getNSetterFunsInternal.R b/R/getNSetterFunsInternal.R index 88bb1e8..808e1eb 100644 --- a/R/getNSetterFunsInternal.R +++ b/R/getNSetterFunsInternal.R @@ -115,7 +115,7 @@ trueCounts <- function(ods){ `trueCounts<-` <- function(ods, value){ if(!'replacedTrueCounts' %in% assayNames(ods)){ - assay(ods, 'replacedTrueCounts') <- value + assay(ods, 'replacedTrueCounts', withDimnames=FALSE) <- value } return(ods) } diff --git a/R/method-counts.R b/R/method-counts.R index 9d4bd62..2006fe2 100644 --- a/R/method-counts.R +++ b/R/method-counts.R @@ -1,7 +1,7 @@ counts.replace.OutriderDataSet <- function(object, value){ mode(value) <- "integer" - assays(object)[["counts"]] <- value + assays(object, withDimnames=FALSE)[["counts"]] <- value validObject(object) object @@ -95,7 +95,7 @@ normFactors.replace.OutriderDataSet <- function(object, value) { stopifnot(all(value > 0)) # set the values and check the object - assays(object)[["normalizationFactors"]] <- value + assays(object, withDimnames=FALSE)[["normalizationFactors"]] <- value validObject(object) object } diff --git a/R/method-gridSearch.R b/R/method-gridSearch.R index bd8db4e..07f2736 100644 --- a/R/method-gridSearch.R +++ b/R/method-gridSearch.R @@ -156,7 +156,7 @@ findInjectZscore <- function(ods, freq=1E-2, #' @noRd injectOutliers <- function(ods, freq, zScore, inj, lnorm, sdlog){ # copy true counts to be able to acces them in the loss later - assays(ods)[['trueCounts']] <- counts(ods) + assays(ods, withDimnames=FALSE)[['trueCounts']] <- counts(ods) # generate index of injected counts size <- prod(dim(ods)) @@ -207,9 +207,9 @@ injectOutliers <- function(ods, freq, zScore, inj, lnorm, sdlog){ } } # save coruppted counts and index of corruption into ods - assay(ods, 'counts') <- matrix(as.integer(counts),nrow(ods)) - assay(ods, 'trueCorruptions') <- index - assay(ods, 'injectedZscore') <- zScore + assay(ods, 'counts', withDimnames=FALSE) <- matrix(as.integer(counts),nrow(ods)) + assay(ods, 'trueCorruptions', withDimnames=FALSE) <- index + assay(ods, 'injectedZscore', withDimnames=FALSE) <- zScore return(ods) } diff --git a/tests/testthat/helper_test_data_set.R b/tests/testthat/helper_test_data_set.R index aad17c0..7777e07 100644 --- a/tests/testthat/helper_test_data_set.R +++ b/tests/testthat/helper_test_data_set.R @@ -71,9 +71,9 @@ get_test_outrider_dataset <- function(){ normalizationFactors(ods) <- normF_round3 mcols(ods)[['mu']] <- mu_round4 mcols(ods)[['disp']] <- disp_round4 - assays(ods)[['pValue']] <- pval_round4 - assays(ods)[['padjust']] <- padj_round4 - assays(ods)[['zScore']] <- zscore_round4 + assays(ods, withDimnames=FALSE)[['pValue']] <- pval_round4 + assays(ods, withDimnames=FALSE)[['padjust']] <- padj_round4 + assays(ods, withDimnames=FALSE)[['zScore']] <- zscore_round4 return(ods) }