Principal component analysis plot

plotPCA(object, ...)

# S4 method for DESeqTransform
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"), ...)

# S4 method for DESeqAnalysis
plotPCA(object, ...)

Arguments

object

Object.

assay

vector(1). Name or index of count matrix slotted in assays(). When passing in a string, the name must be defined in assayNames().

interestingGroups

character. Groups of interest that define the samples. If left unset, defaults to sampleName.

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.

title

character(1). Plot title.

subtitle

character(1). Plot 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.

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(deseq) ## DESeqAnalysis plotPCA(deseq)
#> Using DESeqTransform counts.
#> Plotting PCA using 500 genes.
## DESeqTransform dt <- as(deseq, "DESeqTransform") plotPCA(dt)
#> Plotting PCA using 500 genes.