From 94be54a8a80bd7c0dc2c80a7de6caba0896c9ef3 Mon Sep 17 00:00:00 2001 From: Luke Zappia <luke.zappia@mcri.edu.au> Date: Thu, 20 Jul 2017 04:13:33 +0000 Subject: [PATCH] Merge branch 'master' into devel * master: Change mean-dropout to mean-zeros Add verbose to scDDEstimate From: Luke Zappia <lazappi@users.noreply.github.com> git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/splatter@131415 bc3139a8-67e5-0310-9ffc-ced21a209358 --- DESCRIPTION | 4 ++-- NEWS.md | 5 +++++ R/compare.R | 4 ++-- R/scDD-estimate.R | 28 +++++++++++++++++++++------- man/compareSCESets.Rd | 2 +- man/scDDEstimate.Rd | 8 +++++--- 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 594612b..c3b526b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: splatter Type: Package Title: Simple Simulation of Single-cell RNA Sequencing Data -Version: 1.1.2 -Date: 2017-07-16 +Version: 1.1.3 +Date: 2017-07-20 Author: Luke Zappia Authors@R: c(person("Luke", "Zappia", role = c("aut", "cre"), diff --git a/NEWS.md b/NEWS.md index 3ced178..36c1579 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# 1.1.3 + +* Add verbose option to scDDEstimate +* Change "mean-dropout" to "mean-zeros" in compareSCESets + # 1.1.2 * Update summariseDiff diff --git a/R/compare.R b/R/compare.R index ffee65d..45af803 100644 --- a/R/compare.R +++ b/R/compare.R @@ -29,7 +29,7 @@ #' \item{\code{ZerosCell}}{Boxplot of the percentage of each cell #' that is zero.} #' \item{\code{MeanZeros}}{Scatter plot with fitted lines showing -#' the mean-dropout relationship.} +#' the mean-zeros relationship.} #' } #' } #' } @@ -164,7 +164,7 @@ compareSCESets <- function(sces, point.size = 0.1, point.alpha = 0.1, scale_fill_manual(values = colours) + xlab("Mean count") + ylab("Percentage zeros") + - ggtitle("Mean-dropout relationship") + + ggtitle("Mean-zeros relationship") + theme_minimal() if (fits) { diff --git a/R/scDD-estimate.R b/R/scDD-estimate.R index 542d3af..f1aba9c 100644 --- a/R/scDD-estimate.R +++ b/R/scDD-estimate.R @@ -7,6 +7,7 @@ #' @param conditions Vector giving the condition that each cell belongs to. #' Conditions can be 1 or 2. #' @param params SCDDParams object to store estimated values in. +#' @param verbose logical. Whether to show progress messages. #' @param BPPARAM A \code{\link[BiocParallel]{BiocParallelParam}} instance #' giving the parallel back-end to be used. Default is #' \code{\link[BiocParallel]{SerialParam}} which uses a single core. @@ -29,23 +30,23 @@ #' @importFrom BiocParallel SerialParam #' @export scDDEstimate <- function(counts, conditions, params = newSCDDParams(), - BPPARAM = SerialParam()) { + verbose = TRUE, BPPARAM = SerialParam()) { UseMethod("scDDEstimate") } #' @rdname scDDEstimate #' @export scDDEstimate.SCESet <- function(counts, conditions, params = newSCDDParams(), - BPPARAM = SerialParam()) { + verbose = TRUE, BPPARAM = SerialParam()) { counts <- scater::counts(counts) - scDDEstimate(counts, conditions, params) + scDDEstimate(counts, conditions, params, verbose, BPPARAM) } #' @rdname scDDEstimate #' @importFrom methods as #' @export scDDEstimate.matrix <- function(counts, conditions, params = newSCDDParams(), - BPPARAM = SerialParam()) { + verbose = TRUE, BPPARAM = SerialParam()) { if (!requireNamespace("scDD", quietly = TRUE)) { stop("The scDD simulation requires the 'scDD' package.") @@ -61,8 +62,15 @@ scDDEstimate.matrix <- function(counts, conditions, params = newSCDDParams(), counts.list <- list(Cond1 = counts[, conditions == 1], Cond2 = counts[, conditions == 2]) - processed <- scDD::preprocess(counts.list, c("Cond1", "Cond2"), - median_norm = TRUE) + if (verbose) { + processed <- scDD::preprocess(counts.list, c("Cond1", "Cond2"), + median_norm = TRUE) + } else { + suppressMessages( + processed <- scDD::preprocess(counts.list, c("Cond1", "Cond2"), + median_norm = TRUE) + ) + } assays <- S4Vectors::SimpleList(NormCounts = processed) @@ -72,7 +80,13 @@ scDDEstimate.matrix <- function(counts, conditions, params = newSCDDParams(), SCdat <- SummarizedExperiment::SummarizedExperiment(assays = assays, colData = colData) - SCdat <- scDD::scDD(SCdat, testZeroes = FALSE, param = BPPARAM) + if (verbose) { + SCdat <- scDD::scDD(SCdat, testZeroes = FALSE, param = BPPARAM) + } else { + dummy <- utils::capture.output(suppressMessages( + SCdat <- scDD::scDD(SCdat, testZeroes = FALSE, param = BPPARAM) + )) + } res <- scDD::results(SCdat) res <- res[!is.na(res$DDcategory), ] diff --git a/man/compareSCESets.Rd b/man/compareSCESets.Rd index 126acbc..4c4393c 100644 --- a/man/compareSCESets.Rd +++ b/man/compareSCESets.Rd @@ -45,7 +45,7 @@ The returned list has three items: \item{\code{ZerosCell}}{Boxplot of the percentage of each cell that is zero.} \item{\code{MeanZeros}}{Scatter plot with fitted lines showing - the mean-dropout relationship.} + the mean-zeros relationship.} } } } diff --git a/man/scDDEstimate.Rd b/man/scDDEstimate.Rd index 259a698..44bd401 100644 --- a/man/scDDEstimate.Rd +++ b/man/scDDEstimate.Rd @@ -6,14 +6,14 @@ \alias{scDDEstimate.matrix} \title{Estimate scDD simulation parameters} \usage{ -scDDEstimate(counts, conditions, params = newSCDDParams(), +scDDEstimate(counts, conditions, params = newSCDDParams(), verbose = TRUE, BPPARAM = SerialParam()) \method{scDDEstimate}{SCESet}(counts, conditions, params = newSCDDParams(), - BPPARAM = SerialParam()) + verbose = TRUE, BPPARAM = SerialParam()) \method{scDDEstimate}{matrix}(counts, conditions, params = newSCDDParams(), - BPPARAM = SerialParam()) + verbose = TRUE, BPPARAM = SerialParam()) } \arguments{ \item{counts}{either a counts matrix or an SCESet object containing count @@ -24,6 +24,8 @@ Conditions can be 1 or 2.} \item{params}{SCDDParams object to store estimated values in.} +\item{verbose}{logical. Whether to show progress messages.} + \item{BPPARAM}{A \code{\link[BiocParallel]{BiocParallelParam}} instance giving the parallel back-end to be used. Default is \code{\link[BiocParallel]{SerialParam}} which uses a single core.} -- GitLab