Skip to content
Snippets Groups Projects
Commit d0229362 authored by Luke Zappia's avatar Luke Zappia
Browse files

Merge branch 'master' into ci

* master: (45 commits)
  Bump bioc devel version
  Bump bioc release version
  bump x.y.z versions to odd y after creation of RELEASE_3_7 branch
  bump x.y.z versions to even y prior to creation of RELEASE_3_7 branch
  Fix logo in README
  Set seed in sparseDCEstimate tests and bump ver
  Bump version to 1.3.5
  Bump version number
  Add SparseDC tests
  Run checks
  Add SparseDC to listSims
  Add sparseDCEstimate
  Add sparseDCSimulate
  Add SparseDCParams
  Rename params metadata to Params for consistency
  Reset path.from if nGroups changes in SplatParams
  Colourise listSims
  Colourise Params print output
  Improve printing of data.frame parameters
  Improve mean fitting warning in splatEstMean
  ...
parents 86901797 cd54e3e1
No related branches found
No related tags found
No related merge requests found
Package: splatter Package: splatter
Type: Package Type: Package
Title: Simple Simulation of Single-cell RNA Sequencing Data Title: Simple Simulation of Single-cell RNA Sequencing Data
Version: 1.3.1 Version: 1.5.0
Date: 2018-01-03 Date: 2018-05-02
Author: Luke Zappia Author: Luke Zappia
Authors@R: Authors@R:
c(person("Luke", "Zappia", role = c("aut", "cre"), c(person("Luke", "Zappia", role = c("aut", "cre"),
email = "luke.zappia@mcri.edu.au"), email = "luke.zappia@mcri.edu.au",
comment = c(ORCID = "0000-0001-7744-8565")),
person("Belinda", "Phipson", role = c("aut"), person("Belinda", "Phipson", role = c("aut"),
email = "belinda.phipson@mcri.edu.au"), email = "belinda.phipson@mcri.edu.au",
comment = c(ORCID = "0000-0002-1711-7454")),
person("Alicia", "Oshlack", role = c("aut"), person("Alicia", "Oshlack", role = c("aut"),
email = "alicia.oshlack@mcri.edu.au")) email = "alicia.oshlack@mcri.edu.au",
comment = c(ORCID = "0000-0001-9788-5690")))
Maintainer: Luke Zappia <luke.zappia@mcri.edu.au> Maintainer: Luke Zappia <luke.zappia@mcri.edu.au>
Description: Splatter is a package for the simulation of single-cell RNA Description: Splatter is a package for the simulation of single-cell RNA
sequencing count data. It provides a simple interface for creating complex sequencing count data. It provides a simple interface for creating complex
...@@ -21,7 +24,6 @@ License: GPL-3 + file LICENSE ...@@ -21,7 +24,6 @@ License: GPL-3 + file LICENSE
LazyData: TRUE LazyData: TRUE
Depends: Depends:
R (>= 3.4), R (>= 3.4),
scater,
SingleCellExperiment SingleCellExperiment
Imports: Imports:
akima, akima,
...@@ -35,9 +37,11 @@ Imports: ...@@ -35,9 +37,11 @@ Imports:
matrixStats, matrixStats,
methods, methods,
scales, scales,
scater (>= 1.7.4),
stats, stats,
SummarizedExperiment, SummarizedExperiment,
utils utils,
crayon
Suggests: Suggests:
BiocStyle, BiocStyle,
covr, covr,
...@@ -55,7 +59,8 @@ Suggests: ...@@ -55,7 +59,8 @@ Suggests:
mfa, mfa,
phenopath, phenopath,
BASiCS, BASiCS,
zinbwave zinbwave,
SparseDC
biocViews: SingleCell, RNASeq, Transcriptomics, GeneExpression, Sequencing, biocViews: SingleCell, RNASeq, Transcriptomics, GeneExpression, Sequencing,
Software Software
URL: https://github.com/Oshlack/splatter URL: https://github.com/Oshlack/splatter
......
# Generated by roxygen2: do not edit by hand # Generated by roxygen2: do not edit by hand
S3method(BASiCSEstimate,SCESet) S3method(BASiCSEstimate,SingleCellExperiment)
S3method(BASiCSEstimate,matrix) S3method(BASiCSEstimate,matrix)
S3method(lun2Estimate,SingleCellExperiment) S3method(lun2Estimate,SingleCellExperiment)
S3method(lun2Estimate,matrix) S3method(lun2Estimate,matrix)
...@@ -15,6 +15,8 @@ S3method(scDDEstimate,default) ...@@ -15,6 +15,8 @@ S3method(scDDEstimate,default)
S3method(scDDEstimate,matrix) S3method(scDDEstimate,matrix)
S3method(simpleEstimate,SingleCellExperiment) S3method(simpleEstimate,SingleCellExperiment)
S3method(simpleEstimate,matrix) S3method(simpleEstimate,matrix)
S3method(sparseDCEstimate,SingleCellExperiment)
S3method(sparseDCEstimate,matrix)
S3method(splatEstimate,SingleCellExperiment) S3method(splatEstimate,SingleCellExperiment)
S3method(splatEstimate,matrix) S3method(splatEstimate,matrix)
S3method(zinbEstimate,SingleCellExperiment) S3method(zinbEstimate,SingleCellExperiment)
...@@ -43,6 +45,7 @@ export(newMFAParams) ...@@ -43,6 +45,7 @@ export(newMFAParams)
export(newPhenoParams) export(newPhenoParams)
export(newSCDDParams) export(newSCDDParams)
export(newSimpleParams) export(newSimpleParams)
export(newSparseDCParams)
export(newSplatParams) export(newSplatParams)
export(newZINBParams) export(newZINBParams)
export(phenoEstimate) export(phenoEstimate)
...@@ -53,6 +56,8 @@ export(setParam) ...@@ -53,6 +56,8 @@ export(setParam)
export(setParams) export(setParams)
export(simpleEstimate) export(simpleEstimate)
export(simpleSimulate) export(simpleSimulate)
export(sparseDCEstimate)
export(sparseDCSimulate)
export(splatEstimate) export(splatEstimate)
export(splatSimulate) export(splatSimulate)
export(splatSimulateGroups) export(splatSimulateGroups)
...@@ -68,6 +73,7 @@ exportClasses(MFAParams) ...@@ -68,6 +73,7 @@ exportClasses(MFAParams)
exportClasses(PhenoParams) exportClasses(PhenoParams)
exportClasses(SCDDParams) exportClasses(SCDDParams)
exportClasses(SimpleParams) exportClasses(SimpleParams)
exportClasses(SparseDCParams)
exportClasses(SplatParams) exportClasses(SplatParams)
exportClasses(ZINBParams) exportClasses(ZINBParams)
importFrom(BiocParallel,SerialParam) importFrom(BiocParallel,SerialParam)
...@@ -127,4 +133,5 @@ importFrom(stats,rnbinom) ...@@ -127,4 +133,5 @@ importFrom(stats,rnbinom)
importFrom(stats,rnorm) importFrom(stats,rnorm)
importFrom(stats,rpois) importFrom(stats,rpois)
importFrom(stats,runif) importFrom(stats,runif)
importFrom(stats,shapiro.test)
importFrom(utils,head) importFrom(utils,head)
## Version 1.5.0 (2018-01-02)
* Bioconductor 3.7 devel
# Version 1.4.0 (2018-01-02)
* Bioconductor 3.7 release
## Version 1.3.6 (2018-04-30)
* Set seed in sparseDCEstimate tests
## Version 1.3.5 (2018-04-25)
* Replace dropout.present with dropout.type in SplatParams
* Allows users to set dropout by experiment, batch, group or cell
## Version 1.3.4 (2018-04-19)
* Add option to use a normal distribution for library sizes in Splat simulations
* Add SparseDC simulation
* Rename params in metadata slot of simulation to Params for consistency
* Add checks to SplatParams to reset path.from if nGroups changes
* Improve printing of parameters stored as data.frames
* Colourise Params print output and listSims output
* Improve warning message when fitting means in splatEstimate fails
* Simplify problematic documentation links
### Version 1.3.3.9010 (2018-04-12)
* Add option to use a normal distribution for library sizes in Splat simulations
### Version 1.3.3.9000 (2018-04-12)
* Replace dropout.present with dropout.type in SplatParams
* Allows more control over dropout.mid and dropout.shape
## Version 1.3.3 (2018-03-27)
* Fix parameter passing bug in scDDEstimate
## Version 1.3.2 (2018-01-31)
* Fix QC names that have been changed in scater
* Move scater to Imports and add scater version
* Remove lingering references to SCESets
* Add more tests
## Version 1.3.1 (2018-01-03) ## Version 1.3.1 (2018-01-03)
* Fix error in vignette caused by changes in scater * Fix error in vignette caused by changes in scater
## Version 1.3.0 (2017-10-13) ## Version 1.3.0 (2017-10-13)
* Bioconductor 3.7 devel * Bioconductor 3.7 devel
## Version 1.2.2 (2018-03-27)
* Fix parameter passing bug in scDDEstimate
## Version 1.2.1 (2017-11-23) ## Version 1.2.1 (2017-11-23)
......
...@@ -95,9 +95,13 @@ setClass("SimpleParams", ...@@ -95,9 +95,13 @@ setClass("SimpleParams",
#' \item{\emph{Library size parameters}}{ #' \item{\emph{Library size parameters}}{
#' \describe{ #' \describe{
#' \item{\code{lib.loc}}{Location (meanlog) parameter for the #' \item{\code{lib.loc}}{Location (meanlog) parameter for the
#' library size log-normal distribution.} #' library size log-normal distribution, or mean parameter if a
#' normal distribution is used.}
#' \item{\code{lib.scale}}{Scale (sdlog) parameter for the library #' \item{\code{lib.scale}}{Scale (sdlog) parameter for the library
#' size log-normal distribution.} #' size log-normal distribution, or sd parameter if a normal
#' distribution is used.}
#' \item{\code{lib.norm}}{Logical. Whether to use a normal
#' distribution for library sizes instead of a log-normal.}
#' } #' }
#' } #' }
#' \item{\emph{Expression outlier parameters}}{ #' \item{\emph{Expression outlier parameters}}{
...@@ -142,8 +146,12 @@ setClass("SimpleParams", ...@@ -142,8 +146,12 @@ setClass("SimpleParams",
#' } #' }
#' \item{\emph{Dropout parameters}}{ #' \item{\emph{Dropout parameters}}{
#' \describe{ #' \describe{
#' \item{\code{dropout.present}}{Logical. Whether to simulate #' \item{\code{dropout.type}}{The type of dropout to simulate.
#' dropout.} #' "none" indicates no dropout, "experiment" is global dropout using
#' the same parameters for every cell, "batch" uses the same
#' parameters for every cell in each batch, "group" uses the same
#' parameters for every cell in each groups and "cell" uses a
#' different set of parameters for each cell.}
#' \item{\code{dropout.mid}}{Midpoint parameter for the dropout #' \item{\code{dropout.mid}}{Midpoint parameter for the dropout
#' logistic function.} #' logistic function.}
#' \item{\code{dropout.shape}}{Shape parameter for the dropout #' \item{\code{dropout.shape}}{Shape parameter for the dropout
...@@ -197,6 +205,7 @@ setClass("SplatParams", ...@@ -197,6 +205,7 @@ setClass("SplatParams",
mean.rate = "numeric", mean.rate = "numeric",
lib.loc = "numeric", lib.loc = "numeric",
lib.scale = "numeric", lib.scale = "numeric",
lib.norm = "logical",
out.prob = "numeric", out.prob = "numeric",
out.facLoc = "numeric", out.facLoc = "numeric",
out.facScale = "numeric", out.facScale = "numeric",
...@@ -208,7 +217,7 @@ setClass("SplatParams", ...@@ -208,7 +217,7 @@ setClass("SplatParams",
de.facScale = "numeric", de.facScale = "numeric",
bcv.common = "numeric", bcv.common = "numeric",
bcv.df = "numeric", bcv.df = "numeric",
dropout.present = "logical", dropout.type = "character",
dropout.mid = "numeric", dropout.mid = "numeric",
dropout.shape = "numeric", dropout.shape = "numeric",
path.from = "numeric", path.from = "numeric",
...@@ -224,6 +233,7 @@ setClass("SplatParams", ...@@ -224,6 +233,7 @@ setClass("SplatParams",
mean.shape = 0.6, mean.shape = 0.6,
lib.loc = 11, lib.loc = 11,
lib.scale = 0.2, lib.scale = 0.2,
lib.norm = FALSE,
out.prob = 0.05, out.prob = 0.05,
out.facLoc = 4, out.facLoc = 4,
out.facScale = 0.5, out.facScale = 0.5,
...@@ -235,7 +245,7 @@ setClass("SplatParams", ...@@ -235,7 +245,7 @@ setClass("SplatParams",
de.facScale = 0.4, de.facScale = 0.4,
bcv.common = 0.1, bcv.common = 0.1,
bcv.df = 60, bcv.df = 60,
dropout.present = FALSE, dropout.type = "none",
dropout.mid = 0, dropout.mid = 0,
dropout.shape = -1, dropout.shape = -1,
path.from = 0, path.from = 0,
...@@ -657,3 +667,58 @@ setClass("ZINBParams", ...@@ -657,3 +667,58 @@ setClass("ZINBParams",
contains = "Params", contains = "Params",
slots = c(model = "ANY"), slots = c(model = "ANY"),
prototype = prototype(nGenes = 100, nCells = 50)) prototype = prototype(nGenes = 100, nCells = 50))
#' The SparseDCParams class
#'
#' S4 class that holds parameters for the SparseDC simulation.
#'
#' @section Parameters:
#'
#' The SparseDC simulation uses the following parameters:
#'
#' \describe{
#' \item{\code{nGenes}}{The number of genes to simulate in each condition.}
#' \item{\code{nCells}}{The number of cells to simulate.}
#' \item{\code{[seed]}}{Seed to use for generating random numbers.}
#' \item{\code{markers.n}}{Number of marker genes to simulate for each
#' cluster.}
#' \item{\code{markers.shared}}{Number of marker genes for each cluster
#' shared between conditions. Must be less than or equal to
#' \code{markers.n}}.
#' \item{\code{[markers.same]}}{Logical. Whether each cluster should have
#' the same set of marker genes.}
#' \item{\code{clusts.c1}}{Numeric vector of clusters present in
#' condition 1. The number of times a cluster is repeated controls the
#' proportion of cells from that cluster.}
#' \item{\code{clusts.c2}}{Numeric vector of clusters present in
#' condition 2. The number of times a cluster is repeated controls the
#' proportion of cells from that cluster.}
#' \item{\code{[mean.lower]}}{Lower bound for cluster gene means.}
#' \item{\code{[mean.upper]}}{Upper bound for cluster gene means.}
#' }
#'
#' The parameters not shown in brackets can be estimated from real data using
#' \code{\link{sparseDCEstimate}}. For details of the SparseDC simulation
#' see \code{\link{sparseDCSimulate}}.
#'
#' @name SparseDCParams
#' @rdname SparseDCParams
#' @aliases SparseDCParams-class
#' @exportClass SparseDCParams
setClass("SparseDCParams",
contains = "Params",
slots = c(markers.n = "numeric",
markers.shared = "numeric",
markers.same = "logical",
clusts.c1 = "numeric",
clusts.c2 = "numeric",
mean.lower = "numeric",
mean.upper = "numeric"),
prototype = prototype(markers.n = 0,
markers.shared = 0,
markers.same = FALSE,
clusts.c1 = 1,
clusts.c2 = 1,
mean.lower = 1,
mean.upper = 2))
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#' #'
#' Estimate simulation parameters for the BASiCS simulation from a real dataset. #' Estimate simulation parameters for the BASiCS simulation from a real dataset.
#' #'
#' @param counts either a counts matrix or an SCESet object containing count #' @param counts either a counts matrix or a SingleCellExperiment object
#' data to estimate parameters from. #' containing count data to estimate parameters from.
#' @param spike.info data.frame describing spike-ins with two columns: "Name" #' @param spike.info data.frame describing spike-ins with two columns: "Name"
#' giving the names of the spike-in features (must match #' giving the names of the spike-in features (must match
#' \code{rownames(counts)}) and "Input" giving the number of input #' \code{rownames(counts)}) and "Input" giving the number of input
...@@ -31,7 +31,10 @@ ...@@ -31,7 +31,10 @@
#' #'
#' @examples #' @examples
#' \dontrun{ #' \dontrun{
#' # Load example data
#' library(scater)
#' data("sc_example_counts") #' data("sc_example_counts")
#'
#' spike.info <- data.frame(Name = rownames(sc_example_counts)[1:10], #' spike.info <- data.frame(Name = rownames(sc_example_counts)[1:10],
#' Input = rnorm(10, 500, 200), #' Input = rnorm(10, 500, 200),
#' stringsAsFactors = FALSE) #' stringsAsFactors = FALSE)
...@@ -49,10 +52,12 @@ BASiCSEstimate <- function(counts, spike.info = NULL, batch = NULL, ...@@ -49,10 +52,12 @@ BASiCSEstimate <- function(counts, spike.info = NULL, batch = NULL,
#' @rdname BASiCSEstimate #' @rdname BASiCSEstimate
#' @export #' @export
BASiCSEstimate.SCESet <- function(counts, spike.info = NULL, batch = NULL, BASiCSEstimate.SingleCellExperiment <- function(counts, spike.info = NULL,
n = 20000, thin = 10, burn = 5000, batch = NULL, n = 20000,
params = newBASiCSParams(), verbose = TRUE, thin = 10, burn = 5000,
progress = TRUE, ...) { params = newBASiCSParams(),
verbose = TRUE, progress = TRUE,
...) {
counts <- BiocGenerics::counts(counts) counts <- BiocGenerics::counts(counts)
BASiCSEstimate(counts, params) BASiCSEstimate(counts, params)
} }
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#' @details #' @details
#' This function is just a wrapper around \code{\link[BASiCS]{BASiCS_Sim}} that #' This function is just a wrapper around \code{\link[BASiCS]{BASiCS_Sim}} that
#' takes a \code{\link{BASiCSParams}}, runs the simulation then converts the #' takes a \code{\link{BASiCSParams}}, runs the simulation then converts the
#' output to an \code{\link[scater]{SCESet}} object. See #' output to a \code{\link[SingleCellExperiment]{SingleCellExperiment}} object.
#' \code{\link[BASiCS]{BASiCS_Sim}} for more details of how the simulation #' See \code{\link[BASiCS]{BASiCS_Sim}} for more details of how the simulation
#' works. #' works.
#' #'
#' @return SingleCellExperiment containing simulated counts #' @return SingleCellExperiment containing simulated counts
...@@ -131,7 +131,7 @@ BASiCSSimulate <- function(params = newBASiCSParams(), verbose = TRUE, ...) { ...@@ -131,7 +131,7 @@ BASiCSSimulate <- function(params = newBASiCSParams(), verbose = TRUE, ...) {
sim <- SingleCellExperiment(assays = list(counts = counts), sim <- SingleCellExperiment(assays = list(counts = counts),
rowData = features, rowData = features,
colData = cells, colData = cells,
metadata = list(params = params)) metadata = list(Params = params))
if (verbose) {message("Done!")} if (verbose) {message("Done!")}
return(sim) return(sim)
......
...@@ -68,7 +68,7 @@ setValidity("BASiCSParams", function(object) { ...@@ -68,7 +68,7 @@ setValidity("BASiCSParams", function(object) {
}) })
#' @rdname setParam #' @rdname setParam
setMethod("setParam", "BASiCSParams",function(object, name, value) { setMethod("setParam", "BASiCSParams", function(object, name, value) {
checkmate::assertString(name) checkmate::assertString(name)
if (name == "nCells" || name == "nBatches") { if (name == "nCells" || name == "nBatches") {
...@@ -87,7 +87,9 @@ setMethod("setParam", "BASiCSParams",function(object, name, value) { ...@@ -87,7 +87,9 @@ setMethod("setParam", "BASiCSParams",function(object, name, value) {
setMethod("show", "BASiCSParams", function(object) { setMethod("show", "BASiCSParams", function(object) {
pp <- list("Batches:" = c("(Batches)" = "nBatches", pp <- list("Genes:" = c("(Params)" = "gene.params"),
"Cells:" = c("(Params)" = "cell.params"),
"Batches:" = c("(Batches)" = "nBatches",
"(Batch Cells)" = "batchCells"), "(Batch Cells)" = "batchCells"),
"Spike-ins:" = c("(Number)" = "nSpikes", "Spike-ins:" = c("(Number)" = "nSpikes",
"(Means)" = "spike.means"), "(Means)" = "spike.means"),
...@@ -95,20 +97,6 @@ setMethod("show", "BASiCSParams", function(object) { ...@@ -95,20 +97,6 @@ setMethod("show", "BASiCSParams", function(object) {
callNextMethod() callNextMethod()
gene.params <- getParam(object, "gene.params")
cell.params <- getParam(object, "cell.params")
cat("Genes:", "\n")
cat("(Params)", "\n")
cat("data.frame with", dim(gene.params)[1], "features\n")
print(head(gene.params, n = 3))
cat(" ... ...\n\n")
cat("Cells:", "\n")
cat("(Params)", "\n")
cat("data.frame with", dim(cell.params)[1], "features\n")
print(head(cell.params, n = 3))
cat(" ... ...\n\n")
showPP(object, pp) showPP(object, pp)
}) })
......
...@@ -81,7 +81,9 @@ setMethod("setParam", "Lun2Params", function(object, name, value) { ...@@ -81,7 +81,9 @@ setMethod("setParam", "Lun2Params", function(object, name, value) {
setMethod("show", "Lun2Params", function(object) { setMethod("show", "Lun2Params", function(object) {
pp <- list("Plates:" = c("[Number]" = "nPlates", pp <- list("Genes:" = c("(Params)" = "gene.params",
"(ZI Params)" = "zi.params"),
"Plates:" = c("[Number]" = "nPlates",
"[Modifier]" = "plate.mod", "[Modifier]" = "plate.mod",
"(Variance)" = "plate.var"), "(Variance)" = "plate.var"),
"Cells:" = c("[Plates]" = "cell.plates", "Cells:" = c("[Plates]" = "cell.plates",
...@@ -92,17 +94,5 @@ setMethod("show", "Lun2Params", function(object) { ...@@ -92,17 +94,5 @@ setMethod("show", "Lun2Params", function(object) {
callNextMethod() callNextMethod()
gene.params <- getParam(object, "gene.params")
zi.params <- getParam(object, "zi.params")
cat("Genes:", "\n")
cat("(Params)", "\n")
cat("data.frame with", dim(gene.params)[1], "features\n")
print(head(gene.params, n = 3))
cat(" ... ...\n")
cat("(ZI Params)", "\n")
cat("data.frame with", dim(zi.params)[1], "features\n")
print(head(zi.params, n = 3))
cat(" ... ... ...\n\n")
showPP(object, pp) showPP(object, pp)
}) })
...@@ -28,9 +28,10 @@ setMethod("show", "Params", function(object) { ...@@ -28,9 +28,10 @@ setMethod("show", "Params", function(object) {
"(Cells)" = "nCells", "(Cells)" = "nCells",
"[Seed]" = "seed")) "[Seed]" = "seed"))
cat("A Params object of class", class(object), "\n") cat("A", crayon::bold("Params"), "object of class",
cat("Parameters can be (estimable) or [not estimable],", crayon::bold(class(object)), "\n")
"'Default' or 'NOT DEFAULT'.", "\n\n") cat("Parameters can be (estimable) or", crayon::blue("[not estimable],"),
"'Default' or ", crayon::bold(crayon::green("'NOT DEFAULT'")), "\n\n")
showPP(object, pp) showPP(object, pp)
cat(length(slotNames(object)) - 3, "additional parameters", "\n\n") cat(length(slotNames(object)) - 3, "additional parameters", "\n\n")
}) })
...@@ -48,4 +49,4 @@ setMethod("expandParams", "Params", function(object, vectors, n) { ...@@ -48,4 +49,4 @@ setMethod("expandParams", "Params", function(object, vectors, n) {
object <- setParamsUnchecked(object, update) object <- setParamsUnchecked(object, update)
return(object) return(object)
}) })
\ No newline at end of file
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
#' @details #' @details
#' Currently adds the following statistics: mean, variance, coefficient of #' Currently adds the following statistics: mean, variance, coefficient of
#' variation, median and median absolute deviation. Statistics are added to #' variation, median and median absolute deviation. Statistics are added to
#' the \code{\link[SummarizedExperiment]{rowData}} slot and are named #' the \code{\link{rowData}} slot and are named \code{Stat[Log]Value[No0]} where
#' \code{Stat[Log]Value[No0]} where \code{Log} and \code{No0} are added if those #' \code{Log} and \code{No0} are added if those arguments are true.
#' arguments are true. UpperCamelCase is used to differentiate these columns #' UpperCamelCase is used to differentiate these columns from those added by
#' from those added by analysis packages. #' analysis packages.
#' #'
#' @return SingleCellExperiment with additional feature statistics #' @return SingleCellExperiment with additional feature statistics
#' #'
...@@ -88,7 +88,7 @@ addFeatureStats <- function(sce, value = c("counts", "cpm", "tpm", "fpkm"), ...@@ -88,7 +88,7 @@ addFeatureStats <- function(sce, value = c("counts", "cpm", "tpm", "fpkm"),
#' #'
#' @details #' @details
#' This function adds simulated gene lengths to the #' This function adds simulated gene lengths to the
#' \code{\link[SummarizedExperiment]{rowData}} slot of a #' \code{\link{rowData}} slot of a
#' \code{\link[SingleCellExperiment]{SingleCellExperiment}} object that can be #' \code{\link[SingleCellExperiment]{SingleCellExperiment}} object that can be
#' used for calculating length normalised expression values such as TPM or FPKM. #' used for calculating length normalised expression values such as TPM or FPKM.
#' The \code{generate} method simulates lengths using a (rounded) log-normal #' The \code{generate} method simulates lengths using a (rounded) log-normal
......
#' @rdname newParams
#' @importFrom methods new
#' @export
newSparseDCParams <- function(...) {
if (!requireNamespace("SparseDC", quietly = TRUE)) {
stop("The SparseDC simulation requires the 'SparseDC' package.")
}
params <- new("SparseDCParams")
params <- setParams(params, ...)
return(params)
}
setValidity("SparseDCParams", function(object) {
v <- getParams(object, slotNames(object))
checks <- c(nGenes = checkmate::checkInt(v$nGenes, lower = 1),
nCells = checkmate::checkInt(v$nCells, lower = 1),
markers.n = checkmate::checkInt(v$markers.n, lower = 0,
upper = v$nGenes),
markers.shared = checkmate::checkInt(v$markers.shared,
lower = 0,
upper = v$markers.n),
markers.same = checkmate::checkFlag(v$markers.same),
clusts.c1 = checkmate::checkIntegerish(v$clusts.c1, lower = 1,
any.missing = FALSE,
min.len = 1),
clusts.c2 = checkmate::checkIntegerish(v$clusts.c2, lower = 1,
any.missing = FALSE,
min.len = 1),
mean.lower = checkmate::checkNumber(v$mean.lower,
finite = TRUE),
mean.upper = checkmate::checkNumber(v$mean.upper,
finite = TRUE),
seed = checkmate::checkInt(v$seed, lower = 0))
if (length(v$clusts.c1) == 1) {
if (v$clusts.c1 > 1) {
checks <- c(checks,
clusts.c1 = "If clusts.c1 is length 1 it must equal 1")
}
}
if (length(v$clusts.c2) == 1) {
if (v$clusts.c2 > 1) {
checks <- c(checks,
clusts.c2 = "If clusts.c2 is length 1 it must equal 1")
}
}
clusts.combined <- c(v$clusts.c1, v$clusts.c2)
if (!all(seq_len(max(clusts.combined)) %in% clusts.combined)) {
checks <- c(checks, clusts = "Cluster labels must be sequential")
}
if (all(checks == TRUE)) {
valid <- TRUE
} else {
valid <- checks[checks != TRUE]
valid <- paste(names(valid), valid, sep = ": ")
}
return(valid)
})
setMethod("show", "SparseDCParams", function(object) {
pp <- list("Markers:" = c("(Number)" = "markers.n",
"(Shared)" = "markers.shared",
"[Same]" = "markers.same"),
"Clusters:" = c("(Condition 1)" = "clusts.c1",
"(Condition 2)" = "clusts.c2"),
"Means:" = c("[Lower]" = "mean.lower",
"[Upper]" = "mean.upper"))
callNextMethod()
showPP(object, pp)
})
...@@ -30,6 +30,7 @@ setValidity("SplatParams", function(object) { ...@@ -30,6 +30,7 @@ setValidity("SplatParams", function(object) {
mean.shape = checkNumber(v$mean.shape, lower = 0), mean.shape = checkNumber(v$mean.shape, lower = 0),
lib.loc = checkNumber(v$lib.loc), lib.loc = checkNumber(v$lib.loc),
lib.scale = checkNumber(v$lib.scale, lower = 0), lib.scale = checkNumber(v$lib.scale, lower = 0),
lib.norm = checkFlag(v$lib.norm),
out.prob = checkNumber(v$out.prob, lower = 0, upper = 1), out.prob = checkNumber(v$out.prob, lower = 0, upper = 1),
out.facLoc = checkNumber(v$out.facLoc), out.facLoc = checkNumber(v$out.facLoc),
out.facScale = checkNumber(v$out.facScale, lower = 0), out.facScale = checkNumber(v$out.facScale, lower = 0),
...@@ -45,9 +46,12 @@ setValidity("SplatParams", function(object) { ...@@ -45,9 +46,12 @@ setValidity("SplatParams", function(object) {
len = nGroups), len = nGroups),
bcv.common = checkNumber(v$bcv.common, lower = 0), bcv.common = checkNumber(v$bcv.common, lower = 0),
bcv.df = checkNumber(v$bcv.df, lower = 0), bcv.df = checkNumber(v$bcv.df, lower = 0),
dropout.present = checkFlag(v$dropout.present), dropout.type = checkCharacter(v$dropout.type, len = 1,
dropout.mid = checkNumber(v$dropout.mid), any.missing = FALSE),
dropout.shape = checkNumber(v$dropout.shape), dropout.mid = checkNumeric(v$dropout.mid, finite = TRUE,
any.missing = FALSE, min.len = 1),
dropout.shape = checkNumeric(v$dropout.shape, finite = TRUE,
any.missing = FALSE, min.len = 1),
path.from = checkIntegerish(v$path.from, lower = 0, path.from = checkIntegerish(v$path.from, lower = 0,
upper = nGroups, len = nGroups), upper = nGroups, len = nGroups),
path.length = checkIntegerish(v$path.length, lower = 1, path.length = checkIntegerish(v$path.length, lower = 1,
...@@ -74,7 +78,15 @@ setValidity("SplatParams", function(object) { ...@@ -74,7 +78,15 @@ setValidity("SplatParams", function(object) {
if (!(0 %in% v$path.from)) { if (!(0 %in% v$path.from)) {
checks <- c(checks, path.from = "origin must be specified in path.from") checks <- c(checks, path.from = "origin must be specified in path.from")
} else if (any(v$path.from == seq_len(nGroups))) { } else if (any(v$path.from == seq_len(nGroups))) {
checks <- c(checks, stop("path cannot begin at itself")) checks <- c(checks, "path cannot begin at itself")
}
# Check dropout type
if (!(v$dropout.type %in%
c("none", "experiment", "batch", "group", "cell"))) {
checks <- c(checks,
paste("dropout.type must be one of: 'none', 'experiment',",
"'batch', 'group', 'cell'"))
} }
if (all(checks == TRUE)) { if (all(checks == TRUE)) {
...@@ -106,6 +118,50 @@ setMethod("setParam", "SplatParams",function(object, name, value) { ...@@ -106,6 +118,50 @@ setMethod("setParam", "SplatParams",function(object, name, value) {
if (name == "group.prob") { if (name == "group.prob") {
object <- setParamUnchecked(object, "nGroups", length(value)) object <- setParamUnchecked(object, "nGroups", length(value))
path.from <- getParam(object, "path.from")
if (length(path.from) > 1 & length(path.from) != length(value)) {
warning("nGroups has changed, resetting path.from")
object <- setParam(object, "path.from", 0)
}
}
if (name == "dropout.type") {
mid.len <- length(getParam(object, "dropout.mid"))
mid.shape <- length(getParam(object, "dropout.shape"))
if ((value == "experiment")) {
if ((mid.len != 1) | (mid.shape != 1)) {
stop("dropout.type cannot be set to 'experiment' because ",
"dropout.mid and dropout.shape aren't length 1, ",
"set dropout.mid and dropout.shape first")
}
}
if ((value == "batch")) {
n <- getParam(object, "nBatches")
if ((mid.len != n) | (mid.shape != n)) {
stop("dropout.type cannot be set to 'batch' because ",
"dropout.mid and dropout.shape aren't length equal to ",
"nBatches (", n, "), set dropout.mid and dropout.shape ",
"first")
}
}
if ((value == "group")) {
n <- getParam(object, "nGroups")
if ((mid.len != n) | (mid.shape != n)) {
stop("dropout.type cannot be set to 'group' because ",
"dropout.mid and dropout.shape aren't length equal to ",
"nGroups (", n, "), set dropout.mid and dropout.shape ",
"first")
}
}
if ((value == "cell")) {
n <- getParam(object, "nCells")
if ((mid.len != n) | (mid.shape != n)) {
stop("dropout.type cannot be set to 'cell' because ",
"dropout.mid and dropout.shape aren't length equal to ",
"nCells (", n, "), set dropout.mid and dropout.shape ",
"first")
}
}
} }
object <- callNextMethod() object <- callNextMethod()
...@@ -123,7 +179,8 @@ setMethod("show", "SplatParams", function(object) { ...@@ -123,7 +179,8 @@ setMethod("show", "SplatParams", function(object) {
"Mean:" = c("(Rate)" = "mean.rate", "Mean:" = c("(Rate)" = "mean.rate",
"(Shape)" = "mean.shape"), "(Shape)" = "mean.shape"),
"Library size:" = c("(Location)" = "lib.loc", "Library size:" = c("(Location)" = "lib.loc",
"(Scale)" = "lib.scale"), "(Scale)" = "lib.scale",
"(Norm)" = "lib.norm"),
"Exprs outliers:" = c("(Probability)" = "out.prob", "Exprs outliers:" = c("(Probability)" = "out.prob",
"(Location)" = "out.facLoc", "(Location)" = "out.facLoc",
"(Scale)" = "out.facScale"), "(Scale)" = "out.facScale"),
...@@ -135,7 +192,7 @@ setMethod("show", "SplatParams", function(object) { ...@@ -135,7 +192,7 @@ setMethod("show", "SplatParams", function(object) {
"[Scale]" = "de.facScale"), "[Scale]" = "de.facScale"),
"BCV:" = c("(Common Disp)" = "bcv.common", "BCV:" = c("(Common Disp)" = "bcv.common",
"(DoF)" = "bcv.df"), "(DoF)" = "bcv.df"),
"Dropout:" = c("[Present]" = "dropout.present", "Dropout:" = c("[Type]" = "dropout.type",
"(Midpoint)" = "dropout.mid", "(Midpoint)" = "dropout.mid",
"(Shape)" = "dropout.shape"), "(Shape)" = "dropout.shape"),
"Paths:" = c("[From]" = "path.from", "Paths:" = c("[From]" = "path.from",
......
...@@ -90,12 +90,20 @@ setMethod("show", "ZINBParams", function(object) { ...@@ -90,12 +90,20 @@ setMethod("show", "ZINBParams", function(object) {
callNextMethod() callNextMethod()
model <- getParam(object, "model") model <- getParam(object, "model")
cat("Model:", "\n")
cat("ZinbModel with", zinbwave::nFeatures(model), "features,",
zinbwave::nSamples(model), "samples,", zinbwave::nFactors(model),
"latent factors and", zinbwave::nParams(model), "parameters", "\n\n")
default <- zinbwave::zinbModel() default <- zinbwave::zinbModel()
not.default <- !identical(model, default)
cat(crayon::bold("Model:"), "\n")
msg <- paste("ZinbModel with", zinbwave::nFeatures(model), "features,",
zinbwave::nSamples(model), "samples,",
zinbwave::nFactors(model), "latent factors and",
zinbwave::nParams(model), "parameters")
if (not.default) {
msg <- crayon::bold(crayon::green(msg))
}
cat(msg, "\n\n")
cat(crayon::bold("Parameters of the ZinbModel"), "\n\n")
for (category in names(pp)) { for (category in names(pp)) {
parameters <- pp[[category]] parameters <- pp[[category]]
values <- lapply(parameters, function(x) {slot(model, x)}) values <- lapply(parameters, function(x) {slot(model, x)})
...@@ -118,9 +126,8 @@ setMethod("show", "ZINBParams", function(object) { ...@@ -118,9 +126,8 @@ setMethod("show", "ZINBParams", function(object) {
default.values <- lapply(parameters, function(x) {slot(default, x)}) default.values <- lapply(parameters, function(x) {slot(default, x)})
default.values <- sapply(default.values, paste, collapse = ", ") default.values <- sapply(default.values, paste, collapse = ", ")
not.default <- values != default.values not.default <- values != default.values
names(short.values)[not.default] <- toupper(names(values[not.default])) cat(crayon::bold(c("Model", category)), "\n")
cat("Model", category, "\n") showValues(short.values, not.default)
print(noquote(short.values), print.gap = 2)
cat("\n") cat("\n")
} }
......
...@@ -79,8 +79,8 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1, ...@@ -79,8 +79,8 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
sce <- addFeatureStats(sce, "counts") sce <- addFeatureStats(sce, "counts")
sce <- addFeatureStats(sce, "cpm") sce <- addFeatureStats(sce, "cpm")
sce <- addFeatureStats(sce, "cpm", log = TRUE) sce <- addFeatureStats(sce, "cpm", log = TRUE)
colData(sce)$PctZero <- 100 * (1 - colData(sce)$total_features / n.features <- colData(sce)$total_features_by_counts
nrow(sce)) colData(sce)$PctZero <- 100 * (1 - n.features / nrow(sce))
sces[[name]] <- sce sces[[name]] <- sce
} }
...@@ -140,7 +140,7 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1, ...@@ -140,7 +140,7 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
theme_minimal() theme_minimal()
z.gene <- ggplot(features, z.gene <- ggplot(features,
aes_string(x = "Dataset", y = "pct_dropout_counts", aes_string(x = "Dataset", y = "pct_dropout_by_counts",
colour = "Dataset")) + colour = "Dataset")) +
geom_boxplot() + geom_boxplot() +
scale_y_continuous(limits = c(0, 100)) + scale_y_continuous(limits = c(0, 100)) +
...@@ -160,7 +160,8 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1, ...@@ -160,7 +160,8 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
theme_minimal() theme_minimal()
mean.zeros <- ggplot(features, mean.zeros <- ggplot(features,
aes_string(x = "MeanCounts", y = "pct_dropout_counts", aes_string(x = "MeanCounts",
y = "pct_dropout_by_counts",
colour = "Dataset", fill = "Dataset")) + colour = "Dataset", fill = "Dataset")) +
geom_point(size = point.size, alpha = point.alpha) + geom_point(size = point.size, alpha = point.alpha) +
scale_x_log10(labels = scales::comma) + scale_x_log10(labels = scales::comma) +
...@@ -296,7 +297,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -296,7 +297,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
for (name in names(sces)) { for (name in names(sces)) {
sce <- sces[[name]] sce <- sces[[name]]
if (!identical(dim(sce), ref.dim)) { if (!identical(dim(sce), ref.dim)) {
stop("SCESets must have the same dimensions") stop("all datasets in 'sces' must have the same dimensions")
} }
rowData(sce)$Dataset <- name rowData(sce)$Dataset <- name
colData(sce)$Dataset <- name colData(sce)$Dataset <- name
...@@ -304,8 +305,9 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -304,8 +305,9 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
cpm(sce) <- scater::calculateCPM(sce, use_size_factors = FALSE) cpm(sce) <- scater::calculateCPM(sce, use_size_factors = FALSE)
sce <- addFeatureStats(sce, "counts") sce <- addFeatureStats(sce, "counts")
sce <- addFeatureStats(sce, "cpm", log = TRUE) sce <- addFeatureStats(sce, "cpm", log = TRUE)
colData(sce)$PctZero <- 100 * (1 - colData(sce)$total_features / n.features <- colData(sce)$total_features_by_counts
nrow(sce)) colData(sce)$PctZero <- 100 * (1 - n.features / nrow(sce))
rowData(sce)$RankCounts <- rank(rowData(sce)$mean_counts)
sces[[name]] <- sce sces[[name]] <- sce
} }
...@@ -314,12 +316,12 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -314,12 +316,12 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
ref.means <- sort(rowData(ref.sce)$MeanLogCPM) ref.means <- sort(rowData(ref.sce)$MeanLogCPM)
ref.vars <- sort(rowData(ref.sce)$VarLogCPM) ref.vars <- sort(rowData(ref.sce)$VarLogCPM)
ref.libs <- sort(colData(ref.sce)$total_counts) ref.libs <- sort(colData(ref.sce)$total_counts)
ref.z.gene <- sort(rowData(ref.sce)$pct_dropout_counts) ref.z.gene <- sort(rowData(ref.sce)$pct_dropout_by_counts)
ref.z.cell <- sort(colData(ref.sce)$PctZero) ref.z.cell <- sort(colData(ref.sce)$PctZero)
ref.rank.ord <- order(rowData(ref.sce)$rank_counts) ref.rank.ord <- order(rowData(ref.sce)$RankCounts)
ref.vars.rank <- rowData(ref.sce)$VarLogCPM[ref.rank.ord] ref.vars.rank <- rowData(ref.sce)$VarLogCPM[ref.rank.ord]
ref.z.gene.rank <- rowData(ref.sce)$pct_dropout_counts[ref.rank.ord] ref.z.gene.rank <- rowData(ref.sce)$pct_dropout_by_counts[ref.rank.ord]
for (name in names(sces)) { for (name in names(sces)) {
sce <- sces[[name]] sce <- sces[[name]]
...@@ -334,8 +336,8 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -334,8 +336,8 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
colData(sce)$RankDiffLibSize <- colData(sce)$total_counts - colData(sce)$RankDiffLibSize <- colData(sce)$total_counts -
colData(sce)$RefRankLibSize colData(sce)$RefRankLibSize
rowData(sce)$RefRankZeros <- ref.z.gene[rank( rowData(sce)$RefRankZeros <- ref.z.gene[rank(
rowData(sce)$pct_dropout_counts)] rowData(sce)$pct_dropout_by_counts)]
rowData(sce)$RankDiffZeros <- rowData(sce)$pct_dropout_counts - rowData(sce)$RankDiffZeros <- rowData(sce)$pct_dropout_by_counts -
rowData(sce)$RefRankZeros rowData(sce)$RefRankZeros
colData(sce)$RefRankZeros <- ref.z.cell[rank( colData(sce)$RefRankZeros <- ref.z.cell[rank(
colData(sce)$PctZero)] colData(sce)$PctZero)]
...@@ -343,9 +345,9 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -343,9 +345,9 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
colData(sce)$RefRankZeros colData(sce)$RefRankZeros
rowData(sce)$MeanRankVarDiff <- rowData(sce)$VarLogCPM - rowData(sce)$MeanRankVarDiff <- rowData(sce)$VarLogCPM -
ref.vars.rank[rowData(sce)$rank_counts] ref.vars.rank[rowData(sce)$RankCounts]
rowData(sce)$MeanRankZerosDiff <- rowData(sce)$pct_dropout_counts - rowData(sce)$MeanRankZerosDiff <- rowData(sce)$pct_dropout_by_counts -
ref.z.gene.rank[rowData(sce)$rank_counts] ref.z.gene.rank[rowData(sce)$RankCounts]
sces[[name]] <- sce sces[[name]] <- sce
} }
...@@ -391,7 +393,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -391,7 +393,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
theme_minimal() theme_minimal()
mean.var <- ggplot(features, mean.var <- ggplot(features,
aes_string(x = "rank_counts", y = "MeanRankVarDiff", aes_string(x = "RankCounts", y = "MeanRankVarDiff",
colour = "Dataset", fill = "Dataset")) + colour = "Dataset", fill = "Dataset")) +
geom_hline(yintercept = 0, colour = "red") + geom_hline(yintercept = 0, colour = "red") +
geom_point(size = point.size, alpha = point.alpha) + geom_point(size = point.size, alpha = point.alpha) +
...@@ -434,7 +436,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -434,7 +436,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
theme_minimal() theme_minimal()
mean.zeros <- ggplot(features, mean.zeros <- ggplot(features,
aes_string(x = "rank_counts", y = "MeanRankZerosDiff", aes_string(x = "RankCounts", y = "MeanRankZerosDiff",
colour = "Dataset", fill = "Dataset")) + colour = "Dataset", fill = "Dataset")) +
geom_hline(yintercept = 0, colour = "red") + geom_hline(yintercept = 0, colour = "red") +
geom_point(size = point.size, alpha = point.alpha) + geom_point(size = point.size, alpha = point.alpha) +
...@@ -479,7 +481,8 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1, ...@@ -479,7 +481,8 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
theme_minimal() theme_minimal()
z.gene.qq <- ggplot(features, z.gene.qq <- ggplot(features,
aes_string(x = "RefRankZeros", y = "pct_dropout_counts", aes_string(x = "RefRankZeros",
y = "pct_dropout_by_counts",
colour = "Dataset")) + colour = "Dataset")) +
geom_abline(intercept = 0, slope = 1, colour = "red") + geom_abline(intercept = 0, slope = 1, colour = "red") +
geom_point(size = point.size, alpha = point.alpha) + geom_point(size = point.size, alpha = point.alpha) +
...@@ -714,8 +717,8 @@ makeDiffPanel <- function(diff, title = "Difference comparison", ...@@ -714,8 +717,8 @@ makeDiffPanel <- function(diff, title = "Difference comparison",
#' \dontrun{ #' \dontrun{
#' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20) #' sim1 <- splatSimulate(nGenes = 1000, batchCells = 20)
#' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20) #' sim2 <- simpleSimulate(nGenes = 1000, nCells = 20)
#' comparison <- compSCESets(list(Splat = sim1, Simple = sim2)) #' comparison <- compSCEs(list(Splat = sim1, Simple = sim2))
#' difference <- diffSCESets(list(Splat = sim1, Simple = sim2), ref = "Simple") #' difference <- diffSCEs(list(Splat = sim1, Simple = sim2), ref = "Simple")
#' panel <- makeOverallPanel(comparison, difference) #' panel <- makeOverallPanel(comparison, difference)
#' } #' }
#' #'
......
...@@ -71,7 +71,12 @@ listSims <- function(print = TRUE) { ...@@ -71,7 +71,12 @@ listSims <- function(print = TRUE) {
"drisso/zinbwave", "drisso/zinbwave",
"The ZINB-WaVE simulation simulates counts from a "The ZINB-WaVE simulation simulates counts from a
sophisticated zero-inflated negative-binomial distribution sophisticated zero-inflated negative-binomial distribution
including cell and gene-level covariates.")) including cell and gene-level covariates."),
c("SparseDC", "sparseDC", "10.1093/nar/gkx1113",
"cran/SparseDC",
"The SparseDC simulation simulates a set of clusters
across two conditions, where some clusters may be present in
only one condition."))
sims.table <- data.frame(Name = rep(NA, length(sims)), sims.table <- data.frame(Name = rep(NA, length(sims)),
Prefix = rep(NA, length(sims)), Prefix = rep(NA, length(sims)),
...@@ -89,8 +94,10 @@ listSims <- function(print = TRUE) { ...@@ -89,8 +94,10 @@ listSims <- function(print = TRUE) {
cat("Splatter currently contains", length(sims), "simulations", "\n\n") cat("Splatter currently contains", length(sims), "simulations", "\n\n")
for (idx in seq_len(nrow(sims.table))) { for (idx in seq_len(nrow(sims.table))) {
sim <- as.character(sims.table[idx, ]) sim <- as.character(sims.table[idx, ])
cat(sim[1], paste0("(", sim[2], ")"), "\n") cat(crayon::bold(sim[1]), crayon::yellow(paste0("(", sim[2], ")")),
cat("DOI:", sim[3], "\t", "GitHub:", sim[4], "\n") "\n")
cat(crayon::bold("DOI:"), crayon::cyan(sim[3]), "\t",
crayon::bold("GitHub:"), crayon::cyan(sim[4]), "\n")
cat(sim[5], "\n\n") cat(sim[5], "\n\n")
} }
} }
......
...@@ -14,7 +14,10 @@ ...@@ -14,7 +14,10 @@
#' @return LunParams object containing the estimated parameters. #' @return LunParams object containing the estimated parameters.
#' #'
#' @examples #' @examples
#' # Load example data
#' library(scater)
#' data("sc_example_counts") #' data("sc_example_counts")
#'
#' params <- lunEstimate(sc_example_counts) #' params <- lunEstimate(sc_example_counts)
#' params #' params
#' @export #' @export
......
...@@ -132,7 +132,7 @@ lunSimulate <- function(params = newLunParams(), verbose = TRUE, ...) { ...@@ -132,7 +132,7 @@ lunSimulate <- function(params = newLunParams(), verbose = TRUE, ...) {
CellMeans = cell.means), CellMeans = cell.means),
rowData = features, rowData = features,
colData = cells, colData = cells,
metadata = list(params = params)) metadata = list(Params = params))
if (verbose) {message("Done!")} if (verbose) {message("Done!")}
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#' @param min.size minimum size of clusters when identifying group of cells in #' @param min.size minimum size of clusters when identifying group of cells in
#' the data. #' the data.
#' @param verbose logical. Whether to show progress messages. #' @param verbose logical. Whether to show progress messages.
#' @param BPPARAM A \code{\link[BiocParallel]{BiocParallelParam}} instance #' @param BPPARAM A \code{\link{BiocParallelParam}} instance giving the parallel
#' giving the parallel back-end to be used. Default is #' back-end to be used. Default is \code{\link{SerialParam}} which uses a
#' \code{\link[BiocParallel]{SerialParam}} which uses a single core. #' single core.
#' #'
#' @details #' @details
#' See \code{\link{Lun2Params}} for more details on the parameters. #' See \code{\link{Lun2Params}} for more details on the parameters.
...@@ -20,8 +20,11 @@ ...@@ -20,8 +20,11 @@
#' #'
#' @examples #' @examples
#' \dontrun{ #' \dontrun{
#' # Load example data
#' library(scater)
#' data("sc_example_counts") #' data("sc_example_counts")
#' data("sc_example_cell_info") #' data("sc_example_cell_info")
#'
#' plates <- factor(sc_example_cell_info$Mutation_Status) #' plates <- factor(sc_example_cell_info$Mutation_Status)
#' params <- lun2Estimate(sc_example_counts, plates, min.size = 20) #' params <- lun2Estimate(sc_example_counts, plates, min.size = 20)
#' params #' params
......
...@@ -183,7 +183,7 @@ lun2Simulate <- function(params = newLun2Params(), zinb = FALSE, ...@@ -183,7 +183,7 @@ lun2Simulate <- function(params = newLun2Params(), zinb = FALSE,
TrueCounts <- true.counts), TrueCounts <- true.counts),
rowData = features, rowData = features,
colData = cells, colData = cells,
metadata = list(params = params)) metadata = list(Params = params))
if (zinb) { if (zinb) {
rownames(is.zero) <- gene.names rownames(is.zero) <- gene.names
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
#' @return MFAParams object containing the estimated parameters. #' @return MFAParams object containing the estimated parameters.
#' #'
#' @examples #' @examples
#' # Load example data
#' library(scater)
#' data("sc_example_counts") #' data("sc_example_counts")
#'
#' params <- mfaEstimate(sc_example_counts) #' params <- mfaEstimate(sc_example_counts)
#' params #' params
#' @export #' @export
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment