View source: R/unsplitAltExps.R
unsplitAltExps | R Documentation |
Combine the main and alternative experiments back into one SingleCellExperiment object.
This is effectively the reverse operation to splitAltExps
.
unsplitAltExps(sce, prefix.rows = TRUE, prefix.cols = TRUE, delayed = TRUE)
sce |
A SingleCellExperiment containing alternative experiments in the |
prefix.rows |
Logical scalar indicating whether the (non- |
prefix.cols |
Logical scalar indicating whether the names of column-related fields should be prefixed with the name of the alternative experiment.
If |
delayed |
Logical scalar indicating whether the combining of the assays should be delayed. |
This function is intended for downstream applications that accept a SingleCellExperiment but are not aware of the altExps
concept.
By consolidating all data together, applications like iSEE can use the same machinery to visualize any feature of interest across all modalities.
However, for quantitative analyses, it is usually preferable to keep different modalities separate.
Assays with the same name are rbind
ed together in the output object.
If a particular name is not present for any experiment, its values are filled in with the appropriately typed NA
instead.
By default, this is done efficiently via ConstantMatrix abstractions to avoid actually creating a dense matrix of NA
s.
If delayed=FALSE
, the combining of matrices is done without any DelayedArray wrappers,
yielding a simpler matrix representation at the cost of increasing memory usage.
Any colData
or reducedDims
in the alternative experiments are added to those of the main experiment.
The names of these migrated fields are prefixed by the name of the alternative experiment if prefix.cols=TRUE
.
Setting prefix.rows=FALSE
, prefix.cols=NA
and delayed=FALSE
will reverse the effects of splitAltExps
.
A SingleCellExperiment where all features in the alternative experiments of sce
are now features in the main experiment.
The output object has no alternative experiments of its own.
Aaron Lun
splitAltExps
, which does the reverse operation of this function.
counts <- matrix(rpois(10000, 5), ncol=100)
sce <- SingleCellExperiment(assays=list(counts=counts))
feat.type <- sample(c("endog", "ERCC", "adt"), nrow(sce),
replace=TRUE, p=c(0.8, 0.1, 0.1))
sce <- splitAltExps(sce, feat.type)
# Making life a little more complicated.
logcounts(sce) <- log2(counts(sce) + 1)
sce$cluster <- sample(5, ncol(sce), replace=TRUE)
reducedDim(sce, "PCA") <- matrix(rnorm(ncol(sce)*2), ncol=2)
# Now, putting Humpty Dumpty back together again.
restored <- unsplitAltExps(sce)
restored
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.