Learn R Programming

scCustomize (version 3.2.2)

ElbowPlot_scCustom: ElbowPlot with modifications

Description

Creates ElbowPlot with ability to calculate and plot cutoffs for amount of variance conferred by the PCs. Cutoff 1 is PC where principal components only contribute less than 5% of standard deviation and the principal components cumulatively contribute 90% of the standard deviation. Cutoff 2 is point where the percent change in variation between the consecutive PCs is less than 0.1%.

Usage

ElbowPlot_scCustom(
  seurat_object,
  ndims = NULL,
  reduction = "pca",
  calc_cutoffs = TRUE,
  plot_cutoffs = TRUE,
  line_colors = c("dodgerblue", "firebrick"),
  linewidth = 0.5
)

Value

ggplot2 object

Arguments

seurat_object

name of Seurat object

ndims

The number of dims to plot. Default is NULL and will plot all dims

reduction

The reduction to use, default is "pca"

calc_cutoffs

logical, whether or not to calculate the cutoffs, default is TRUE.

plot_cutoffs

lgoical, whether to plot the cutoffs as vertical lines on plot, default is TRUE.

line_colors

colors for the cutoff lines, default is c("dodgerblue", "firebrick").

linewidth

widith of the cutoff lines, default is 0.5.

References

Modified from following: https://hbctraining.github.io/scRNA-seq/lessons/elbow_plot_metric.html.

Examples

Run this code
library(Seurat)
ElbowPlot_scCustom(seurat_object = pbmc_small)

Run the code above in your browser using DataLab