Principal component analysis plot

plotPCA(object, ...)

# S4 method for SummarizedExperiment
plotPCA(object, assay = 1L,
interestingGroups = NULL, ntop = 500L, label = getOption(x =
"acid.label", default = FALSE), color = getOption(x =
"acid.color.discrete", default =
acidplots::scale_colour_synesthesia_d()), pointSize = getOption(x =
"acid.point.size", default = 3L), title = "PCA", subtitle = NULL,
return = c("ggplot", "DataFrame"), ...)

## Arguments

object Object. vector(1). Name or index of count matrix slotted in assays(). When passing in a string, the name must be defined in assayNames(). character. Groups of interest that define the samples. If left unset, defaults to sampleName. integer(1) or Inf. Number of most variable genes to plot. Use Inf to include all genes (not recommended). logical(1). Superimpose sample text labels on the plot. ScaleDiscrete. Desired ggplot2 color scale. Must supply discrete values. When set NULL, the default ggplot2 color palette will be used. If manual color definitions are desired, we recommend using ggplot2::scale_color_manual(). To set the discrete color palette globally, use:options(acid.color.discrete = ggplot2::scale_color_viridis_d())  numeric(1). Point size for dots in the plot. character(1). Plot title. character(1). Plot subtitle. character(1). Return type. Uses match.arg() internally and defaults to the first argument in the character vector. Additional arguments.

## Value

ggplot or DataFrame.

## Principal component analysis

PCA (Jolliffe, et al., 2002) is a multivariate technique that allows us to summarize the systematic patterns of variations in the data. PCA takes the expression levels for genes and transforms it in principal component space, reducing each sample into one point. Thereby, we can separate samples by expression variation, and identify potential sample outliers. The PCA plot is a way to look at how samples are clustering.

## References

Jolliffe, et al., 2002.

DESeq2::plotPCA().

We're using a modified version of the DESeqTransform method here.

methodFunction(
f = "plotPCA",
signature = "DESeqTransform",
package = "DESeq2"
)


## Examples

data(rse, package = "acidtest")
plotPCA(rse, label = FALSE)#> Plotting PCA using 500 genes.plotPCA(rse, label = TRUE)#> Plotting PCA using 500 genes.