SingleCellExperiment: The SingleCellExperiment class

View source: R/SingleCellExperiment.R

SingleCellExperiment-classR Documentation

The SingleCellExperiment class

Description

The SingleCellExperiment class is designed to represent single-cell sequencing data. It inherits from the RangedSummarizedExperiment class and is used in the same manner. In addition, the class supports storage of dimensionality reduction results (e.g., PCA, t-SNE) via reducedDims, and storage of alternative feature types (e.g., spike-ins) via altExps.

Usage

SingleCellExperiment(
  ...,
  reducedDims = list(),
  altExps = list(),
  rowPairs = list(),
  colPairs = list(),
  mainExpName = NULL
)

Arguments

...

Arguments passed to the SummarizedExperiment constructor to fill the slots of the base class.

reducedDims

A list of any number of matrix-like objects containing dimensionality reduction results, each of which should have the same number of rows as the output SingleCellExperiment object.

altExps

A list of any number of SummarizedExperiment objects containing alternative Experiments, each of which should have the same number of columns as the output SingleCellExperiment object.

rowPairs

A list of any number of SelfHits objects describing relationships between pairs of rows. Each entry should have number of nodes equal to the number of rows of the output SingleCellExperiment object. Alternatively, entries may be square sparse matrices of order equal to the number of rows of the output object.

colPairs

A list of any number of SelfHits objects describing relationships between pairs of columns. Each entry should have number of nodes equal to the number of columns of the output SingleCellExperiment object. Alternatively, entries may be square sparse matrices of order equal to the number of columns of the output object.

mainExpName

String containing the name of the main Experiment. This is comparable to the names assigned to each of the altExps.

Details

In this class, rows should represent genomic features (e.g., genes) while columns represent samples generated from single cells. As with any SummarizedExperiment derivative, different quantifications (e.g., counts, CPMs, log-expression) can be stored simultaneously in the assays slot, and row and column metadata can be attached using rowData and colData, respectively.

The extra arguments in the constructor (e.g., reducedDims altExps) represent the main extensions implemented in the SingleCellExperiment class. This enables a consistent, formalized representation of data structures that are commonly encountered during single-cell data analysis. Readers are referred to the specific documentation pages for more details.

A SingleCellExperiment can also be created by coercing from a SummarizedExperiment or RangedSummarizedExperiment instance.

Value

A SingleCellExperiment object.

Author(s)

Aaron Lun and Davide Risso

See Also

reducedDims, for representation of dimensionality reduction results.

altExps, for representation of data for alternative feature sets.

colPairs and rowPairs, to hold pairing information for rows and columns.

sizeFactors, to store size factors for normalization.

colLabels, to store cell-level labels.

rowSubset, to store a subset of rows.

?"SCE-combine", to combine or subset a SingleCellExperiment object.

?"SCE-internals", for developer use.

Examples

ncells <- 100
u <- matrix(rpois(20000, 5), ncol=ncells)
v <- log2(u + 1)

pca <- matrix(runif(ncells*5), ncells)
tsne <- matrix(rnorm(ncells*2), ncells)

sce <- SingleCellExperiment(assays=list(counts=u, logcounts=v),
    reducedDims=SimpleList(PCA=pca, tSNE=tsne))
sce

## coercion from SummarizedExperiment
se <- SummarizedExperiment(assays=list(counts=u, logcounts=v))
as(se, "SingleCellExperiment")

## coercion from RangedSummarizedExperiment
rse <- as(se, "RangedSummarizedExperiment")
as(rse, "SingleCellExperiment")

# coercion to a RangedSummarizedExperiment
as(sce, "RangedSummarizedExperiment")

# coercion to a SummarizedExperiment is slightly buggy right now
# and requires a little workaround:
as(as(sce, "RangedSummarizedExperiment"), "SummarizedExperiment")


LTLA/SingleCellExperiment documentation built on May 24, 2024, 9:23 a.m.