plotQC {ggspavis} | R Documentation |
Quality control (QC) plots for spatially resolved transcriptomics data.
plotQC( spe, type = c("bar", "scatter", "spots"), x_coord = "x", y_coord = "y", in_tissue = "in_tissue", metric_x = "cell_count", metric_y = "sum", discard = "discard", highlight_zeros = TRUE, threshold_x = NULL, threshold_y = NULL, trend = TRUE, marginal = TRUE, y_reverse = TRUE )
spe |
(SpatialExperiment) Input data, assumed to be a
|
type |
(character) Type of QC plot. Options are "bar", "scatter", and "spots". See details in description. |
x_coord |
(character) Name of column in |
y_coord |
(character) Name of column in |
in_tissue |
(character) Name of column in |
metric_x |
(character) Name of column in |
metric_y |
(character) Name of column in |
discard |
(character) Name of column in |
highlight_zeros |
(logical) Whether to highlight bar for x = 0 (e.g. zero cells per spot). Default = TRUE. Optional for barplots. |
threshold_x |
(numeric) Filtering threshold for QC metric on x-axis, which will be highlighted with a vertical bar. Default = NULL. Optional for scatterplots. |
threshold_y |
(numeric) Filtering threshold for QC metric on y-axis, which will be highlighted with a horizontal bar. Default = NULL. Optional for scatterplots. |
trend |
(logical) Whether to display a smoothed trend (loess) for scatterplots. Default = TRUE. Optional for scatterplots. |
marginal |
(logical) Whether to display marginal histograms for scatterplots. Default = TRUE. Optional for scatterplots. |
y_reverse |
(logical) Whether to reverse y coordinates, which is often required for 10x Genomics Visium data. Default = TRUE. |
Function to generate plots for quality control (QC) purposes for spatially resolved transcriptomics data.
The following types of QC plots are available:
- Barplot (type
= "bar") for a single QC metric, e.g. number of cells
per spot. For number of cells per spot, the barplot highlights spots with
zero cells.
- Scatterplot (type
= "scatter") comparing two QC metrics, e.g. number
of detected features vs. number of cells per spot, with optional vertical and
horizontal lines highlighting QC filtering thresholds.
- Spots (type
= "spots") i.e. spots in spatial (x-y) coordinates,
highlighting discarded spots that do not meet filtering thresholds.
Returns a ggplot object. Additional plot elements can be added as ggplot elements (e.g. title, labels, formatting, etc).
library(STexampleData) spe <- Visium_humanDLPFC() plotQC(spe, type = "bar", metric_x = "cell_count") colData(spe)$sum <- colSums(counts(spe)) plotQC(spe, type = "scatter", metric_x = "cell_count", metric_y = "sum")