splitAltExps {SingleCellExperiment} | R Documentation

## Split off alternative features

### Description

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

### Usage

    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

    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

[Package SingleCellExperiment version 1.14.1 Index]