R/plotAssayPCA.R
plotAssayPCA-methods.Rd
Plot PCA for any assay within a SummarizedExperiment object
plotAssayPCA(x, ...)
# S4 method for class '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,
...
)
An object containing an assay slot
Passed to geom_text
The assay to perform PCA on
The column name to be used for colours
The column name(s) to be used for determining the shape or size of points
The column name to be used for labels
logical(1). Display the points. If TRUE
any labels will
repel. If FALSE
, labels will appear at the exact points
numeric(1) The PC to plot on the x-axis
numeric(1) The PC to plot on the y-axis
character(1). Any transformative function to be applied to the
data before performing the PCA, e.g. trans = "log2"
Subsample the data to this many points before performing PCA
Any rows with variance below this value will be excluded prior to passing to prcomp. All rows are scaled and centred by default
Passed to prcomp
A ggplot2 object
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
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
)