plot_pca: Plot PCA colored by variables of interest

View source: R/plot_pca.R

plot_pcaR Documentation

Plot PCA colored by variables of interest

Description

Plot PCA colored by variables of interest

Usage

plot_pca(
  dat,
  meta = NULL,
  vars,
  PCx = 1,
  PCy = 2,
  scale = FALSE,
  outlier_sd = 3,
  outlier_group = NULL,
  transform_logCPM = FALSE,
  libraryID = "libID"
)

Arguments

dat

Data frame, edgeR DGEList, or limma EList object containing gene counts in libraries

meta

Data frame containing meta data with vars. Only needed if dat is a counts table and not an edgeR or limma object

vars

Character vector of variables to color PCA by

PCx

Numeric value for PC to plot on x-axis. Default it 1

PCy

Numeric value for PC to plot on y-axis. Default it 2

scale

Logical if should scale variance in PCA calculation see stats::prcomp for details. Default is FALSE

outlier_sd

Numeric. If vars includes "outlier", statistical outliers are determined and colored based on this standard deviation along PC1 and PC2.

outlier_group

Character string in which to group sd calculations

transform_logCPM

Logical if should convert counts to log counts per million

libraryID

Character of variable name to match dat meta data frames

Value

List of ggplot objects

Examples

plot_pca(kimma::example.voom, var=c("virus","outlier"))
plot_pca(kimma::example.voom, var=c("virus","outlier"), PCx=1, PCy=3)

BIGslu/BIGpicture documentation built on Oct. 14, 2024, 9:30 p.m.