plotFeatureQC: plotFeatureQC

View source: R/plotFeatureQC.R

plotFeatureQCR Documentation

plotFeatureQC

Description

Plotting functions for spatial transcriptomics data.

Usage

plotFeatureQC(
  spe,
  plot_type = c("histogram", "violin"),
  x_metric = NULL,
  annotate = NULL,
  n_bins = 100,
  point_size = 0.1,
  scale_log1p = TRUE
)

Arguments

spe

Input data, assumed to be a SpatialExperiment or SingleCellExperiment object.

plot_type

Type of QC plot. Options are "histogram" and "violin". See Details for additional details.

x_metric

Name of column in rowData containing feature-level QC metric to plot on x-axis. Required for histograms and violin plots.

annotate

Name of column in rowData identifying selected features that do not meet QC filtering thresholds, which will be highlighted on a histogram or violin plot. Default = NULL. Optional argument used for histograms and violin plots.

n_bins

Number of bins for histograms. Default = 100. Optional argument used for histograms.

point_size

Point size. Default = 0.1. Optional argument for violin plots.

scale_log1p

Whether to log1p-scale axes. Default = TRUE.

Details

Function to create quality control (QC) plots for spatial transcriptomics data.

The following types of QC plots are available for feature-level QC (see plotSpotQC for spot-level or cell-level QC):

  • Histogram (plot_type = "histogram") for a single QC metric, e.g. total UMI counts across all spots per feature. The histogram can optionally highlight selected features, e.g. low abundance features.

  • Violin (plot_type = "violin") for a single QC metric, e.g. total UMI counts across all spots per feature. The violin plot can optionally highlight selected features, e.g. low abundance features.

Value

Returns a ggplot object, which may be further modified using ggplot functions.

Author(s)

Yixing E. Dong and Lukas M. Weber

Examples

library(STexampleData)
spe <- Visium_humanDLPFC()

rowData(spe)$feature_sum <- rowSums(counts(spe))
rowData(spe)$low_abundance <- rowSums(counts(spe) > 0) < 20

plotFeatureQC(spe, plot_type = "histogram", 
              x_metric = "feature_sum", annotate = "low_abundance")
plotFeatureQC(spe, plot_type = "violin", 
              x_metric = "feature_sum", annotate = "low_abundance")


lmweber/ggspavis documentation built on April 4, 2024, 3:21 a.m.