pca: Principal Component Analysis

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Performs principal component analysis by spectral decomposition of a covariance or correlation matrix

Usage

1
pca(sce, do_scaling = TRUE, design = NULL)

Arguments

sce

SingleCellExperiment object

do_scaling

FALSE = covariance matrix, TRUE = correlation matrix

design

A numeric matrix describing the factors that should be blocked

Details

The calculation is done by a spectral decomposition of the (scaled) covariance matrix of the trajectory features as defined in the SingleCellExperiment object. Features with zero variance get automatically removed. Please note that this methods only uses the set of defined trajectory features in a SingleCellExperiment object; spike-in controls are ignored and are not listed as trajectory features.

To account for systematic bias in the expression data (e.g., cell cycle effects), a design matrix can be provided for the learning process. It should list the factors that should be blocked and their values per sample. It is suggested to construct a design matrix with model.matrix.

Value

A list object containing the following components:

components

Principal components

eigenvalues

Variance per component

variance

Fraction of variance explained by each component

loadings

Loading score for each feature

Author(s)

Daniel C. Ellwanger

See Also

SingleCellExperiment model.matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Example data
data(exSCE)

# Principal component analysis
res <- pca(exSCE)

# Find relevant number of principal components
d <- findSpectrum(res$eigenvalues, frac=20)

barplot(res$variance[d] * 100, ylab="Variance (%)",
        names.arg=colnames(res$components)[d], las=2)
plot(res$component, xlab="PC1", ylab="PC2")

elldc/CellTrails documentation built on May 16, 2020, 4:40 a.m.