Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/satijalab/seurat-wrappers/llms.txt

Use this file to discover all available pages before exploring further.

SeuratWrappers provides two functions for miQC-based quality control:
  • RunMiQC() — Fits a mixture model and marks cells as compromised
  • PlotMiQC() — Visualizes the fitted model and posterior probabilities

RunMiQC()

Syntax

RunMiQC(
  object,
  percent.mt = "percent.mt",
  nFeature_RNA = "nFeature_RNA",
  posterior.cutoff = 0.75,
  model.type = "linear",
  model.slot = "flexmix_model",
  verbose = TRUE,
  backup.option = "percentile",
  backup.percentile = 0.99,
  backup.percent = 5,
  ...
)

Parameters

object
Seurat
required
A Seurat object with mitochondrial percentage and feature count metadata.
percent.mt
character
default:"percent.mt"
Name of the metadata column containing percent mitochondrial reads.
nFeature_RNA
character
default:"nFeature_RNA"
Name of the metadata column containing the number of detected features.
posterior.cutoff
numeric
default:"0.75"
Cells with posterior probability of being compromised above this threshold are marked for removal.
model.type
character
default:"linear"
Type of regression model for the mixture components. One of "linear", "spline", or "polynomial".
model.slot
character
default:"flexmix_model"
Name of the Misc slot in which the fitted flexmix model is stored.
verbose
logical
default:"TRUE"
Print progress messages.
backup.option
character
default:"percentile"
Fallback strategy when the mixture model cannot be fitted. One of:
  • "percentile" — filter by backup.percentile
  • "percent" — filter by backup.percent hard cutoff
  • "pass" — return the object without filtering
  • "halt" — raise an error
backup.percentile
numeric
default:"0.99"
Percentile cutoff for the "percentile" backup option.
backup.percent
numeric
default:"5"
Hard percent mitochondrial cutoff for the "percent" backup option.

Returns

A Seurat object with two new metadata columns:
  • miQC.probability — posterior probability of each cell being compromised
  • miQC.keep"keep" or "discard" decision per cell
The fitted flexmix model is stored in Misc(object, model.slot).

PlotMiQC()

Syntax

PlotMiQC(
  seurat_object,
  percent.mt = "percent.mt",
  nFeature_RNA = "nFeature_RNA",
  model.slot = "flexmix_model",
  color.by = "miQC.probability"
)

Parameters

seurat_object
Seurat
required
A Seurat object that has already been processed with RunMiQC().
percent.mt
character
default:"percent.mt"
Metadata column name for mitochondrial percentage.
nFeature_RNA
character
default:"nFeature_RNA"
Metadata column name for number of features.
model.slot
character
default:"flexmix_model"
Name of the Misc slot containing the fitted flexmix model.
color.by
character
default:"miQC.probability"
Metadata column to use for coloring points in the plot.

Examples

library(SeuratWrappers)
install.packages("flexmix")
BiocManager::install("miQC")

# Add mitochondrial percentage
object[["percent.mt"]] <- PercentageFeatureSet(object, pattern = "^MT-")

# Run miQC
object <- RunMiQC(object, percent.mt = "percent.mt", posterior.cutoff = 0.75)

# Visualize
PlotMiQC(object)

# Filter cells
object <- subset(object, miQC.keep == "keep")

See Also

Build docs developers (and LLMs) love