plotSpotQC | R Documentation |
Plotting functions for spatial transcriptomics data.
plotSpotQC(
spe,
plot_type = c("histogram", "scatter", "spot", "violin"),
x_coord = NULL,
y_coord = NULL,
x_metric = NULL,
y_metric = NULL,
x_threshold = NULL,
y_threshold = NULL,
trend = TRUE,
marginal = TRUE,
annotate = NULL,
in_tissue = NULL,
legend_point_size = 3,
n_bins = 100,
point_size = 0.3,
y_reverse = TRUE
)
plotQC(...)
spe |
Input data, assumed to be a |
plot_type |
Type of QC plot. Options are "histogram", "scatter", "spot", and "violin". See Details for additional details. |
x_coord |
Name of column in |
y_coord |
Name of column in |
x_metric |
Name of column in |
y_metric |
Name of column in |
x_threshold |
QC filtering threshold on x-axis metric to highlight with vertical line. Default = NULL. Optional argument used for scatter plots. |
y_threshold |
QC filtering threshold on y-axis metric to highlight with horizontal line. Default = NULL. Optional argument used for scatter plots. |
trend |
Whether to show smoothed trend line (loess). Default = TRUE. Optional argument used for scatter plots. |
marginal |
Whether to show marginal histograms. Default = TRUE. Optional argument used for scatter plots. |
annotate |
Name of column in |
in_tissue |
Name of column in |
legend_point_size |
Legend point size. Default = 3. Optional argument used for spot plots. |
n_bins |
Number of bins for histograms. Default = 100. Optional argument used for histograms. |
point_size |
Point size. Default = 0.3. Optional argument for scatter plots, spot plots, and violin plots. Suggested values: 0.5 for scatter plots, 0.3 for spot plots, 0.1 for violin plots. |
y_reverse |
Whether to reverse y coordinates. This is usually required for 10x Genomics Visium datasets when using the default coordinate values. Default = TRUE. Set to FALSE if not needed, e.g. for other platforms. Optional argument used for spot plots. |
... |
Not used. |
Function to create quality control (QC) plots for spatial transcriptomics data.
The following types of QC plots are available for spot-level or cell-level QC
(see plotFeatureQC
for feature-level QC):
Histogram (plot_type = "histogram"
) for a single QC metric, e.g.
number of UMI counts per spot. For number of counts per spot, the histogram
can optionally highlight selected spots, e.g. spots with low library size.
Scatter plot (plot_type = "scatter"
) comparing two QC metrics,
e.g. number of detected features vs. number of cells per spot, with optional
horizontal and vertical lines highlighting QC filtering thresholds.
Spot plot (plot_type = "spot"
) showing spots in spatial x-y
coordinates, e.g. highlighting selected spots that do not meet filtering
thresholds.
Violin plot (plot_type = "violin"
) for a single QC metric, e.g.
number of UMI counts per spot. For number of counts per spot, the violin plot
can optionally highlight selected spots, e.g. spots with low library size.
Returns a ggplot object, which may be further modified using ggplot functions.
Lukas M. Weber and Yixing E. Dong
library(STexampleData)
spe <- Visium_humanDLPFC()
colData(spe)$sum <- colSums(counts(spe))
colData(spe)$low_libsize <- colData(spe)$sum < 400
plotSpotQC(spe, plot_type = "histogram", x_metric = "sum", annotate = "low_libsize")
plotSpotQC(spe, plot_type = "scatter", x_metric = "sum", y_metric = "cell_count")
plotSpotQC(spe, plot_type = "spot", annotate = "low_libsize", in_tissue = "in_tissue")
plotSpotQC(spe, plot_type = "violin", x_metric = "sum", annotate = "low_libsize")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.