plotExplanatoryPCs: Plot the explanatory PCs for each variable

Description Usage Arguments Details Value Examples

View source: R/plotExplanatoryPCs.R

Description

Plot the explanatory PCs for each variable

Usage

1
2
3
4
5
6
7
plotExplanatoryPCs(
  object,
  nvars_to_plot = 10,
  npcs_to_plot = 50,
  theme_size = 10,
  ...
)

Arguments

object

A SingleCellExperiment object containing expression values and experimental information. Alternatively, a matrix containing the output of getExplanatoryPCs.

nvars_to_plot

Integer scalar specifying the number of variables with the greatest explanatory power to plot. This can be set to Inf to show all variables.

npcs_to_plot

Integer scalar specifying the number of PCs to plot.

theme_size

numeric scalar providing base font size for ggplot theme.

...

Parameters to be passed to getExplanatoryPCs.

Details

A density plot is created for each variable, showing the R-squared for each successive PC (up to npcs_to_plot PCs). Only the nvars_to_plot variables with the largest maximum R-squared across PCs are shown.

If object is a SingleCellExperiment object, getExplanatoryPCs will be called to compute the variance in expression explained by each variable in each gene. Users may prefer to run getExplanatoryPCs manually and pass the resulting matrix as object, in which case the R-squared values are used directly.

Value

A ggplot object.

Examples

1
2
3
4
5
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce <- runPCA(example_sce)

plotExplanatoryPCs(example_sce)

scater documentation built on Feb. 28, 2021, 2:01 a.m.