Back to Skills

single-cell-rna-qc

Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations. Use when users request QC analysis, filtering low-quality cells, assessing data quality, or following scverse/scanpy best practices for single-cell analysis.

23,064stars2,769forksUpdated 7/27/2026

Security Assessment

Safe(96/100)
Security Score96/100

About single-cell-rna-qc

single-cell-rna-qc performs automated quality control on single-cell RNA-seq data following scverse/scanpy best practices. It solves the common bioinformatics need to filter low-quality cells and assess dataset quality before downstream analysis, using MAD-based (median absolute deviation) outlier detection together with comprehensive before/after visualizations. It accepts .h5ad files (AnnData format from scanpy/Python workflows) and .h5 files (10X Genomics Cell Ranger output), auto-detecting the input format.

The skill offers two approaches. Approach 1 is a complete convenience pipeline (scripts/qc_analysis.py) that calculates QC metrics (count depth, gene detection, mitochondrial/ribosomal/hemoglobin content), applies permissive MAD-based filtering on counts/genes/MT%, filters lowly-detected genes, and generates before/after plots with threshold overlays. It exposes command-line parameters for output directory, per-metric MAD thresholds, a hard mitochondrial cutoff, gene filtering thresholds, and species-specific gene-name patterns, and writes a filtered dataset, a QC-annotated dataset, and PNG visualizations to a results directory. Approach 2 exposes modular building blocks from qc_core.py and qc_plotting.py (for example calculate_qc_metrics, detect_outliers_mad, filter_cells, plot_qc_distributions) for custom workflows such as applying different thresholds to cell subsets or running only metrics/visualization. It requires anndata, scanpy, scipy, matplotlib, seaborn, and numpy.

It targets computational biologists and bioinformaticians analyzing single-cell datasets who want a standards-aligned, "just works" QC step or reusable functions to embed in a larger pipeline. Use cases include standard QC on a new dataset, batch processing multiple datasets, exploratory quality assessment, and custom filtering logic (for example filtering neurons differently from other cells). It is distributed under the Apache License 2.0.

FAQ

What input formats are supported?

It supports .h5ad files (AnnData format from scanpy/Python workflows) and .h5 files (10X Genomics Cell Ranger output). The script automatically detects and loads the correct format.

What Python dependencies are required?

anndata, scanpy, scipy, matplotlib, seaborn, and numpy.

How does the filtering work?

It uses MAD-based (median absolute deviation) outlier detection on counts, genes, and mitochondrial percentage, plus an optional hard mitochondrial cutoff and a minimum-cells threshold for gene filtering. Thresholds and gene-name patterns are configurable via command-line parameters.

Can I customize the workflow instead of running the full pipeline?

Yes. Approach 2 exposes modular functions from qc_core.py and qc_plotting.py (calculate_qc_metrics, detect_outliers_mad, filter_cells, plot_qc_distributions) for custom logic, partial execution, or integration into a larger analysis pipeline.

What outputs does it produce?

A filtered dataset (<input>_filtered.h5ad), an annotated dataset preserving QC metrics (<input>_with_qc.h5ad), and PNG plots for pre-filtering metrics, MAD threshold overlays, and post-filtering metrics, saved to an <input>_qc_results/ directory by default.

All Files

6 files
LICENSE.txt10.0 KB
View
scripts/qc_core.py6.5 KB
View
references/scverse_qc_guidelines.md7.4 KB
View
scripts/qc_plotting.py8.3 KB
View
scripts/qc_analysis.py9.3 KB
View
SKILL.md7.8 KB
View

Install single-cell-rna-qc

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill