From 81ed90d183776e7fc2857559734167c75fa751dd Mon Sep 17 00:00:00 2001 From: Luke Zappia <lazappi@users.noreply.github.com> Date: Thu, 7 Sep 2017 16:48:55 +1000 Subject: [PATCH] Update SCE and comparison functions --- NAMESPACE | 8 +- R/SCE-functions.R | 76 +++---- R/compare.R | 261 ++++++++++++---------- man/addFeatureStats.Rd | 18 +- man/addGeneLengths.Rd | 26 ++- man/{compareSCESets.Rd => compareSCEs.Rd} | 22 +- man/{diffSCESets.Rd => diffSCEs.Rd} | 38 ++-- man/makeCompPanel.Rd | 6 +- man/makeDiffPanel.Rd | 6 +- man/makeOverallPanel.Rd | 6 +- man/summariseDiff.Rd | 8 +- 11 files changed, 248 insertions(+), 227 deletions(-) rename man/{compareSCESets.Rd => compareSCEs.Rd} (80%) rename man/{diffSCESets.Rd => diffSCEs.Rd} (71%) diff --git a/NAMESPACE b/NAMESPACE index 53c0acc..216436b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,8 +11,8 @@ S3method(simpleEstimate,matrix) S3method(splatEstimate,SingleCellExperiment) S3method(splatEstimate,matrix) export(addGeneLengths) -export(compareSCESets) -export(diffSCESets) +export(compareSCEs) +export(diffSCEs) export(getParam) export(getParams) export(listSims) @@ -45,10 +45,9 @@ exportClasses(LunParams) exportClasses(SCDDParams) exportClasses(SimpleParams) exportClasses(SplatParams) -importFrom(Biobase,"fData<-") -importFrom(Biobase,fData) importFrom(BiocParallel,SerialParam) importFrom(BiocParallel,bplapply) +importFrom(SingleCellExperiment,"cpm<-") importFrom(SingleCellExperiment,SingleCellExperiment) importFrom(SummarizedExperiment,"assays<-") importFrom(SummarizedExperiment,"colData<-") @@ -91,7 +90,6 @@ importFrom(methods,new) importFrom(methods,slot) importFrom(methods,slotNames) importFrom(methods,validObject) -importFrom(scater,"cpm<-") importFrom(stats,dnbinom) importFrom(stats,median) importFrom(stats,model.matrix) diff --git a/R/SCE-functions.R b/R/SCE-functions.R index 2a92c35..a4b97d8 100644 --- a/R/SCE-functions.R +++ b/R/SCE-functions.R @@ -1,11 +1,11 @@ #' Add feature statistics #' -#' Add additional feature statistics to an SCESet object +#' Add additional feature statistics to a SingleCellExperiment object #' -#' @param sce SCESet to add feature statistics to. +#' @param sce SingleCellExperiment to add feature statistics to. #' @param value the expression value to calculate statistics for. Options are #' "counts", "cpm", "tpm" or "fpkm". The values need to exist in the -#' given SCESet. +#' given SingleCellExperiment. #' @param log logical. Whether to take log2 before calculating statistics. #' @param offset offset to add to avoid taking log of zero. #' @param no.zeros logical. Whether to remove all zeros from each feature before @@ -14,34 +14,38 @@ #' @details #' Currently adds the following statistics: mean, variance, coefficient of #' variation, median and median absolute deviation. Statistics are added to -#' the \code{fData} slot and are named \code{Stat[Log]Value[No0]} where -#' \code{Log} and \code{No0} are added if those arguments are true. -#' UpperCamelCase is used to differentiate these columns from those added by -#' \code{scater}. +#' the \code{\link[SummarizedExperiment]{rowData}} slot and are named +#' \code{Stat[Log]Value[No0]} where \code{Log} and \code{No0} are added if those +#' arguments are true. UpperCamelCase is used to differentiate these columns +#' from those added by analysis packages. #' -#' @return SCESet with additional feature statistics +#' @return SingleCellExperiment with additional feature statistics #' -#' @importFrom Biobase fData fData<- +#' @importFrom SummarizedExperiment rowData rowData<- addFeatureStats <- function(sce, value = c("counts", "cpm", "tpm", "fpkm"), log = FALSE, offset = 1, no.zeros = FALSE) { + checkmate::assertClass(sce, "SingleCellExperiment") + checkmate::assertLogical(log) + checkmate::assertNumber(offset, lower = 0) + checkmate::assertLogical(no.zeros) value <- match.arg(value) switch(value, counts = { - values = scater::counts(sce) + values = SummarizedExperiment::assays(sce)$counts suffix <- "Counts" }, cpm = { - values = scater::cpm(sce) + values = SummarizedExperiment::assays(sce)$cpm suffix <- "CPM" }, tpm = { - values = scater::tpm(sce) + values = SummarizedExperiment::assays(sce)$tpm suffix <- "TPM" }, fpkm = { - values = scater::fpkm(sce) + values = SummarizedExperiment::assays(sce)$fpkm suffix <- "FPKM" } ) @@ -62,41 +66,43 @@ addFeatureStats <- function(sce, value = c("counts", "cpm", "tpm", "fpkm"), med.str <- paste0("Med", suffix) mad.str <- paste0("MAD", suffix) - fData(sce)[, mean.str] <- rowMeans(values, na.rm = TRUE) - fData(sce)[, var.str] <- matrixStats::rowVars(values, na.rm = TRUE) - fData(sce)[, cv.str] <- sqrt(fData(sce)[, var.str]) / - fData(sce)[, mean.str] - fData(sce)[, med.str] <- matrixStats::rowMedians(values, na.rm = TRUE) - fData(sce)[, mad.str] <- matrixStats::rowMads(values, na.rm = TRUE) + rowData(sce)[, mean.str] <- rowMeans(values, na.rm = TRUE) + rowData(sce)[, var.str] <- matrixStats::rowVars(values, na.rm = TRUE) + rowData(sce)[, cv.str] <- sqrt(rowData(sce)[, var.str]) / + rowData(sce)[, mean.str] + rowData(sce)[, med.str] <- matrixStats::rowMedians(values, na.rm = TRUE) + rowData(sce)[, mad.str] <- matrixStats::rowMads(values, na.rm = TRUE) return(sce) } #' Add gene lengths #' -#' Add gene lengths to an SCESet object +#' Add gene lengths to an SingleCellExperiment object #' -#' @param sce SCESet to add gene lengths to. +#' @param sce SingleCellExperiment to add gene lengths to. #' @param method Method to use for creating lengths. #' @param loc Location parameter for the generate method. #' @param scale Scale parameter for the generate method. #' @param lengths Vector of lengths for the sample method. #' #' @details -#' This function adds simulated gene lengths to the \code{fData} slot of an -#' \code{SCESet} object that can be used for calculating length normalised -#' expression values such as TPM or FPKM. The \code{generate} simulates lengths -#' using a (rounded) log-normal distribution, with the default \code{loc} and -#' \code{scale} parameters based on human coding genes. Alternatively the -#' \code{sample} method can be used which randomly samples lengths (with -#' replacement) from a supplied vector. +#' This function adds simulated gene lengths to the +#' \code{\link[SummarizedExperiment]{rowData}} slot of a +#' \code{\link[SingleCellExperiment]{SingleCellExperiment}} object that can be +#' used for calculating length normalised expression values such as TPM or FPKM. +#' The \code{generate} method simulates lengths using a (rounded) log-normal +#' distribution, with the default \code{loc} and \code{scale} parameters based +#' on human protein-coding genes. Alternatively the \code{sample} method can be +#' used which randomly samples lengths (with replacement) from a supplied +#' vector. #' -#' @return SCESet with added gene lengths +#' @return SingleCellExperiment with added gene lengths #' @examples #' # Default generate method #' sce <- simpleSimulate() #' sce <- addGeneLengths(sce) -#' head(fData(sce)) +#' head(rowData(sce)) #' # Sample method (human coding genes) #' \dontrun{ #' library(TxDb.Hsapiens.UCSC.hg19.knownGene) @@ -113,7 +119,7 @@ addGeneLengths <- function(sce, method = c("generate", "sample"), loc = 7.9, scale = 0.7, lengths = NULL) { method <- match.arg(method) - checkmate::assertClass(sce, "SCESet") + checkmate::assertClass(sce, "SingleCellExperiment") checkmate::assertNumber(loc) checkmate::assertNumber(scale, lower = 0) checkmate::assertNumeric(lengths, lower = 0, null.ok = TRUE) @@ -132,13 +138,7 @@ addGeneLengths <- function(sce, method = c("generate", "sample"), loc = 7.9, } ) - fData(sce)$Length <- sim.lengths + rowData(sce)$Length <- sim.lengths return(sce) } - -#txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene::TxDb.Hsapiens.UCSC.hg19.knownGene -#tx.lens <- GenomicFeatures::transcriptLengths(txdb, with.cds_len = TRUE) -#tx.lens <- tx.lens[tx.lens$cds_len > 0, ] -#gene.lens <- max(IRanges::splitAsList(tx.lens$tx_len, tx.lens$gene_id)) -#lens <- rlnorm(length(gene.lens), meanlog = 7.9, sdlog = 0.7) diff --git a/R/compare.R b/R/compare.R index 45af803..6739fb9 100644 --- a/R/compare.R +++ b/R/compare.R @@ -1,9 +1,10 @@ -#' Compare SCESet objects +#' Compare SingleCellExperiment objects #' -#' Combine the data from several SCESet objects and produce some basic plots -#' comparing them. +#' Combine the data from several SingleCellExperiment objects and produce some +#' basic plots comparing them. #' -#' @param sces named list of SCESet objects to combine and compare. +#' @param sces named list of SingleCellExperiment objects to combine and +#' compare. #' @param point.size size of points in scatter plots. #' @param point.alpha opacity of points in scatter plots. #' @param fits whether to include fits in scatter plots. @@ -14,8 +15,9 @@ #' #' \describe{ #' \item{\code{FeatureData}}{Combined feature data from the provided -#' SCESets.} -#' \item{\code{PhenoData}}{Combined pheno data from the provided SCESets.} +#' SingleCellExperiments.} +#' \item{\code{PhenoData}}{Combined pheno data from the provided +#' SingleCellExperiments.} #' \item{\code{Plots}}{Comparison plots #' \describe{ #' \item{\code{Means}}{Boxplot of mean distribution.} @@ -44,19 +46,19 @@ #' @examples #' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) #' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -#' comparison <- compareSCESets(list(Splat = sim1, Simple = sim2)) +#' comparison <- compareSCEs(list(Splat = sim1, Simple = sim2)) #' names(comparison) #' names(comparison$Plots) #' @importFrom ggplot2 ggplot aes_string geom_point geom_smooth geom_boxplot #' scale_y_continuous scale_y_log10 scale_x_log10 xlab ylab ggtitle #' theme_minimal scale_colour_manual scale_fill_manual -#' @importFrom scater cpm<- +#' @importFrom SingleCellExperiment cpm<- #' @export -compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, - fits = TRUE, colours = NULL) { +compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1, + fits = TRUE, colours = NULL) { - checkmate::assertList(sces, types = "SCESet", any.missing = FALSE, - min.len = 1, names = "unique") + checkmate::assertList(sces, types = "SingleCellExperiment", + any.missing = FALSE, min.len = 1, names = "unique") checkmate::assertNumber(point.size, finite = TRUE) checkmate::assertNumber(point.alpha, lower = 0, upper = 1) checkmate::assertLogical(fits, any.missing = FALSE, len = 1) @@ -70,51 +72,53 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, for (name in names(sces)) { sce <- sces[[name]] - fData(sce)$Dataset <- name - pData(sce)$Dataset <- name + rowData(sce)$Dataset <- name + colData(sce)$Dataset <- name sce <- scater::calculateQCMetrics(sce) - cpm(sce) <- edgeR::cpm(counts(sce)) + cpm(sce) <- scater::calculateCPM(sce, use.size.factors = FALSE) sce <- addFeatureStats(sce, "counts") sce <- addFeatureStats(sce, "cpm") sce <- addFeatureStats(sce, "cpm", log = TRUE) + colData(sce)$PctZero <- 100 * (1 - colData(sce)$total_features / + nrow(sce)) sces[[name]] <- sce } - fData.all <- fData(sces[[1]]) - pData.all <- pData(sces[[1]]) + features <- rowData(sces[[1]]) + cells <- colData(sces[[1]]) if (length(sces) > 1) { for (name in names(sces)[-1]) { sce <- sces[[name]] - fData.all <- rbindMatched(fData.all, fData(sce)) - pData.all <- rbindMatched(pData.all, pData(sce)) + features <- rbindMatched(features, rowData(sce)) + cells <- rbindMatched(cells, colData(sce)) } } - fData.all$Dataset <- factor(fData.all$Dataset, levels = names(sces)) - pData.all$Dataset <- factor(pData.all$Dataset, levels = names(sces)) + features$Dataset <- factor(features$Dataset, levels = names(sces)) + cells$Dataset <- factor(cells$Dataset, levels = names(sces)) + features <- data.frame(features) + cells <- data.frame(cells) - means <- ggplot(fData.all, + means <- ggplot(features, aes_string(x = "Dataset", y = "MeanLogCPM", colour = "Dataset")) + - #geom_violin(draw_quantiles = c(0.25, 0.5, 0.75)) + geom_boxplot() + scale_colour_manual(values = colours) + ylab(expression(paste("Mean ", log[2], "(CPM + 1)"))) + ggtitle("Distribution of mean expression") + theme_minimal() - vars <- ggplot(fData.all, + vars <- ggplot(features, aes_string(x = "Dataset", y = "VarLogCPM", colour = "Dataset")) + - #geom_violin(draw_quantiles = c(0.25, 0.5, 0.75)) + geom_boxplot() + scale_colour_manual(values = colours) + ylab(expression(paste("Variance ", log[2], "(CPM + 1)"))) + ggtitle("Distribution of variance") + theme_minimal() - mean.var <- ggplot(fData.all, + mean.var <- ggplot(features, aes_string(x = "MeanLogCPM", y = "VarLogCPM", colour = "Dataset", fill = "Dataset")) + geom_point(size = point.size, alpha = point.alpha) + @@ -125,7 +129,7 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, ggtitle("Mean-variance relationship") + theme_minimal() - libs <- ggplot(pData.all, + libs <- ggplot(cells, aes_string(x = "Dataset", y = "total_counts", colour = "Dataset")) + geom_boxplot() + @@ -135,8 +139,8 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, ggtitle("Distribution of library sizes") + theme_minimal() - z.gene <- ggplot(fData.all, - aes_string(x = "Dataset", y = "pct_dropout", + z.gene <- ggplot(features, + aes_string(x = "Dataset", y = "pct_dropout_counts", colour = "Dataset")) + geom_boxplot() + scale_y_continuous(limits = c(0, 100)) + @@ -145,8 +149,8 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, ggtitle("Distribution of zeros per gene") + theme_minimal() - z.cell <- ggplot(pData.all, - aes_string(x = "Dataset", y = "pct_dropout", + z.cell <- ggplot(cells, + aes_string(x = "Dataset", y = "PctZero", colour = "Dataset")) + geom_boxplot() + scale_y_continuous(limits = c(0, 100)) + @@ -155,8 +159,8 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, ggtitle("Distribution of zeros per cell") + theme_minimal() - mean.zeros <- ggplot(fData.all, - aes_string(x = "MeanCounts", y = "pct_dropout", + mean.zeros <- ggplot(features, + aes_string(x = "MeanCounts", y = "pct_dropout_counts", colour = "Dataset", fill = "Dataset")) + geom_point(size = point.size, alpha = point.alpha) + scale_x_log10(labels = scales::comma) + @@ -172,8 +176,8 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, mean.zeros <- mean.zeros + geom_smooth() } - comparison <- list(FeatureData = fData.all, - PhenoData = pData.all, + comparison <- list(FeatureData = features, + PhenoData = cells, Plots = list(Means = means, Variances = vars, MeanVar = mean.var, @@ -185,13 +189,15 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, return(comparison) } -#' Diff SCESet objects +#' Diff SingleCellExperiment objects #' -#' Combine the data from several SCESet objects and produce some basic plots -#' comparing them to a reference. +#' Combine the data from several SingleCellExperiment objects and produce some +#' basic plots comparing them to a reference. #' -#' @param sces named list of SCESet objects to combine and compare. -#' @param ref string giving the name of the SCESet to use as the reference +#' @param sces named list of SingleCellExperiment objects to combine and +#' compare. +#' @param ref string giving the name of the SingleCellExperiment to use as the +#' reference #' @param point.size size of points in scatter plots. #' @param point.alpha opacity of points in scatter plots. #' @param fits whether to include fits in scatter plots. @@ -199,19 +205,21 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, #' #' @details #' -#' This function aims to look at the differences between a reference SCESet and -#' one or more others. It requires each SCESet to have the same dimensions. -#' Properties are compared by ranks, for example when comparing the means the -#' values are ordered and the differences between the reference and another -#' dataset plotted. A series of Q-Q plots are also returned. +#' This function aims to look at the differences between a reference +#' SingleCellExperiment and one or more others. It requires each +#' SingleCellExperiment to have the same dimensions. Properties are compared by +#' ranks, for example when comparing the means the values are ordered and the +#' differences between the reference and another dataset plotted. A series of +#' Q-Q plots are also returned. #' #' The returned list has five items: #' #' \describe{ -#' \item{\code{Reference}}{The SCESet used as the reference.} +#' \item{\code{Reference}}{The SingleCellExperiment used as the reference.} #' \item{\code{FeatureData}}{Combined feature data from the provided -#' SCESets.} -#' \item{\code{PhenoData}}{Combined pheno data from the provided SCESets.} +#' SingleCellExperiments.} +#' \item{\code{PhenoData}}{Combined pheno data from the provided +#' SingleCellExperiments.} #' \item{\code{Plots}}{Difference plots #' \describe{ #' \item{\code{Means}}{Boxplot of mean differences.} @@ -251,26 +259,26 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, #' @examples #' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) #' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -#' difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") +#' difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple") #' names(difference) #' names(difference$Plots) #' @importFrom ggplot2 ggplot aes_string geom_point geom_boxplot xlab ylab #' ggtitle theme_minimal geom_hline geom_abline scale_colour_manual #' scale_fill_manual -#' @importFrom scater cpm<- +#' @importFrom SingleCellExperiment cpm<- #' @export -diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, - fits = TRUE, colours = NULL) { +diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, + fits = TRUE, colours = NULL) { - checkmate::assertList(sces, types = "SCESet", any.missing = FALSE, - min.len = 2, names = "unique") + checkmate::assertList(sces, types = "SingleCellExperiment", + any.missing = FALSE, min.len = 2, names = "unique") checkmate::assertString(ref) checkmate::assertNumber(point.size, finite = TRUE) checkmate::assertNumber(point.alpha, lower = 0, upper = 1) checkmate::assertLogical(fits, any.missing = FALSE, len = 1) if (!(ref %in% names(sces))) { - stop("'ref' must be the name of an SCESet in 'sces'") + stop("'ref' must be the name of a SingleCellExperiment in 'sces'") } else { ref.idx <- which(names(sces) == ref) } @@ -290,49 +298,54 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, if (!identical(dim(sce), ref.dim)) { stop("SCESets must have the same dimensions") } - fData(sce)$Dataset <- name - pData(sce)$Dataset <- name + rowData(sce)$Dataset <- name + colData(sce)$Dataset <- name sce <- scater::calculateQCMetrics(sce) - cpm(sce) <- edgeR::cpm(counts(sce)) + cpm(sce) <- scater::calculateCPM(sce, use.size.factors = FALSE) sce <- addFeatureStats(sce, "counts") sce <- addFeatureStats(sce, "cpm", log = TRUE) + colData(sce)$PctZero <- 100 * (1 - colData(sce)$total_features / + nrow(sce)) sces[[name]] <- sce } ref.sce <- sces[[ref]] - ref.means <- sort(fData(ref.sce)$MeanLogCPM) - ref.vars <- sort(fData(ref.sce)$VarLogCPM) - ref.libs <- sort(pData(ref.sce)$total_counts) - ref.z.gene <- sort(fData(ref.sce)$pct_dropout) - ref.z.cell <- sort(pData(ref.sce)$pct_dropout) + ref.means <- sort(rowData(ref.sce)$MeanLogCPM) + ref.vars <- sort(rowData(ref.sce)$VarLogCPM) + ref.libs <- sort(colData(ref.sce)$total_counts) + ref.z.gene <- sort(rowData(ref.sce)$pct_dropout_counts) + ref.z.cell <- sort(colData(ref.sce)$PctZero) - ref.rank.ord <- order(fData(ref.sce)$exprs_rank) - ref.vars.rank <- fData(ref.sce)$VarLogCPM[ref.rank.ord] - ref.z.gene.rank <- fData(ref.sce)$pct_dropout[ref.rank.ord] + ref.rank.ord <- order(rowData(ref.sce)$rank_counts) + ref.vars.rank <- rowData(ref.sce)$VarLogCPM[ref.rank.ord] + ref.z.gene.rank <- rowData(ref.sce)$pct_dropout_counts[ref.rank.ord] for (name in names(sces)) { sce <- sces[[name]] - fData(sce)$RefRankMeanLogCPM <- ref.means[rank(fData(sce)$MeanLogCPM)] - fData(sce)$RankDiffMeanLogCPM <- fData(sce)$MeanLogCPM - - fData(sce)$RefRankMeanLogCPM - fData(sce)$RefRankVarLogCPM <- ref.vars[rank(fData(sce)$VarLogCPM)] - fData(sce)$RankDiffVarLogCPM <- fData(sce)$VarLogCPM - - fData(sce)$RefRankVarLogCPM - pData(sce)$RefRankLibSize <- ref.libs[rank(pData(sce)$total_counts)] - pData(sce)$RankDiffLibSize <- pData(sce)$total_counts - - pData(sce)$RefRankLibSize - fData(sce)$RefRankZeros <- ref.z.gene[rank(fData(sce)$pct_dropout)] - fData(sce)$RankDiffZeros <- fData(sce)$pct_dropout - - fData(sce)$RefRankZeros - pData(sce)$RefRankZeros <- ref.z.cell[rank(pData(sce)$pct_dropout)] - pData(sce)$RankDiffZeros <- pData(sce)$pct_dropout - - pData(sce)$RefRankZeros - - fData(sce)$MeanRankVarDiff <- fData(sce)$VarLogCPM - - ref.vars.rank[fData(sce)$exprs_rank] - fData(sce)$MeanRankZerosDiff <- fData(sce)$pct_dropout - - ref.z.gene.rank[fData(sce)$exprs_rank] + rowData(sce)$RefRankMeanLogCPM <- ref.means[ + rank(rowData(sce)$MeanLogCPM)] + rowData(sce)$RankDiffMeanLogCPM <- rowData(sce)$MeanLogCPM - + rowData(sce)$RefRankMeanLogCPM + rowData(sce)$RefRankVarLogCPM <- ref.vars[rank(rowData(sce)$VarLogCPM)] + rowData(sce)$RankDiffVarLogCPM <- rowData(sce)$VarLogCPM - + rowData(sce)$RefRankVarLogCPM + colData(sce)$RefRankLibSize <- ref.libs[rank(colData(sce)$total_counts)] + colData(sce)$RankDiffLibSize <- colData(sce)$total_counts - + colData(sce)$RefRankLibSize + rowData(sce)$RefRankZeros <- ref.z.gene[rank( + rowData(sce)$pct_dropout_counts)] + rowData(sce)$RankDiffZeros <- rowData(sce)$pct_dropout_counts - + rowData(sce)$RefRankZeros + colData(sce)$RefRankZeros <- ref.z.cell[rank( + colData(sce)$PctZero)] + colData(sce)$RankDiffZeros <- colData(sce)$PctZero - + colData(sce)$RefRankZeros + + rowData(sce)$MeanRankVarDiff <- rowData(sce)$VarLogCPM - + ref.vars.rank[rowData(sce)$rank_counts] + rowData(sce)$MeanRankZerosDiff <- rowData(sce)$pct_dropout_counts - + ref.z.gene.rank[rowData(sce)$rank_counts] sces[[name]] <- sce } @@ -340,21 +353,23 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ref.sce <- sces[[ref]] sces[[ref]] <- NULL - fData.all <- fData(sces[[1]]) - pData.all <- pData(sces[[1]]) + features <- rowData(sces[[1]]) + cells <- colData(sces[[1]]) if (length(sces) > 1) { for (name in names(sces)[-1]) { sce <- sces[[name]] - fData.all <- rbindMatched(fData.all, fData(sce)) - pData.all <- rbindMatched(pData.all, pData(sce)) + features <- rbindMatched(features, rowData(sce)) + cells <- rbindMatched(cells, colData(sce)) } } - fData.all$Dataset <- factor(fData.all$Dataset, levels = names(sces)) - pData.all$Dataset <- factor(pData.all$Dataset, levels = names(sces)) + features$Dataset <- factor(features$Dataset, levels = names(sces)) + cells$Dataset <- factor(cells$Dataset, levels = names(sces)) + features <- data.frame(features) + cells <- data.frame(cells) - means <- ggplot(fData.all, + means <- ggplot(features, aes_string(x = "Dataset", y = "RankDiffMeanLogCPM", colour = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + @@ -364,7 +379,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in mean expression") + theme_minimal() - vars <- ggplot(fData.all, + vars <- ggplot(features, aes_string(x = "Dataset", y = "RankDiffVarLogCPM", colour = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + @@ -375,8 +390,8 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in variance") + theme_minimal() - mean.var <- ggplot(fData.all, - aes_string(x = "exprs_rank", y = "MeanRankVarDiff", + mean.var <- ggplot(features, + aes_string(x = "rank_counts", y = "MeanRankVarDiff", colour = "Dataset", fill = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + geom_point(size = point.size, alpha = point.alpha) + @@ -388,7 +403,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in mean-variance relationship") + theme_minimal() - libs <- ggplot(pData.all, + libs <- ggplot(cells, aes_string(x = "Dataset", y = "RankDiffLibSize", colour = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + @@ -398,7 +413,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in library sizes") + theme_minimal() - z.gene <- ggplot(fData.all, + z.gene <- ggplot(features, aes_string(x = "Dataset", y = "RankDiffZeros", colour = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + @@ -408,7 +423,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in zeros per gene") + theme_minimal() - z.cell <- ggplot(pData.all, + z.cell <- ggplot(cells, aes_string(x = "Dataset", y = "RankDiffZeros", colour = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + @@ -418,8 +433,8 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in zeros per cell") + theme_minimal() - mean.zeros <- ggplot(fData.all, - aes_string(x = "exprs_rank", y = "MeanRankZerosDiff", + mean.zeros <- ggplot(features, + aes_string(x = "rank_counts", y = "MeanRankZerosDiff", colour = "Dataset", fill = "Dataset")) + geom_hline(yintercept = 0, colour = "red") + geom_point(size = point.size, alpha = point.alpha) + @@ -430,7 +445,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Difference in mean-zeros relationship") + theme_minimal() - means.qq <- ggplot(fData.all, + means.qq <- ggplot(features, aes_string(x = "RefRankMeanLogCPM", y = "MeanLogCPM", colour = "Dataset")) + geom_abline(intercept = 0, slope = 1, colour = "red") + @@ -441,7 +456,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Ranked means") + theme_minimal() - vars.qq <- ggplot(fData.all, + vars.qq <- ggplot(features, aes_string(x = "RefRankVarLogCPM", y = "VarLogCPM", colour = "Dataset")) + geom_abline(intercept = 0, slope = 1, colour = "red") + @@ -452,7 +467,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Ranked variances") + theme_minimal() - libs.qq <- ggplot(pData.all, + libs.qq <- ggplot(cells, aes_string(x = "RefRankLibSize", y = "total_counts", colour = "Dataset")) + geom_abline(intercept = 0, slope = 1, colour = "red") + @@ -463,8 +478,8 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Ranked library sizes") + theme_minimal() - z.gene.qq <- ggplot(fData.all, - aes_string(x = "RefRankZeros", y = "pct_dropout", + z.gene.qq <- ggplot(features, + aes_string(x = "RefRankZeros", y = "pct_dropout_counts", colour = "Dataset")) + geom_abline(intercept = 0, slope = 1, colour = "red") + geom_point(size = point.size, alpha = point.alpha) + @@ -474,8 +489,8 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ggtitle("Ranked percentage zeros per gene") + theme_minimal() - z.cell.qq <- ggplot(pData.all, - aes_string(x = "RefRankZeros", y = "pct_dropout", + z.cell.qq <- ggplot(cells, + aes_string(x = "RefRankZeros", y = "PctZero", colour = "Dataset")) + geom_abline(intercept = 0, slope = 1, colour = "red") + geom_point(size = point.size, alpha = point.alpha) + @@ -491,8 +506,8 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, } comparison <- list(Reference = ref.sce, - FeatureData = fData.all, - PhenoData = pData.all, + FeatureData = features, + PhenoData = cells, Plots = list(Means = means, Variances = vars, MeanVar = mean.var, @@ -511,9 +526,9 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, #' Make comparison panel #' -#' Combine the plots from \code{compareSCESets} into a single panel. +#' Combine the plots from \code{compareSCEs} into a single panel. #' -#' @param comp list returned by \code{\link{compareSCESets}}. +#' @param comp list returned by \code{\link{compareSCEs}}. #' @param title title for the panel. #' @param labels vector of labels for each of the seven plots. #' @@ -523,7 +538,7 @@ diffSCESets <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, #' \dontrun{ #' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) #' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -#' comparison <- compareSCESets(list(Splat = sim1, Simple = sim2)) +#' comparison <- compareSCEs(list(Splat = sim1, Simple = sim2)) #' panel <- makeCompPanel(comparison) #' } #' @@ -595,9 +610,9 @@ makeCompPanel <- function(comp, title = "Comparison", #' Make difference panel #' -#' Combine the plots from \code{diffSCESets} into a single panel. +#' Combine the plots from \code{diffSCEs} into a single panel. #' -#' @param diff list returned by \code{\link{diffSCESets}}. +#' @param diff list returned by \code{\link{diffSCEs}}. #' @param title title for the panel. #' @param labels vector of labels for each of the seven sections. #' @@ -607,7 +622,7 @@ makeCompPanel <- function(comp, title = "Comparison", #' \dontrun{ #' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) #' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -#' difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") +#' difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple") #' panel <- makeDiffPanel(difference) #' } #' @@ -685,11 +700,11 @@ makeDiffPanel <- function(diff, title = "Difference comparison", #' Make overall panel #' -#' Combine the plots from \code{compSCESets} and \code{diffSCESets} into a +#' Combine the plots from \code{compSCEs} and \code{diffSCEs} into a #' single panel. #' -#' @param comp list returned by \code{\link{compareSCESets}}. -#' @param diff list returned by \code{\link{diffSCESets}}. +#' @param comp list returned by \code{\link{compareSCEs}}. +#' @param diff list returned by \code{\link{diffSCEs}}. #' @param title title for the panel. #' @param row.labels vector of labels for each of the seven rows. #' @@ -788,19 +803,19 @@ makeOverallPanel <- function(comp, diff, title = "Overall comparison", return(panel) } -#' Summarise diffSCESets +#' Summarise diffSCESs #' -#' Summarise the results of \code{\link{diffSCESets}}. Calculates the Median +#' Summarise the results of \code{\link{diffSCEs}}. Calculates the Median #' Absolute Deviation (MAD), Mean Absolute Error (MAE) and Root Mean Squared #' Error (RMSE) for the various properties and ranks them. #' -#' @param diff Output from \code{\link{diffSCESets}} +#' @param diff Output from \code{\link{diffSCEs}} #' #' @return data.frame with MADs, MAEs, RMSEs, scaled statistics and ranks #' @examples #' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) #' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -#' difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") +#' difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple") #' summary <- summariseDiff(difference) #' head(summary) #' @export diff --git a/man/addFeatureStats.Rd b/man/addFeatureStats.Rd index f4f72ef..4edd20d 100644 --- a/man/addFeatureStats.Rd +++ b/man/addFeatureStats.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SCESet-functions.R +% Please edit documentation in R/SCE-functions.R \name{addFeatureStats} \alias{addFeatureStats} \title{Add feature statistics} @@ -8,11 +8,11 @@ addFeatureStats(sce, value = c("counts", "cpm", "tpm", "fpkm"), log = FALSE, offset = 1, no.zeros = FALSE) } \arguments{ -\item{sce}{SCESet to add feature statistics to.} +\item{sce}{SingleCellExperiment to add feature statistics to.} \item{value}{the expression value to calculate statistics for. Options are "counts", "cpm", "tpm" or "fpkm". The values need to exist in the -given SCESet.} +given SingleCellExperiment.} \item{log}{logical. Whether to take log2 before calculating statistics.} @@ -22,16 +22,16 @@ given SCESet.} calculating statistics.} } \value{ -SCESet with additional feature statistics +SingleCellExperiment with additional feature statistics } \description{ -Add additional feature statistics to an SCESet object +Add additional feature statistics to a SingleCellExperiment object } \details{ Currently adds the following statistics: mean, variance, coefficient of variation, median and median absolute deviation. Statistics are added to -the \code{fData} slot and are named \code{Stat[Log]Value[No0]} where -\code{Log} and \code{No0} are added if those arguments are true. -UpperCamelCase is used to differentiate these columns from those added by -\code{scater}. +the \code{\link[SummarizedExperiment]{rowData}} slot and are named +\code{Stat[Log]Value[No0]} where \code{Log} and \code{No0} are added if those +arguments are true. UpperCamelCase is used to differentiate these columns +from those added by analysis packages. } diff --git a/man/addGeneLengths.Rd b/man/addGeneLengths.Rd index dd760ad..3cfbc60 100644 --- a/man/addGeneLengths.Rd +++ b/man/addGeneLengths.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/SCESet-functions.R +% Please edit documentation in R/SCE-functions.R \name{addGeneLengths} \alias{addGeneLengths} \title{Add gene lengths} @@ -8,7 +8,7 @@ addGeneLengths(sce, method = c("generate", "sample"), loc = 7.9, scale = 0.7, lengths = NULL) } \arguments{ -\item{sce}{SCESet to add gene lengths to.} +\item{sce}{SingleCellExperiment to add gene lengths to.} \item{method}{Method to use for creating lengths.} @@ -19,25 +19,27 @@ addGeneLengths(sce, method = c("generate", "sample"), loc = 7.9, \item{lengths}{Vector of lengths for the sample method.} } \value{ -SCESet with added gene lengths +SingleCellExperiment with added gene lengths } \description{ -Add gene lengths to an SCESet object +Add gene lengths to an SingleCellExperiment object } \details{ -This function adds simulated gene lengths to the \code{fData} slot of an -\code{SCESet} object that can be used for calculating length normalised -expression values such as TPM or FPKM. The \code{generate} simulates lengths -using a (rounded) log-normal distribution, with the default \code{loc} and -\code{scale} parameters based on human coding genes. Alternatively the -\code{sample} method can be used which randomly samples lengths (with -replacement) from a supplied vector. +This function adds simulated gene lengths to the +\code{\link[SummarizedExperiment]{rowData}} slot of a +\code{\link[SingleCellExperiment]{SingleCellExperiment}} object that can be +used for calculating length normalised expression values such as TPM or FPKM. +The \code{generate} method simulates lengths using a (rounded) log-normal +distribution, with the default \code{loc} and \code{scale} parameters based +on human protein-coding genes. Alternatively the \code{sample} method can be +used which randomly samples lengths (with replacement) from a supplied +vector. } \examples{ # Default generate method sce <- simpleSimulate() sce <- addGeneLengths(sce) -head(fData(sce)) +head(rowData(sce)) # Sample method (human coding genes) \dontrun{ library(TxDb.Hsapiens.UCSC.hg19.knownGene) diff --git a/man/compareSCESets.Rd b/man/compareSCEs.Rd similarity index 80% rename from man/compareSCESets.Rd rename to man/compareSCEs.Rd index 4c4393c..711a2be 100644 --- a/man/compareSCESets.Rd +++ b/man/compareSCEs.Rd @@ -1,14 +1,15 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/compare.R -\name{compareSCESets} -\alias{compareSCESets} -\title{Compare SCESet objects} +\name{compareSCEs} +\alias{compareSCEs} +\title{Compare SingleCellExperiment objects} \usage{ -compareSCESets(sces, point.size = 0.1, point.alpha = 0.1, fits = TRUE, +compareSCEs(sces, point.size = 0.1, point.alpha = 0.1, fits = TRUE, colours = NULL) } \arguments{ -\item{sces}{named list of SCESet objects to combine and compare.} +\item{sces}{named list of SingleCellExperiment objects to combine and +compare.} \item{point.size}{size of points in scatter plots.} @@ -22,16 +23,17 @@ compareSCESets(sces, point.size = 0.1, point.alpha = 0.1, fits = TRUE, List containing the combined datasets and plots. } \description{ -Combine the data from several SCESet objects and produce some basic plots -comparing them. +Combine the data from several SingleCellExperiment objects and produce some +basic plots comparing them. } \details{ The returned list has three items: \describe{ \item{\code{FeatureData}}{Combined feature data from the provided - SCESets.} - \item{\code{PhenoData}}{Combined pheno data from the provided SCESets.} + SingleCellExperiments.} + \item{\code{PhenoData}}{Combined pheno data from the provided + SingleCellExperiments.} \item{\code{Plots}}{Comparison plots \describe{ \item{\code{Means}}{Boxplot of mean distribution.} @@ -59,7 +61,7 @@ using \code{\link[ggplot2]{ggplot}}. \examples{ sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -comparison <- compareSCESets(list(Splat = sim1, Simple = sim2)) +comparison <- compareSCEs(list(Splat = sim1, Simple = sim2)) names(comparison) names(comparison$Plots) } diff --git a/man/diffSCESets.Rd b/man/diffSCEs.Rd similarity index 71% rename from man/diffSCESets.Rd rename to man/diffSCEs.Rd index 7b459ca..a24a5c2 100644 --- a/man/diffSCESets.Rd +++ b/man/diffSCEs.Rd @@ -1,16 +1,18 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/compare.R -\name{diffSCESets} -\alias{diffSCESets} -\title{Diff SCESet objects} +\name{diffSCEs} +\alias{diffSCEs} +\title{Diff SingleCellExperiment objects} \usage{ -diffSCESets(sces, ref, point.size = 0.1, point.alpha = 0.1, fits = TRUE, +diffSCEs(sces, ref, point.size = 0.1, point.alpha = 0.1, fits = TRUE, colours = NULL) } \arguments{ -\item{sces}{named list of SCESet objects to combine and compare.} +\item{sces}{named list of SingleCellExperiment objects to combine and +compare.} -\item{ref}{string giving the name of the SCESet to use as the reference} +\item{ref}{string giving the name of the SingleCellExperiment to use as the +reference} \item{point.size}{size of points in scatter plots.} @@ -24,23 +26,25 @@ diffSCESets(sces, ref, point.size = 0.1, point.alpha = 0.1, fits = TRUE, List containing the combined datasets and plots. } \description{ -Combine the data from several SCESet objects and produce some basic plots -comparing them to a reference. +Combine the data from several SingleCellExperiment objects and produce some +basic plots comparing them to a reference. } \details{ -This function aims to look at the differences between a reference SCESet and -one or more others. It requires each SCESet to have the same dimensions. -Properties are compared by ranks, for example when comparing the means the -values are ordered and the differences between the reference and another -dataset plotted. A series of Q-Q plots are also returned. +This function aims to look at the differences between a reference +SingleCellExperiment and one or more others. It requires each +SingleCellExperiment to have the same dimensions. Properties are compared by +ranks, for example when comparing the means the values are ordered and the +differences between the reference and another dataset plotted. A series of +Q-Q plots are also returned. The returned list has five items: \describe{ - \item{\code{Reference}}{The SCESet used as the reference.} + \item{\code{Reference}}{The SingleCellExperiment used as the reference.} \item{\code{FeatureData}}{Combined feature data from the provided - SCESets.} - \item{\code{PhenoData}}{Combined pheno data from the provided SCESets.} + SingleCellExperiments.} + \item{\code{PhenoData}}{Combined pheno data from the provided + SingleCellExperiments.} \item{\code{Plots}}{Difference plots \describe{ \item{\code{Means}}{Boxplot of mean differences.} @@ -79,7 +83,7 @@ using \code{\link[ggplot2]{ggplot}}. \examples{ sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") +difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple") names(difference) names(difference$Plots) } diff --git a/man/makeCompPanel.Rd b/man/makeCompPanel.Rd index 7340fa2..c91b324 100644 --- a/man/makeCompPanel.Rd +++ b/man/makeCompPanel.Rd @@ -9,7 +9,7 @@ makeCompPanel(comp, title = "Comparison", labels = c("Means", "Variance", "Zeros per cell", "Mean-zeros relationship")) } \arguments{ -\item{comp}{list returned by \code{\link{compareSCESets}}.} +\item{comp}{list returned by \code{\link{compareSCEs}}.} \item{title}{title for the panel.} @@ -19,13 +19,13 @@ makeCompPanel(comp, title = "Comparison", labels = c("Means", "Variance", Combined panel plot } \description{ -Combine the plots from \code{compareSCESets} into a single panel. +Combine the plots from \code{compareSCEs} into a single panel. } \examples{ \dontrun{ sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -comparison <- compareSCESets(list(Splat = sim1, Simple = sim2)) +comparison <- compareSCEs(list(Splat = sim1, Simple = sim2)) panel <- makeCompPanel(comparison) } diff --git a/man/makeDiffPanel.Rd b/man/makeDiffPanel.Rd index 0712f36..a0239a8 100644 --- a/man/makeDiffPanel.Rd +++ b/man/makeDiffPanel.Rd @@ -9,7 +9,7 @@ makeDiffPanel(diff, title = "Difference comparison", labels = c("Means", "Mean-variance relationship", "Mean-zeros relationship")) } \arguments{ -\item{diff}{list returned by \code{\link{diffSCESets}}.} +\item{diff}{list returned by \code{\link{diffSCEs}}.} \item{title}{title for the panel.} @@ -19,13 +19,13 @@ makeDiffPanel(diff, title = "Difference comparison", labels = c("Means", Combined panel plot } \description{ -Combine the plots from \code{diffSCESets} into a single panel. +Combine the plots from \code{diffSCEs} into a single panel. } \examples{ \dontrun{ sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") +difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple") panel <- makeDiffPanel(difference) } diff --git a/man/makeOverallPanel.Rd b/man/makeOverallPanel.Rd index a37119d..51b219b 100644 --- a/man/makeOverallPanel.Rd +++ b/man/makeOverallPanel.Rd @@ -10,9 +10,9 @@ makeOverallPanel(comp, diff, title = "Overall comparison", "Mean-zeros relationship")) } \arguments{ -\item{comp}{list returned by \code{\link{compareSCESets}}.} +\item{comp}{list returned by \code{\link{compareSCEs}}.} -\item{diff}{list returned by \code{\link{diffSCESets}}.} +\item{diff}{list returned by \code{\link{diffSCEs}}.} \item{title}{title for the panel.} @@ -22,7 +22,7 @@ makeOverallPanel(comp, diff, title = "Overall comparison", Combined panel plot } \description{ -Combine the plots from \code{compSCESets} and \code{diffSCESets} into a +Combine the plots from \code{compSCEs} and \code{diffSCEs} into a single panel. } \examples{ diff --git a/man/summariseDiff.Rd b/man/summariseDiff.Rd index cd6cb62..10b3b06 100644 --- a/man/summariseDiff.Rd +++ b/man/summariseDiff.Rd @@ -2,25 +2,25 @@ % Please edit documentation in R/compare.R \name{summariseDiff} \alias{summariseDiff} -\title{Summarise diffSCESets} +\title{Summarise diffSCESs} \usage{ summariseDiff(diff) } \arguments{ -\item{diff}{Output from \code{\link{diffSCESets}}} +\item{diff}{Output from \code{\link{diffSCEs}}} } \value{ data.frame with MADs, MAEs, RMSEs, scaled statistics and ranks } \description{ -Summarise the results of \code{\link{diffSCESets}}. Calculates the Median +Summarise the results of \code{\link{diffSCEs}}. Calculates the Median Absolute Deviation (MAD), Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE) for the various properties and ranks them. } \examples{ sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) -difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") +difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple") summary <- summariseDiff(difference) head(summary) } -- GitLab