Skip to contents

Adds mitoRatio, riboRatio, and log10GenesPerUMI to the object, then saves four PDFs:

  1. Doublet barplot - cells per sample colored by DoubletStatus (only if that column exists from SCP::db_scDblFinder).

  2. miQC keep barplot - cells per sample colored by miQC.keep (only if that column exists from SeuratWrappers::RunMiQC).

  3. QC density + violin plots - four metrics side-by-side with user-defined cutoff guidelines.

  4. Cell count barplot - cells per sample before any filtering.

Usage

PlotQCMetrics(
  seurat_object,
  sample_col = "Sample",
  sample_levels = NULL,
  group_col = NULL,
  output_dir,
  object_name = "",
  subset_name = "",
  species = "human",
  mt_pattern = NULL,
  ribo_pattern = NULL,
  assay = "RNA",
  sample_colors = NULL,
  count_vlines = c(500, 50000),
  feature_vlines = c(300, 80000),
  mito_vline = 0.1,
  complexity_vline = 0.8
)

Arguments

seurat_object

Seurat object (merged, unfiltered).

sample_col

Character. Metadata column holding sample identity. Default "Sample".

sample_levels

Character vector or NULL. Desired factor level order for sample_col. NULL leaves the current order unchanged.

group_col

Character or NULL. Column used to color bars in the doublet and miQC barplots (e.g. "orig.ident"). NULL uses sample_col.

output_dir

Character. Directory for PDF output.

object_name, subset_name

Character. Prefix components for PDF filenames.

species

Character. Controls the default mitochondrial and ribosomal gene patterns. One of:

  • "human" - mt_pattern = "^MT-", ribo_pattern = "^RP[LS]"

  • "mouse" - mt_pattern = "^mt-", ribo_pattern = "^Rp[ls]"

mt_pattern

Character or NULL. Override the mitochondrial gene regex. NULL derives from species.

ribo_pattern

Character or NULL. Override the ribosomal gene regex. NULL derives from species.

assay

Character. Seurat assay for PercentageFeatureSet(). Default "RNA".

sample_colors

Named character vector mapping sample_col levels to colors. NULL auto-generates from Nour_pal().

count_vlines

Numeric vector. Vertical guide lines on the nCount_RNA density plot. Default c(500, 50000).

feature_vlines

Numeric vector. Guide lines on the nFeature_RNA density plot. Default c(300, 80000).

mito_vline

Numeric. Guide line on the mitoRatio density plot. Default 0.1.

complexity_vline

Numeric. Guide line on the log10GenesPerUMI density plot. Default 0.8.

Value

The modified Seurat object with mitoRatio, riboRatio, and log10GenesPerUMI added to @meta.data (invisibly).