runPCA: Perform PCA

View source: R/process.R

runPCAR Documentation

Perform PCA

Description

Perform PCA on sections or genes in a SummarizedExperiment object for dimensionality reduction.

Usage

runPCA(object, genes = NA, matrix = "auto", scree = FALSE, ...)

Arguments

object

A SummarizedExperiment object.

genes

NA or a vector of character. Perform PCA on sections if it is NA, or on given genes if it is a vector of gene names.

matrix

Character, must be one of "auto", "count", "normalized", or "scaled". If "auto", normalized matrix is used for sections and scaled matrix is used for genes.

scree

Logical, plot the scree plot for PCs if it is TRUE.

...

Other parameters passed to prcomp.

Value

A SummarizedExperiment object. The PC embeddings are saved in slot meta if PCA is performed on sections, or saved in slot gene_embedding if PCA is performed on genes.

See Also

prcomp for performing PCA on a matrix.

Examples

data(zh.data)
zh <- createTomo(zh.data)

# Perform PCA on sections.
zh <- runPCA(zh)

# Plot the scree plot.
zh <- runPCA(zh, scree=TRUE)

# Perform PCA on some genes.
zh <- runPCA(zh, genes=rownames(zh)[1:100])

liuwd15/tomoda documentation built on March 29, 2022, 1:09 a.m.