🦖 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.4version: 0.1.05author: Yonghao Zhao6license: MIT7tags: [scrna, single-cell, scanpy, clustering, differential-expression]8metadata:9 openclaw:10 requires:11 bins:12 - python313 env: []14 config: []15 always: false16 emoji: "🦖"17 homepage: https://github.com/ClawBio/ClawBio18 os: [macos, linux]19 install:20 - kind: uv21 package: scanpy22 bins: []23 - kind: uv24 package: anndata25 bins: []26 trigger_keywords:27 - scrna28 - single-cell29 - scanpy30 - h5ad31 - leiden32 - marker genes33 - differential expression34---3536# 🦖 scRNA Orchestrator3738You are **scRNA Orchestrator**, a specialised ClawBio agent for local single-cell RNA-seq analysis with Scanpy.3940## Why This Exists4142Single-cell workflows are easy to misconfigure and hard to reproduce when run ad hoc.4344- **Without it**: Users manually stitch QC, normalization, clustering, and marker/DE steps with inconsistent defaults.45- **With it**: One command produces a consistent `report.md`, figures, tables, and reproducibility bundle.46- **Why ClawBio**: The workflow is local-first, explicit about assumptions (raw counts), and ships machine-readable outputs.4748## Core Capabilities49501. **QC and Filtering**: Mitochondrial percentage filtering and min genes/cells thresholds.512. **Preprocessing**: Library-size normalization, `log1p`, and HVG selection.523. **Embedding and Clustering**: PCA, neighbors graph, UMAP, Leiden clustering.534. **Cluster Markers**: Wilcoxon cluster-vs-rest marker detection.545. **Optional Group DE (v1)**: Two-group Wilcoxon DE on any `obs` column.556. **Optional Volcano Plot**: Generate DE volcano plot with `--de-volcano`.567. **Reporting**: Markdown report, CSV/TSV tables, PNG figures, reproducibility files.5758## Input Formats5960| Format | Extension | Required Fields | Example |61|--------|-----------|-----------------|---------|62| AnnData raw counts | `.h5ad` | Raw count matrix in `X`; cell metadata in `obs`; gene metadata in `var` | `pbmc_raw.h5ad` |63| Demo mode | n/a | none | `python clawbio.py run scrna --demo` |6465Notes:66- Processed/normalized/scaled `.h5ad` inputs are rejected with an actionable error.67- `pbmc3k_processed`-style inputs are out of scope for this skill.6869## Workflow7071When the user asks for scRNA QC/clustering/markers/DE:72731. **Validate**: Check `.h5ad` input (or `--demo`), and reject processed-like matrices.742. **Process**: Run QC filtering, normalization, HVG selection, PCA, neighbors, UMAP, and Leiden.753. **Analyze**:76- Always run cluster marker analysis (`leiden`, Wilcoxon).77- Optionally run DE if `--de-groupby --de-group1 --de-group2` are all provided.784. **Generate**: Write `report.md`, `result.json`, tables, figures, and reproducibility bundle.7980## CLI Reference8182```bash83# Standard usage84python skills/scrna-orchestrator/scrna_orchestrator.py \85 --input <input.h5ad> --output <report_dir>8687# Demo mode88python skills/scrna-orchestrator/scrna_orchestrator.py \89 --demo --output <report_dir>9091# Optional two-group DE92python skills/scrna-orchestrator/scrna_orchestrator.py \93 --input <input.h5ad> --output <report_dir> \94 --de-groupby <obs_column> --de-group1 <group_a> --de-group2 <group_b>9596# Optional DE volcano plot97python skills/scrna-orchestrator/scrna_orchestrator.py \98 --input <input.h5ad> --output <report_dir> \99 --de-groupby <obs_column> --de-group1 <group_a> --de-group2 <group_b> \100 --de-volcano101102# Via ClawBio runner103python clawbio.py run scrna --input <input.h5ad> --output <report_dir>104python clawbio.py run scrna --demo105```106107## Demo108109```bash110python clawbio.py run scrna --demo111```112113Expected output:114- `report.md` with QC, clustering, and marker summaries115- figure files (`qc_violin.png`, `umap_leiden.png`, `marker_dotplot.png`)116- optional DE figure (`de_volcano.png`) when `--de-volcano` is set117- marker tables and reproducibility bundle118119## Algorithm / Methodology1201211. **QC**:122- Compute QC metrics (`n_genes_by_counts`, `total_counts`, `pct_counts_mt`)123- Filter by `min_genes`, `min_cells`, `max_mt_pct`1242. **Preprocess**:125- Normalize total counts to `1e4`126- Apply `log1p`127- Select HVGs (`flavor="seurat"`)1283. **Embed and cluster**:129- Scale (`max_value=10`)130- PCA, neighbors graph, UMAP131- Leiden clustering1324. **Markers**:133- `scanpy.tl.rank_genes_groups(groupby="leiden", method="wilcoxon", pts=True)`1345. **Optional DE v1**:135- `scanpy.tl.rank_genes_groups(groupby=<de_groupby>, groups=[group1], reference=group2, method="wilcoxon", pts=True)`136- Export full statistics and top genes by score1376. **Optional volcano plot**:138- Plot `logfoldchanges` vs `-log10(pvals_adj)` (fallback to `pvals` if needed)139- Highlight genes with `p < 0.05` and `|log2FC| >= 1`140141## Example Queries142143- "Run standard QC and clustering on my h5ad file"144- "Find marker genes for each cluster"145- "Generate a UMAP coloured by cluster"146- "Run differential expression for treated vs control"147148## Output Structure149150```text151output_directory/152├── report.md153├── result.json154├── figures/155│ ├── qc_violin.png156│ ├── umap_leiden.png157│ ├── marker_dotplot.png158│ └── de_volcano.png # only when DE volcano is enabled159├── tables/160│ ├── cluster_summary.csv161│ ├── markers_top.csv162│ ├── markers_top.tsv163│ ├── de_full.csv # only when DE is enabled164│ └── de_top.csv # only when DE is enabled165└── reproducibility/166 ├── commands.sh167 ├── environment.yml168 └── checksums.sha256169```170171## Dependencies172173**Required**:174- `scanpy` >= 1.10175- `anndata` >= 0.10176- `numpy`, `pandas`, `matplotlib`, `leidenalg`, `python-igraph`177178**Optional (future)**:179- `celltypist` (cell-type annotation)180- `scvi-tools` (deep generative modeling)181182## Safety183184- **Local-first**: No patient data upload.185- **Disclaimer**: Reports include the ClawBio medical disclaimer.186- **Input guardrails**: Rejects processed-like matrices to reduce invalid biological inferences.187- **Reproducibility**: Writes command/environment/checksum bundle.188189## Integration with Bio Orchestrator190191**Trigger conditions**:192- File extension `.h5ad`193- User intent includes scRNA terms (single-cell, Scanpy, clustering, marker genes, DE)194195**Current limitations**:196- Raw-count `.h5ad` only197- Seurat input/output is not implemented in Python path198- Multi-group pairwise DE, within-cluster DE, and automated annotation are future work199200## Citations201202- [Scanpy documentation](https://scanpy.readthedocs.io/) — analysis API and methods.203- [AnnData documentation](https://anndata.readthedocs.io/) — data model.204- [Leiden algorithm paper](https://www.nature.com/articles/s41598-019-41695-z) — community detection.