
scrna-seq-pipeline
Scanpy-based single-cell RNA-seq analysis pipeline covering loading (10X, h5ad), QC, normalization, HVG selection, PCA/UMAP, Leiden clustering, differential expression, and batch correction (Harmony, scVI). Use when the user mentions single-cell, scRNA-seq, Scanpy, AnnData, UMAP, clustering, 10X, h5ad, leiden, highly variable genes, Harmony, scVI, cluster cells, find marker genes, filter low-quality cells, gene expression matrix, doublet removal, normalize counts, dimensionality reduction, cell clustering, QC single-cell, filteredfeaturebcmatrix, cellranger output, 10X h5, scrublet, cell ranger, count matrix, find cell types, batch effect, integration, neighborhood graph, or differential expression genes.
- Installs
- 84
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/awslabs/hcls-agent-skills --skill scrna-seq-pipeline- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads scrna-seq-pipeline automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
scRNA-seq Pipeline (Scanpy)
Overview
This skill produces a reproducible scRNA-seq analysis in Python using Scanpy and AnnData. It covers the standard workflow: load counts → QC filter → normalize/log → HVG → scale/PCA → neighbors/UMAP → Leiden → differential expression, plus batch correction with Harmony or scVI. Default parameters follow the Scanpy PBMC3k tutorial conventions and are safe starting points for most 10X Genomics datasets.
Output is a single .h5ad file with all intermediate embeddings, cluster labels, and DE results stored on the AnnData object.
Usage
Install dependencies:
pip install "scanpy>=1.10" anndata leidenalg python-igraph harmonypy scvi-tools
Run the pipeline end-to-end:
import scanpy as sc
import scanpy.external as sce
sc.settings.verbosity = 2
sc.settings.set_figure_params(dpi=100, facecolor="white")
# 1. Load
adata = sc.read_10x_h5("filtered_feature_bc_matrix.h5")
# Alternatives:
# adata = sc.read_10x_mtx("filtered_feature_bc_matrix/", var_names="gene_symbols", cache=True)
# adata = sc.read_h5ad("input.h5ad")
adata.var_names_make_unique()
# 2. QC
adata.var["mt"] = adata.var_names.str.startswith("MT-")
sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], percent_top=None, log1p=False, inplace=True)
sc.pp.filter_cells(adata, min_genes=200)
sc.pp.filter_genes(adata, min_cells=3)
adata = adata[adata.obs.n_genes_by_counts < 5000, :]
adata = adata[adata.obs.pct_counts_mt < 20, :].copy()
# 3. Normalize + HVG
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
adata.raw = adata # freeze log-normalized full gene set BEFORE HVG subset
sc.pp.highly_variable_genes(adata, n_top_genes=2000, flavor="seurat")
adata = adata[:, adata.var.highly_variable].copy()
# 4. Scale + PCA + neighbors + UMAP + Leiden
sc.pp.scale(adata, max_value=10)
sc.tl.pca(adata, n_comps=50, svd_solver="arpack")
sc.pp.neighbors(adata, n_neighbors=15, n_pcs=30)
sc.tl.umap(adata)
sc.tl.leiden(adata, resolution=0.5)
# 5. Differential expression per cluster
sc.tl.rank_genes_groups(adata, groupby="leiden", method="wilcoxon")
# 6. Save
adata.write("result.h5ad", compression="gzip")
Batch correction — Harmony
# Assumes adata.obs["batch"] exists and PCA is already computed.
sce.pp.harmony_integrate(adata, key="batch") # writes adata.obsm["X_pca_harmony"]
sc.pp.neighbors(adata, n_neighbors=15, n_pcs=30, use_rep="X_pca_harmony")
sc.tl.umap(adata)
sc.tl.leiden(adata, resolution=0.5)
Batch correction — scVI
scVI requires raw counts. Run it before normalization, or keep a raw-count layer.
import scvi
# adata_raw holds unnormalized integer counts; adata.obs["batch"] is the batch key.
scvi.model.SCVI.setup_anndata(adata_raw, batch_key="batch")
model = scvi.model.SCVI(adata_raw, n_latent=30)
model.train(max_epochs=400, early_stopping=True)
adata.obsm["X_scVI"] = model.get_latent_representation()
sc.pp.neighbors(adata, n_neighbors=15, use_rep="X_scVI")
sc.tl.umap(adata)
sc.tl.leiden(adata, resolution=0.5)
Response Format
- Lead with the command or code the user needs — explain after
- Structure as: confirm inputs → working code → key parameters explained → gotchas
- One complete working example per task; do not show every alternative
- Keep code comments minimal and functional (what, not why-it-exists)
- Target: 50-100 lines of code with brief surrounding explanation
Core Concepts
- AnnData layout.
adata.Xis the current expression matrix (cells × genes).adata.obsholds per-cell metadata (QC metrics, cluster labels, batch).adata.varholds per-gene metadata (HVG flags,mt). Embeddings live inadata.obsm(X_pca,X_umap,X_scVI). Neighbor graph and DE results live inadata.uns. .rawsnapshot.adata.raw = adatastores the full log-normalized matrix before HVG subsetting. Downstream plotting functions (sc.pl.umap(..., color="GENE"),sc.pl.rank_genes_groups) read from.rawso you can visualize any gene even after restrictingadatato HVGs.- QC thresholds are dataset-dependent.
n_genes ∈ [200, 5000]andpct_mt < 20are reasonable defaults for human 10X PBMC-like data. Inspect distributions (sc.pl.violin) before committing. UseMT-for human andmt-for mouse. - HVG flavor matters. Use
flavor="seurat"on log-normalized data (default). Useflavor="seurat_v3"on raw counts — it expects integer counts and will error or mislead on log data. - Neighbors parameters.
n_neighborscontrols local/global structure (10–50; larger = smoother UMAP).n_pcsshould capture the elbow insc.pl.pca_variance_ratio(typically 20–50). Leidenresolutioncontrols cluster granularity (0.2–1.5; higher = more clusters). - Batch correction choice. Harmony is fast, operates on PCA, and works well for mild-to-moderate batch effects. scVI is a deep generative model, needs raw counts and GPU for speed, and handles stronger technical variation and multi-modal designs.
Quick Reference
Loading
| Input | Call |
|---|---|
| 10X HDF5 | sc.read_10x_h5("filtered_feature_bc_matrix.h5") |
| 10X MTX dir | sc.read_10x_mtx("path/", var_names="gene_symbols", cache=True) |
| Existing AnnData | sc.read_h5ad("input.h5ad") |
| Always after load | adata.var_names_make_unique() |
Key parameter ranges
| Parameter | Default | Typical range | Notes |
|---|---|---|---|
filter_cells(min_genes=) | 200 | 100–500 | Drop empty/low-quality droplets |
filter_genes(min_cells=) | 3 | 3–10 | Drop rarely-expressed genes |
n_genes_by_counts < | 5000 | 2500–8000 | Upper bound flags doublets |
pct_counts_mt < | 20 | 5–25 | Human tissue dependent |
normalize_total(target_sum=) | 1e4 | 1e4 | CP10k; standard |
n_top_genes (HVG) | 2000 | 1000–5000 | More HVGs → more signal + noise |
scale(max_value=) | 10 | 10 | Clip extreme z-scores |
pca(n_comps=) | 50 | 30–100 | Pick elbow for downstream n_pcs |
neighbors(n_neighbors=) | 15 | 10–50 | Larger → smoother manifold |
neighbors(n_pcs=) | 30 | 20–50 | ≤ n_comps |
leiden(resolution=) | 0.5 | 0.2–1.5 | Higher → more clusters |
DE & inspection
sc.tl.rank_genes_groups(adata, groupby="leiden", method="wilcoxon")
sc.pl.rank_genes_groups(adata, n_genes=25, sharey=False)
# Top-N markers per cluster as a DataFrame
import pandas as pd
result = adata.uns["rank_genes_groups"]
groups = result["names"].dtype.names
markers = pd.DataFrame({g: result["names"][g][:20] for g in groups})
Saving / loading
adata.write("result.h5ad", compression="gzip")
adata = sc.read_h5ad("result.h5ad")
Common Mistakes
-
Wrong: Subsetting to HVGs before saving
adata.raw = adataRight: Always set.rawon the log-normalized full matrix beforeadata = adata[:, adata.var.highly_variable].copy()Why: Without.raw, you lose the ability to plot or score non-HVG genes in downstream analysis -
Wrong: Using
flavor="seurat_v3"on log-normalized data Right: Match HVG flavor to data state:seurat_v3requires raw integer counts;seurat(default) requires log-normalized data Why: Wrong flavor produces nonsense HVG rankings or errors, corrupting all downstream steps -
Wrong: Skipping
adata.var_names_make_unique()after loading 10X data Right: Calladata.var_names_make_unique()immediately after loading Why: Duplicated gene symbols cause silent misbehavior in indexing, HVG selection, and DE analysis -
Wrong: Running scVI on normalized/log-transformed data Right: Feed scVI the raw-count AnnData and set
batch_keyviasetup_anndataWhy: scVI models counts directly; normalized input violates its distributional assumptions and produces incorrect latent spaces -
Wrong: Using
MT-prefix for mouse mitochondrial genes (ormt-for human) Right: UseMT-for human genes andmt-for mouse genes Why: Wrong prefix makespct_counts_mtalways zero, rendering the QC filter a no-op -
Wrong: Boolean-slicing AnnData without calling
.copy()Right: Always use.copy()after filtering:adata = adata[mask, :].copy()Why: Without.copy(), the result is a view; subsequent in-place operations will warn or fail
References
- Scanpy: Wolf et al. Genome Biol 2018, https://doi.org/10.1186/s13059-017-1382-0
- Scanpy tutorials: https://scanpy.readthedocs.io/en/stable/tutorials.html
- scVI: Gayoso et al. Nat Biotechnol 2022, https://doi.org/10.1038/s41587-021-01206-w
- Harmony: Korsunsky et al. Nat Methods 2019, https://doi.org/10.1038/s41592-019-0619-0
FAQ
What does the scrna-seq-pipeline skill do?
Scanpy-based single-cell RNA-seq analysis pipeline covering loading (10X, h5ad), QC, normalization, HVG selection, PCA/UMAP, Leiden clustering, differential expression, and batch correction (Harmony, scVI). Use when the user mentions single-cell, scRNA-seq, Scanpy, AnnData, UMAP, clustering, 10X, h5ad, leiden, highly variable genes, Harmony, scVI, cluster cells, find marker genes, filter low-quality cells, gene expression matrix, doublet removal, normalize counts, dimensionality reduction, cell clustering, QC single-cell, filteredfeaturebcmatrix, cellranger output, 10X h5, scrublet, cell ranger, count matrix, find cell types, batch effect, integration, neighborhood graph, or differential expression genes.
How do I install scrna-seq-pipeline?
Run npx skills add https://github.com/awslabs/hcls-agent-skills --skill scrna-seq-pipeline in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/scrna-seq-pipeline/ (personal) or .claude/skills/scrna-seq-pipeline/ (project).
Which AI agents can use scrna-seq-pipeline?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is scrna-seq-pipeline safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains scrna-seq-pipeline?
It is published by awslabs in awslabs/hcls-agent-skills. It has 84 recorded installs.
More from awslabs/hcls-agent-skills
ml-researcher
awslabs/hcls-agent-skills
Reason about ML experiment design for healthcare and life sciences data. Use when the user asks to design an ML study, choose a model for clinical/biomedical data, set up cross-validation, pick evaluation metrics, audit fairness, plan a regulatory submission, or critique an ML pipeline on EHR, medical imaging, genomics, molecules, or clinical text. Triggers include "design an ML experiment", "which model for this clinical data", "how should I split", "nested CV", "class imbalance", "AUROC vs AUPRC", "calibration", "decision curve", "net benefit", "TRIPOD+AI", "PROBAST", "CLAIM", "FDA SaMD", "PCCP", "GMLP", "site generalization", "temporal leakage", "scaffold split", "foundation model evaluation", "subgroup fairness", "is this model ready for deployment".
clinical-data-standards
awslabs/hcls-agent-skills
Reason about clinical data terminology standards — MedDRA hierarchy (LLT→PT→HLT→HLGT→SOC), ICD-10 code structure and grouping, SNOMED CT concept model, LOINC panel relationships, and mapping decisions between systems. Use when the user asks to code adverse events, map diagnoses to ICD-10, choose a coding granularity level, group AEs by SOC or PT, interpret SNOMED CT relationships, select LOINC codes for lab panels, convert between terminology systems, or decide when to aggregate at HLT vs PT level. Triggers include "MedDRA coding", "ICD-10 grouping", "SNOMED CT", "LOINC panel", "adverse event coding", "terminology mapping", "SOC table", "preferred term", "code hierarchy", "clinical coding", "AE frequency table", "diagnosis grouping", "lab code selection", "cross-walk between terminologies".
dicom-processing
awslabs/hcls-agent-skills
DICOM and NIfTI medical image processing pipeline. Triggers on DICOM, NIfTI, dcm2niix, de-identification, pydicom, DICOM header, conversion, anonymization, BIDS, DICOM tags, medical image format conversion, "DICOM to NIfTI", "burned-in PHI", "SeriesInstanceUID", "nibabel", "DICOM anonymization".
medical-device-software-compliance
awslabs/hcls-agent-skills
Reason about SaMD (Software as a Medical Device) regulatory compliance for FDA, EU MDR, and global submissions. Use when the user asks about IEC 62304 safety classification, ISO 14971 risk management, 21 CFR 820/QMSR quality system requirements, Design History File structure, 510(k)/De Novo/PMA pathway selection, SOUP/OTS assessment, verification and validation planning, cybersecurity for medical devices, PCCP for AI/ML devices, design reviews, traceability matrices, or post-market surveillance. Triggers include "SaMD", "medical device software", "IEC 62304", "ISO 14971", "ISO 13485", "21 CFR 820", "QMSR", "510(k)", "De Novo", "PMA", "design history file", "DHF", "software safety classification", "SOUP list", "risk management", "hazard analysis", "design review", "V&V protocol", "FDA submission", "EU MDR", "clinical evaluation", "PCCP", "predetermined change control", "GMLP", "cybersecurity premarket", "Part 11", "design controls", "design inputs", "design outputs", "traceability matri
radiology-preprocessing
awslabs/hcls-agent-skills
Structural MRI/CT preprocessing pipeline for radiology workflows covering skull stripping, bias field correction, registration, and intensity normalization. Triggers on skull stripping, bias correction, registration, ANTs, FSL, HD-BET, N4, brain extraction, normalization, FLIRT, FNIRT, SyN, fslreorient2std, MNI registration, T1 preprocessing.
edc-data-validation
awslabs/hcls-agent-skills
Generate code for EDC export validation, clinical data range checks, cross-form consistency checks, SDTM structure validation, controlled terminology verification, and define.xml generation. Use when the user asks to validate clinical trial data exports, check vital sign or lab value ranges, verify AE date consistency, validate SDTM datasets against CDISC rules, generate define.xml, or build an automated data review pipeline. Triggers include "EDC validation", "range check clinical data", "cross-form consistency", "SDTM validation", "controlled terminology check", "define.xml generation", "Medidata Rave export", "Oracle InForm", "Veeva Vault CDMS", "clinical data cleaning", "edit check", "data query", "SDTM structure check", "lab range check", "vital signs validation", "AE date check", "protocol deviation detection", "OpenCDISC", "Pinnacles 21", "P21 validation".
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available