Reduced dimensions {SingleCellExperiment} | R Documentation

## Reduced dimensions methods

### Description

Methods to get or set the dimensionality reduction results.

### Usage

    ## S4 method for signature 'SingleCellExperiment'
    reducedDim(x, type=1, withDimnames=TRUE)

    ## S4 replacement method for signature 'SingleCellExperiment'
    reducedDim(x, type=1) <- value

    ## S4 method for signature 'SingleCellExperiment'
    reducedDims(x, withDimnames=TRUE)

    ## S4 replacement method for signature 'SingleCellExperiment'
    reducedDims(x) <- value

    ## S4 method for signature 'SingleCellExperiment'
    reducedDimNames(x)

    ## S4 replacement method for signature 'SingleCellExperiment,character'
    reducedDimNames(x) <- value

### Arguments

`x` | A SingleCellExperiment object.
`type` | A string containing the name for the dimensionality reduction results or a numeric index containing the position of the desired dimenionality reduction result.
`withDimnames` | A logical scalar indicating whether each set of results should be returned with row names matching `colnames(x)`. This can be turned off for greater efficiency.
`value` | For `reducedDim<-`, a matrix (usually double-precision) of coordinates, for each cell (row) and dimension (column). For `reducedDims<-`, a named SimpleList object containing such matrices. For `reducedDimNames<-`, a character vector containing the names of all dimensionality reduction results.

### Details

Dimensionality reduction is often used to interpreting the results of single-cell data analysis. These methods allow the results of dimensionality reduction methods to be stored in a SingleCellExperiment object. Multiple results can be stored in a single object by assigning to different `type` in `reducedDim<-`.

If `value` is `NULL` for `reducedDim<-`, the set of results corresponding to `type` is removed from the object. If `value` is `NULL` for `reducedDims<-`, all dimensionality reduction results are removed.

Note that the `reducedDims` slot must always be named for consistency. Unnamed results assigned via `reducedDim<-` or `reducedDims<-` will be assigned empty names.

### Value

For `reducedDim`, a numeric matrix is returned containing coordinates for cells (rows) and dimensions (columns).

For `reducedDims`, a named SimpleList of matrices is returned, with one matrix for each type of dimensionality reduction method.

For `reducedDimNames`, a character vector containing the names of the elements in `reducedDims`.

For `reducedDim<-` and `reducedDims<-`, a SingleCellExperiment object is returned with updated results in the `reducedDims` slot.

### Author(s)

Aaron Lun

### See Also

`SingleCellExperiment-class`

### Examples

    example(SingleCellExperiment, echo=FALSE)
    reducedDim(sce, "PCA")
    reducedDim(sce, "tSNE")
    reducedDims(sce)

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

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

[Package SingleCellExperiment version 1.6.0 Index]