calc_PCAs: Run PCA on gene expression count data

View source: R/calc_PCAs.R

calc_PCAsR Documentation

Run PCA on gene expression count data

Description

This is a wrapper function for prcomp, designed for running PCA on RNAseq data. It transposes the input data, and adds two elements to the prcomp object, containing the following for each PC: the percent variance, and a character string for labeling plot axes.

Usage

calc_PCAs(counts, cpm = TRUE, log2_transform = FALSE, ...)

Arguments

counts

matrix or data frame of gene expression counts, or an object from which counts can be extracted. Should have genes in rows and samples in columns

cpm

logical, whether to transform the counts to counts-per-million (using edgeR::cpm) before running prcomp.

log2_transform

logical, whether to transform the counts (using log2(counts+1)) before running prcomp.

...

(optional) additional arguments passed to prcomp, such as center and scale.

Value

a prcomp object, with additional list elements containing the percent variance and strings for labeling plot axes.


mjdufort/RNAseQC documentation built on April 19, 2024, 3:13 p.m.