run_pca: Run PCA

View source: R/run_pca.R

run_pcaR Documentation

Run PCA

Description

PCA analysis, eventually using a subset of core cells for the PC construction.

Usage

run_pca(z_df, core_cells = NULL, out_pcs = 100)

Arguments

z_df

a data.frame with z-scores for each cell

core_cells

if non-NULL, a vector with the names of the cells to use as core cells. See details. Default is NULL.

out_pcs

the number of top PCs to report. Default is 100.

Details

Cells in core_cells are used to build the principal components to which all cells are then projected to. Usually used to reduce the effect of cell cycle in the PCA, by using only cells that don't cycle (see qc_cells) as core_cells.

The graph (sdev.graph) shows the standard deviation for the top 50 PCs. To show more/less PCs, add xlim(1,N) to the sdev.graph. See examples.

Value

a list with

x

the PC matrix

sdev

the standard deviations of the PCs

sdev.graph

a ggplot graph of the sdev

Author(s)

Jean Monlong

Examples

## Not run: 
pca.o = run_pca(z)

## Zoom in to the top 20 PCs
pca.o$sdev.graph + xlim(1,20)

## End(Not run)

jmonlong/scCNAutils documentation built on May 3, 2022, 4:34 a.m.