View source: R/simplifyToSCE.R
simplifyToSCE | R Documentation |
Simplify a list of SingleCellExperiment, usually generated by applySCE
on main and alternative Experiments,
into a single SingleCellExperiment containing some of the results in its altExps
.
simplifyToSCE(results, which.main, warn.level = 2)
results |
A named list of SummarizedExperiment or SingleCellExperiment objects. |
which.main |
Integer scalar specifying which entry of |
warn.level |
Integer scalar specifying the type of warnings that can be emitted. |
Each entry of results
should be a SummarizedExperiment with the same number and names of the columns.
There should not be any duplicate entries in names(results)
, as the names are used to represent the names of the alternative Experiments in the output.
If which.main
is a scalar, the corresponding entry of results
should be a SingleCellExperiment.
Failure to meet these conditions may result in a warning or error depending on warn.level
.
The type of warnings that are emitted can be controlled with warn.level
.
If warn.level=0
, no warnings are emitted.
If warn.level=1
, all warnings are emitted except for those related to results
not being of the appropriate class.
If warn.level=2
, all warnings are emitted, and if warn.level=3
, warnings are promoted to errors.
A SingleCellExperiment corresponding to the entry of results
generated from the main Experiment.
All results generated from the alternative Experiments of x
are stored in the altExps
of the output.
If no main Experiment was used to generate results
, an empty SingleCellExperiment is used as a container for the various altExps
.
If simplification could not be performed, NULL
is returned with a warning (depending on warn.level
.
Aaron Lun
applySCE
, where this function is used when SIMPLIFY=TRUE
.
ncells <- 100
u <- matrix(rpois(20000, 5), ncol=ncells)
sce <- SingleCellExperiment(assays=list(counts=u))
altExp(sce, "BLAH") <- SingleCellExperiment(assays=list(counts=u*10))
altExp(sce, "WHEE") <- SingleCellExperiment(assays=list(counts=u*2))
# Setting FUN=identity just extracts each piece:
results <- applySCE(sce, FUN=identity, SIMPLIFY=FALSE)
results
# Simplifying to an output that mirrors the structure of 'sce'.
simplifyToSCE(results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.