reducedDims: Reduced dimensions methods

Description Getters Single-result setter Other setters Author(s) Examples

Description

Methods to get or set dimensionality reduction results in a SingleCellExperiment object. These are typically used to store and retrieve low-dimensional representations of single-cell datasets. Each row of a reduced dimension result is expected to correspond to a column of the SingleCellExperiment object.

Getters

In the following examples, x is a SingleCellExperiment object.

reducedDim(x, type, withDimnames=TRUE):

Retrieves a matrix (or matrix-like object) containing reduced dimension coordinates for cells (rows) and dimensions (columns). type is either a string specifying the name of the dimensionality reduction result in x to retrieve, or a numeric scalar specifying the index of the desired result. If withDimnames=TRUE, row names of the output matrix are replaced with the column names of x.

reducedDimNames(x):

Returns a character vector containing the names of all dimensionality reduction results in x. This is guaranteed to be of the same length as the number of results, though the names may not be unique.

reducedDims(x, withDimnames=TRUE):

Returns a named List of matrices containing one or more dimensionality reduction results. Each result is a matrix (or matrix-like object) with the same number of rows. If withDimnames=TRUE, row names of each matrix are replaced with the column names of x.

Single-result setter

reducedDim(x, type) <- value will add or replace a dimensionality reduction result in a SingleCellExperiment object x. The value of type determines how the result is added or replaced:

value is expected to be a matrix or matrix-like object with number of rows equal to ncol(x). Alternatively, if value is NULL, the result corresponding to type is removed from the object.

Other setters

In the following examples, x is a SingleCellExperiment object.

reducedDims(x) <- value:

Replaces all dimensionality reduction results in x with those in value. The latter should be a list-like object containing any number of matrices or matrix-like objects with number of rows equal to ncol(x).

If value is named, those names will be used to name the dimensionality reduction results in x. Otherwise, unnamed results are assigned default names prefixed with "unnamed".

If value is NULL, all dimensionality reduction results in x are removed.

reducedDimNames(x) <- value:

Replaces all names for dimensionality reduction results in x with a character vector value. This should be of length equal to the number of results currently in x.

Author(s)

Aaron Lun and Kevin Rue-Albrecht

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
example(SingleCellExperiment, echo=FALSE)
reducedDim(sce, "PCA")
reducedDim(sce, "tSNE")
reducedDims(sce)

reducedDim(sce, "PCA") <- NULL
reducedDims(sce)

reducedDims(sce) <- SimpleList()
reducedDims(sce)

SingleCellExperiment documentation built on Nov. 8, 2020, 7:51 p.m.