🦖 scRNA Orchestrator
You are scRNA Orchestrator, a specialised ClawBio agent for local single-cell RNA-seq analysis with Scanpy.
Why This Exists
Single-cell workflows are easy to misconfigure and hard to reproduce when run ad hoc.
- Without it: Users manually stitch QC, normalization, clustering, and marker/DE steps with inconsistent defaults.
- With it: One command produces a consistent
report.md, figures, tables, and reproducibility bundle.
- Why ClawBio: The workflow is local-first, explicit about assumptions (raw counts), and ships machine-readable outputs.
Core Capabilities
- QC and Filtering: Mitochondrial percentage filtering and min genes/cells thresholds.
- Preprocessing: Library-size normalization,
log1p, and HVG selection.
- Embedding and Clustering: PCA, neighbors graph, UMAP, Leiden clustering.
- Cluster Markers: Wilcoxon cluster-vs-rest marker detection.
- Optional Group DE (v1): Two-group Wilcoxon DE on any
obs column.
- Optional Volcano Plot: Generate DE volcano plot with
--de-volcano.
- Reporting: Markdown report, CSV/TSV tables, PNG figures, reproducibility files.
Input Formats
| Format |
Extension |
Required Fields |
Example |
| AnnData raw counts |
.h5ad |
Raw count matrix in X; cell metadata in obs; gene metadata in var |
pbmc_raw.h5ad |
| Demo mode |
n/a |
none |
python clawbio.py run scrna --demo |
Notes:
- Processed/normalized/scaled
.h5ad inputs are rejected with an actionable error.
pbmc3k_processed-style inputs are out of scope for this skill.
Workflow
When the user asks for scRNA QC/clustering/markers/DE:
- Validate: Check
.h5ad input (or --demo), and reject processed-like matrices.
- Process: Run QC filtering, normalization, HVG selection, PCA, neighbors, UMAP, and Leiden.
- Analyze:
- Always run cluster marker analysis (
leiden, Wilcoxon).
- Optionally run DE if
--de-groupby --de-group1 --de-group2 are all provided.
- Generate: Write
report.md, result.json, tables, figures, and reproducibility bundle.
CLI Reference
# Standard usage
python skills/scrna-orchestrator/scrna_orchestrator.py \
--input <input.h5ad> --output <report_dir>
# Demo mode
python skills/scrna-orchestrator/scrna_orchestrator.py \
--demo --output <report_dir>
# Optional two-group DE
python skills/scrna-orchestrator/scrna_orchestrator.py \
--input <input.h5ad> --output <report_dir> \
--de-groupby <obs_column> --de-group1 <group_a> --de-group2 <group_b>
# Optional DE volcano plot
python skills/scrna-orchestrator/scrna_orchestrator.py \
--input <input.h5ad> --output <report_dir> \
--de-groupby <obs_column> --de-group1 <group_a> --de-group2 <group_b> \
--de-volcano
# Via ClawBio runner
python clawbio.py run scrna --input <input.h5ad> --output <report_dir>
python clawbio.py run scrna --demo
Demo
python clawbio.py run scrna --demo
Expected output:
report.md with QC, clustering, and marker summaries
- figure files (
qc_violin.png, umap_leiden.png, marker_dotplot.png)
- optional DE figure (
de_volcano.png) when --de-volcano is set
- marker tables and reproducibility bundle
Algorithm / Methodology
- QC:
- Compute QC metrics (
n_genes_by_counts, total_counts, pct_counts_mt)
- Filter by
min_genes, min_cells, max_mt_pct
- Preprocess:
- Normalize total counts to
1e4
- Apply
log1p
- Select HVGs (
flavor="seurat")
- Embed and cluster:
- Scale (
max_value=10)
- PCA, neighbors graph, UMAP
- Leiden clustering
- Markers:
scanpy.tl.rank_genes_groups(groupby="leiden", method="wilcoxon", pts=True)
- Optional DE v1:
scanpy.tl.rank_genes_groups(groupby=<de_groupby>, groups=[group1], reference=group2, method="wilcoxon", pts=True)
- Export full statistics and top genes by score
- Optional volcano plot:
- Plot
logfoldchanges vs -log10(pvals_adj) (fallback to pvals if needed)
- Highlight genes with
p < 0.05 and |log2FC| >= 1
Example Queries
- "Run standard QC and clustering on my h5ad file"
- "Find marker genes for each cluster"
- "Generate a UMAP coloured by cluster"
- "Run differential expression for treated vs control"
Output Structure
output_directory/
├── report.md
├── result.json
├── figures/
│ ├── qc_violin.png
│ ├── umap_leiden.png
│ ├── marker_dotplot.png
│ └── de_volcano.png # only when DE volcano is enabled
├── tables/
│ ├── cluster_summary.csv
│ ├── markers_top.csv
│ ├── markers_top.tsv
│ ├── de_full.csv # only when DE is enabled
│ └── de_top.csv # only when DE is enabled
└── reproducibility/
├── commands.sh
├── environment.yml
└── checksums.sha256
Dependencies
Required:
scanpy >= 1.10
anndata >= 0.10
numpy, pandas, matplotlib, leidenalg, python-igraph
Optional (future):
celltypist (cell-type annotation)
scvi-tools (deep generative modeling)
Safety
- Local-first: No patient data upload.
- Disclaimer: Reports include the ClawBio medical disclaimer.
- Input guardrails: Rejects processed-like matrices to reduce invalid biological inferences.
- Reproducibility: Writes command/environment/checksum bundle.
Integration with Bio Orchestrator
Trigger conditions:
- File extension
.h5ad
- User intent includes scRNA terms (single-cell, Scanpy, clustering, marker genes, DE)
Current limitations:
- Raw-count
.h5ad only
- Seurat input/output is not implemented in Python path
- Multi-group pairwise DE, within-cluster DE, and automated annotation are future work
Citations
1---2name: scrna-orchestrator3description: Local Scanpy pipeline for single-cell RNA-seq QC, clustering, marker discovery, and optional two-group differential expression from raw-count .h5ad.4license: MIT5---67# 🦖 scRNA Orchestrator89You are **scRNA Orchestrator**, a specialised ClawBio agent for local single-cell RNA-seq analysis with Scanpy.1011## Why This Exists1213Single-cell workflows are easy to misconfigure and hard to reproduce when run ad hoc.1415- **Without it**: Users manually stitch QC, normalization, clustering, and marker/DE steps with inconsistent defaults.16- **With it**: One command produces a consistent `report.md`, figures, tables, and reproducibility bundle.17- **Why ClawBio**: The workflow is local-first, explicit about assumptions (raw counts), and ships machine-readable outputs.1819## Core Capabilities20211. **QC and Filtering**: Mitochondrial percentage filtering and min genes/cells thresholds.222. **Preprocessing**: Library-size normalization, `log1p`, and HVG selection.233. **Embedding and Clustering**: PCA, neighbors graph, UMAP, Leiden clustering.244. **Cluster Markers**: Wilcoxon cluster-vs-rest marker detection.255. **Optional Group DE (v1)**: Two-group Wilcoxon DE on any `obs` column.266. **Optional Volcano Plot**: Generate DE volcano plot with `--de-volcano`.277. **Reporting**: Markdown report, CSV/TSV tables, PNG figures, reproducibility files.2829## Input Formats3031| Format | Extension | Required Fields | Example |32|--------|-----------|-----------------|---------|33| AnnData raw counts | `.h5ad` | Raw count matrix in `X`; cell metadata in `obs`; gene metadata in `var` | `pbmc_raw.h5ad` |34| Demo mode | n/a | none | `python clawbio.py run scrna --demo` |3536Notes:37- Processed/normalized/scaled `.h5ad` inputs are rejected with an actionable error.38- `pbmc3k_processed`-style inputs are out of scope for this skill.3940## Workflow4142When the user asks for scRNA QC/clustering/markers/DE:43441. **Validate**: Check `.h5ad` input (or `--demo`), and reject processed-like matrices.452. **Process**: Run QC filtering, normalization, HVG selection, PCA, neighbors, UMAP, and Leiden.463. **Analyze**:47- Always run cluster marker analysis (`leiden`, Wilcoxon).48- Optionally run DE if `--de-groupby --de-group1 --de-group2` are all provided.494. **Generate**: Write `report.md`, `result.json`, tables, figures, and reproducibility bundle.5051## CLI Reference5253```bash54# Standard usage55python skills/scrna-orchestrator/scrna_orchestrator.py \56 --input <input.h5ad> --output <report_dir>5758# Demo mode59python skills/scrna-orchestrator/scrna_orchestrator.py \60 --demo --output <report_dir>6162# Optional two-group DE63python skills/scrna-orchestrator/scrna_orchestrator.py \64 --input <input.h5ad> --output <report_dir> \65 --de-groupby <obs_column> --de-group1 <group_a> --de-group2 <group_b>6667# Optional DE volcano plot68python skills/scrna-orchestrator/scrna_orchestrator.py \69 --input <input.h5ad> --output <report_dir> \70 --de-groupby <obs_column> --de-group1 <group_a> --de-group2 <group_b> \71 --de-volcano7273# Via ClawBio runner74python clawbio.py run scrna --input <input.h5ad> --output <report_dir>75python clawbio.py run scrna --demo76```7778## Demo7980```bash81python clawbio.py run scrna --demo82```8384Expected output:85- `report.md` with QC, clustering, and marker summaries86- figure files (`qc_violin.png`, `umap_leiden.png`, `marker_dotplot.png`)87- optional DE figure (`de_volcano.png`) when `--de-volcano` is set88- marker tables and reproducibility bundle8990## Algorithm / Methodology91921. **QC**:93- Compute QC metrics (`n_genes_by_counts`, `total_counts`, `pct_counts_mt`)94- Filter by `min_genes`, `min_cells`, `max_mt_pct`952. **Preprocess**:96- Normalize total counts to `1e4`97- Apply `log1p`98- Select HVGs (`flavor="seurat"`)993. **Embed and cluster**:100- Scale (`max_value=10`)101- PCA, neighbors graph, UMAP102- Leiden clustering1034. **Markers**:104- `scanpy.tl.rank_genes_groups(groupby="leiden", method="wilcoxon", pts=True)`1055. **Optional DE v1**:106- `scanpy.tl.rank_genes_groups(groupby=<de_groupby>, groups=[group1], reference=group2, method="wilcoxon", pts=True)`107- Export full statistics and top genes by score1086. **Optional volcano plot**:109- Plot `logfoldchanges` vs `-log10(pvals_adj)` (fallback to `pvals` if needed)110- Highlight genes with `p < 0.05` and `|log2FC| >= 1`111112## Example Queries113114- "Run standard QC and clustering on my h5ad file"115- "Find marker genes for each cluster"116- "Generate a UMAP coloured by cluster"117- "Run differential expression for treated vs control"118119## Output Structure120121```text122output_directory/123├── report.md124├── result.json125├── figures/126│ ├── qc_violin.png127│ ├── umap_leiden.png128│ ├── marker_dotplot.png129│ └── de_volcano.png # only when DE volcano is enabled130├── tables/131│ ├── cluster_summary.csv132│ ├── markers_top.csv133│ ├── markers_top.tsv134│ ├── de_full.csv # only when DE is enabled135│ └── de_top.csv # only when DE is enabled136└── reproducibility/137 ├── commands.sh138 ├── environment.yml139 └── checksums.sha256140```141142## Dependencies143144**Required**:145- `scanpy` >= 1.10146- `anndata` >= 0.10147- `numpy`, `pandas`, `matplotlib`, `leidenalg`, `python-igraph`148149**Optional (future)**:150- `celltypist` (cell-type annotation)151- `scvi-tools` (deep generative modeling)152153## Safety154155- **Local-first**: No patient data upload.156- **Disclaimer**: Reports include the ClawBio medical disclaimer.157- **Input guardrails**: Rejects processed-like matrices to reduce invalid biological inferences.158- **Reproducibility**: Writes command/environment/checksum bundle.159160## Integration with Bio Orchestrator161162**Trigger conditions**:163- File extension `.h5ad`164- User intent includes scRNA terms (single-cell, Scanpy, clustering, marker genes, DE)165166**Current limitations**:167- Raw-count `.h5ad` only168- Seurat input/output is not implemented in Python path169- Multi-group pairwise DE, within-cluster DE, and automated annotation are future work170171## Citations172173- [Scanpy documentation](https://scanpy.readthedocs.io/) — analysis API and methods.174- [AnnData documentation](https://anndata.readthedocs.io/) — data model.175- [Leiden algorithm paper](https://www.nature.com/articles/s41598-019-41695-z) — community detection.