plotAssayPCA-methods: Plot PCA For any assay within a SummarizedExperiment

plotAssayPCAR Documentation

Plot PCA For any assay within a SummarizedExperiment

Description

Plot PCA for any assay within a SummarizedExperiment object

Usage

plotAssayPCA(x, ...)

## S4 method for signature 'SummarizedExperiment'
plotAssayPCA(
  x,
  assay = "counts",
  colour,
  shape,
  size,
  label,
  show_points = TRUE,
  pc_x = 1,
  pc_y = 2,
  trans = NULL,
  n_max = Inf,
  tol = sqrt(.Machine$double.eps),
  rank = NULL,
  ...
)

Arguments

x

An object containing an assay slot

...

Passed to geom_text

assay

The assay to perform PCA on

colour

The column name to be used for colours

shape, size

The column name(s) to be used for determining the shape or size of points

label

The column name to be used for labels

show_points

logical(1). Display the points. If TRUE any labels will repel. If FALSE, labels will appear at the exact points

pc_x

numeric(1) The PC to plot on the x-axis

pc_y

numeric(1) The PC to plot on the y-axis

trans

character(1). Any transformative function to be applied to the data before performing the PCA, e.g. trans = "log2"

n_max

Subsample the data to this many points before performing PCA

tol

Any rows with variance below this value will be excluded prior to passing to prcomp. All rows are scaled and centred by default

rank

Passed to prcomp

Details

Uses ggplot2 to create a PCA plot for the selected assay. Any numerical transformation prior to performing the PCA can be specified using the trans argument

Value

A ggplot2 object

Examples

data("se")
se$treatment <- c("E2", "E2", "E2", "E2DHT", "E2DHT", "E2DHT")
se$sample <- colnames(se)
plotAssayPCA(se, trans = "log1p", colour = "treatment", label = "sample")
plotAssayPCA(
  se, trans = "log1p", colour = "treatment", label = "sample",
  size = totals / 1e3
)
plotAssayPCA(
  se, trans = "log1p", colour = "treatment", label = "sample",
  show_points = FALSE
)



steveped/chipExtra documentation built on Aug. 1, 2024, 12:33 a.m.