splitAltExps: Split off alternative features

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/splitAltExps.R

Description

Split a SingleCellExperiment based on the feature type, creating alternative Experiments to hold features that are not in the majority set.

Usage

1
splitAltExps(x, f, ref = NULL)

Arguments

x

A SingleCellExperiment object.

f

A character vector or factor of length equal to nrow(x), specifying the feature type of each row.

ref

String indicating which level of f should be treated as the main set.

Details

This function provides a convenient way to create a SingleCellExperiment with alternative Experiments. For example, a SingleCellExperiment with rows corresponding to all features can be quickly split into endogenous genes (main) and other alternative features like spike-in transcripts and antibody tags.

By default, the most frequent level of f is treated as the ref if the latter is not specified.

Value

A SingleCellExperiment where each row corresponds to a feature in the main set. Each other feature type is stored as an alternative Experiment, accessible by altExp. ref is used as the mainExpName.

Author(s)

Aaron Lun

See Also

altExp, to access and manipulate the alternative Experiment fields.

unsplitAltExps, to reverse the splitting.

Examples

1
2
3
4
5
6
example(SingleCellExperiment, echo=FALSE)
feat.type <- sample(c("endog", "ERCC", "CITE"), nrow(sce),
    replace=TRUE, p=c(0.8, 0.1, 0.1))

sce2 <- splitAltExps(sce, feat.type)
sce2

LTLA/SingleCellExperiment documentation built on May 25, 2021, 3:42 a.m.