Skill: scRNA-seq Quality Control
Use When
- User has a feature-barcode count matrix (from Cell Ranger, STARsolo, or alevin-fry) and needs to remove low-quality cells and technical artifacts.
- User wants to detect and filter doublets (two or more cells captured in one droplet).
- User wants to remove ambient RNA contamination from the count matrix.
- User needs to determine appropriate filtering thresholds before clustering.
Inputs
- Required:
- Feature-barcode matrix directory or AnnData (.h5ad) or Seurat object (.rds)
- Raw (unfiltered) matrix directory (required for SoupX/CellBender ambient RNA removal)
- Optional:
- Framework:
scanpyorseurat(default:scanpy) - Ambient RNA removal tool:
soupx,cellbender, ornone(default:soupx) - Doublet detection tool:
scrublet,scdblfinder, ordoubletfinder(default:scrubletfor Scanpy,scdblfinderfor Seurat) - Mitochondrial gene prefix (default:
MT-for human,mt-for mouse) - Filtering thresholds: min/max nFeature_RNA, min/max nCount_RNA, max percent.mt (defaults: 200–6000 genes, 500–50000 UMIs, <20% MT)
- Expected doublet rate (default: 0.008 per 1000 cells loaded)
- Framework:
Workflow
- Load the filtered feature-barcode matrix into Scanpy (AnnData) or Seurat.
- Calculate per-cell QC metrics: number of genes detected (
nFeature_RNA), total UMI count (nCount_RNA), fraction of mitochondrial reads (percent.mt), and fraction of ribosomal reads (percent.ribo). - Visualize QC metric distributions as violin plots and scatter plots (
nCount_RNAvsnFeature_RNA,nCount_RNAvspercent.mt). - Remove ambient RNA contamination:
- SoupX (R): estimate the soup fraction using the raw + filtered matrices, correct counts, output a corrected count matrix.
- CellBender (Python): run
cellbender remove-backgroundon the raw matrix; use GPU if available for speed.
- Detect doublets:
- Scrublet (Python/Scanpy): simulate doublets by combining random cell pairs; assign doublet scores per cell; threshold at bimodal score distribution.
- scDblFinder (R/Bioconductor): simulate doublets and classify with a random forest classifier; recommended for Seurat workflows.
- DoubletFinder (Seurat, R): requires a pre-clustered object; insert after a first round of clustering.
- Apply filtering thresholds to remove low-quality cells. Adjust thresholds based on tissue type and expected cell size (e.g., neurons have high UMI counts; platelets have very low gene counts). Use MAD-based adaptive thresholds if cell populations are heterogeneous.
- Report a cell retention summary: input cells, cells after ambient correction, cells after doublet removal, cells after threshold filtering.
- Save filtered AnnData (.h5ad) or Seurat object (.rds).
Output Contract
- Filtered count matrix as AnnData (.h5ad) or Seurat object (.rds)
- QC metric violin plots and scatter plots (PDF)
- Doublet score distribution and UMAP plot (PDF)
- Cell retention summary table (TSV): filter stage, cells retained, cells removed
Limits
- SoupX requires both raw and filtered matrices; CellBender corrects empty droplets more aggressively but requires GPU for practical runtime.
- Mitochondrial thresholds vary by tissue: brain neurons tolerate higher MT% (up to 30%), while immune cells are typically <10%.
- Doublet rates depend on loading density: ~0.8% per 1000 cells for 10x Chromium v3.
- Aggressive filtering on gene count can eliminate genuine rare cell types with low transcriptional activity (e.g., platelets, quiescent stem cells); inspect boundary cells carefully.
- CellBender is slow on CPU (several hours per sample); plan accordingly if no GPU is available.
- Common failure cases:
- SoupX fails if the raw matrix directory is missing or misnamed.
- Scrublet thresholding fails on unimodal score distributions (all scores similar); inspect the histogram and set threshold manually.
- Seurat object version mismatch when loading
.rdsfiles between Seurat v4 and v5.
Scan to join WeChat group