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_color_synesthesia_d()),
  pointSize = getOption(x = "acid.point.size", default = 3L),
  title = "PCA", subtitle = NULL, return = c("ggplot", "DataFrame"),
  ...)

Arguments

object

Object.

assay

vector(1). Assay name or index position.

interestingGroups

character. Groups of interest to use for visualization. Corresponds to factors describing the columns of the object.

ntop

integer(1) or Inf. Number of most variable genes to plot. Use Inf to include all genes (not recommended).

label

logical(1). Superimpose sample text labels on the plot.

color

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())
pointSize

numeric(1). Point size for dots in the plot. In the range of 1-3 is generally recommended.

title

character(1). Title.

subtitle

character(1). Subtitle.

return

character(1). Return type. Uses match.arg() internally and defaults to the first argument in the character vector.

...

Additional arguments.

Value

ggplot or DataFrame.

Note

SingleCellExperiment method that visualizes dimension reduction data slotted in reducedDims() is defined in pointillism package.

Updated 2019-08-27.

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.

See also

DESeq2::plotPCA().

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

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

Examples

data(RangedSummarizedExperiment, package = "acidtest") ## SummarizedExperiment ==== object <- RangedSummarizedExperiment plotPCA(object)
#> Plotting PCA using 500 features.