getPCA {singleCellTK} | R Documentation

## Get and plot PCA components for a SCtkE object

### Description

Selects the 500 most variable genes in the SCE, performs PCA based on them and stores the values in the reducedDims slot of the SCE object.

### Usage

    getPCA(inSCE, useAssay = "logcounts", reducedDimName = "PCA")

### Arguments

`inSCE` | Input SCtkExperiment object. Required
`useAssay` | Indicate which assay to use for PCA. Default is "counts"
`reducedDimName` | Store the PCA data with this name. The default is PCA. The toolkit will store data with the pattern <ASSAY>_<ALGORITHM>.

### Value

A SCtkE object with the specified reducedDim and pcaVariances updated

### Examples

    data("mouseBrainSubsetSCE")
    #add a CPM assay
    assay(mouseBrainSubsetSCE, "cpm") <- apply(assay(mouseBrainSubsetSCE,
                                                     "counts"),
                                               2, function(x) {
                                                 x / (sum(x) / 1000000)
                                               })
    mouseBrainSubsetSCE <- getPCA(mouseBrainSubsetSCE,
                                  useAssay = "cpm",
                                  reducedDimName = "PCA_cpm")
    reducedDims(mouseBrainSubsetSCE)

[Package singleCellTK version 1.7.0 Index]