/clawbio:spatial-transcriptomicsfrom clawbio
Analyzes 10x Visium spatial transcriptomics data from SpaceRanger outs/ or spatial h5ad files. Runs QC, Leiden clustering, Wilcoxon marker genes, Moran's I spatial autocorrelation, neighborhood enrichment, and spot co-occurrence, outputting a local report.
Ships in clawbio. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are spatial-transcriptomics, a ClawBio agent that analyses measured 10x Visium data. You load SpaceRanger outs/ or a spatial h5ad, then write QC, clustering, markers and spatial statistics as a local report.
Fire this skill when the user says any of:
Do NOT fire when:
deepspot-m.obsm['spatial']). That is scrna-orchestrator.marker-dominance-mapper.--demo and no reproducibility bundle.outs/ into a report with Leiden, Wilcoxon markers, Moran's I, neighbourhood enrichment and co-occurrence.deepspot-m, which predicts expression from histology; this skill analyses expression that was measured.outs/ (filtered_feature_bc_matrix/ + spatial/) or h5ad with obsm['spatial'].One skill, one task. Measured Visium-like spot data in, one analysis report out. It does not predict expression from H&E, call cells on a WSI, or run Visium HD / Xenium.
| Format | Extension | Required Fields | Example |
|---|---|---|---|
| SpaceRanger outs | directory | filtered_feature_bc_matrix/ mtx + spatial/tissue_positions.csv | sample/outs |
| Spatial AnnData | .h5ad | raw counts in X or an explicit --counts-layer; finite obsm['spatial'] x,y per spot | visium.h5ad |
| Demo | n/a | none | --demo |
HDF5 filtered_feature_bc_matrix.h5 is not read in v0.1; pass the mtx folder. Tissue images are not required.
Counts must be finite, nonnegative integers. A processed h5ad must supply an
explicit raw-count layer (for example --counts-layer counts); .raw is not
assumed to contain counts. Normalised/log-transformed X is rejected. Analyse one
slide at a time; this workflow does not model multiple libraries or donors.
outs/, raw-count spatial h5ad, or --demo. Validate counts and finite two-dimensional coordinates. Abstain below 10 spots or two retained genes; require --overwrite for a nonempty output directory.min_genes, min_cells and optional max_pct_mt; normalise to 1e4, log1p, HVGs, PCA, expression neighbours, UMAP and Leiden.obsm['spatial'] (not the PCA graph).spatial_autocorr).nhood_enrichment).report.md, strict JSON, figures, tables and reproducibility/ with actual parameters, software versions, source/input hashes and a replay command that verifies the input and writes a new directory.Steps 1–7 are prescriptive. Report narrative is flexible.
python skills/spatial-transcriptomics/spatial_transcriptomics.py \
--input sample/outs --output /tmp/visium_out
python skills/spatial-transcriptomics/spatial_transcriptomics.py \
--input visium.h5ad --output /tmp/visium_out
python skills/spatial-transcriptomics/spatial_transcriptomics.py \
--demo --output /tmp/spatial_demo
python clawbio.py run spatial --input sample/outs --output /tmp/visium_out
python clawbio.py run spatial --demo
# A processed h5ad with a preserved raw-count layer:
python clawbio.py run spatial --input processed.h5ad --counts-layer counts \
--n-pcs 30 --n-neighbors 15 --nhood-perms 1000 --output /tmp/visium_review
| Flag | Default | Purpose |
|---|---|---|
--min-genes | 5 | Drop spots with fewer genes |
--min-cells | 1 | Drop genes in fewer spots |
--leiden-resolution | 0.5 | Leiden resolution |
--n-top-hvg | 2000 | Highly variable genes (capped at the gene count) |
--random-state | 7 | PCA / neighbours / Leiden / permutations |
--n-pcs | 8 | PCA components, capped by spots and selected genes |
--n-neighbors | 8 | Expression graph neighbours; spatial k stays 6 |
--nhood-perms | 50 | Label permutations for exploratory neighbourhood z-scores |
--top-markers | 5 | Reported markers per supported cluster |
--max-pct-mt | none | Optional mitochondrial percentage ceiling (0–100) |
--counts-layer | none | Explicit raw-count layer for h5ad |
--overwrite | false | Explicitly replace report files in a nonempty directory |
--expected-input-sha256 | none | Replay integrity check before analysis |
python clawbio.py run spatial --demo
Expected output: 64-spot synthetic grid, two spatial domains, Leiden ≥ 2, EPCAM/COL1A1 among high Moran's I genes, figures, tables, reproducibility bundle. No download.
scanpy.read_10x_mtx plus tissue_positions.csv (or tissue_positions_list.csv); keep in_tissue==1.calculate_qc_metrics(percent_top=None), min detected genes, positive total counts, optional mitochondrial ceiling and filter_genes(min_cells). Mitochondrial genes match case-insensitive MT-; absence of such symbols is reported as unavailable mitochondrial QC.normalize_total(1e4), log1p. Raw counts kept in layers["counts"].use_rep="X_pca" neighbours, UMAP, Leiden (flavor="igraph" when Scanpy accepts it). Requested and effective embedding dimensions are recorded.NearestNeighbors on coordinates, k=6, self excluded.null in JSON, blank in CSV, NA in the report).(0, r]. Unsupported ratios are undefined.Above 80 post-QC genes, both Moran and Wilcoxon evaluate HVGs only;
otherwise every retained gene is evaluated. result.json.analysis_scope records
the exact tested gene names and count. A gene missing from the Moran table has
not been evaluated, and cannot be called spatially neutral. Moran is a descriptive
statistic with no permutation p-value or multiple-testing correction. Constant
genes have undefined Moran's I, represented as null/blank/NA.
Key thresholds:
--nhood-perms)# Spatial Transcriptomics Report (demo)
**Spots**: 64
**Leiden clusters**: 2
## Spatially variable genes (Moran's I)
| Gene | Moran's I |
|------|-----------|
| DCN | 0.745 |
| VIM | 0.639 |
output_directory/
├── report.md
├── result.json
├── figures/
│ ├── umap_leiden.png
│ ├── spatial_leiden.png
│ ├── marker_heatmap.png # optional when no valid cluster-vs-rest markers exist
│ └── qc_spot_metrics.png
├── tables/
│ ├── markers_top.csv
│ ├── moran_i.csv
│ ├── nhood_enrichment.csv
│ ├── co_occurrence.csv
│ ├── qc_spot_metrics.csv
│ └── qc_summary.csv
└── reproducibility/
├── commands.sh
├── environment.yml
├── checksums.sha256
└── run_manifest.json
Required:
scanpy >= 1.10; QC, HVG, PCA, UMAP, Leiden, Wilcoxonleidenalg >= 0.10; Leidennumpy, pandas, matplotlib, scikit-learn, scipy; spatial graph, stats, figuresNot required:
squidpy. Its SpatialData/Dask/OME-Zarr dependency chain can pull S3 dependencies into every uv sync --all-extras job. Runtime estimators are implemented locally. Co-occurrence follows the explicitly cited 1.6.0 cumulative-radius definition, not the annular 1.4 definition; automatic graph/radius construction and random streams are not claimed to be interchangeable.deepspot-m.--demo is an 8×8 synthetic grid.filtered_feature_bc_matrix/ directory..raw attribute is not proof of raw counts.commands.sh writes to replay/ or $REPLAY_OUTPUT, verifies $INPUT_PATH against the recorded digest, and preserves all analysis parameters.analysis_scope; HVG screening omits untested genes.--demo does not download a Visium dataset.reproducibility/commands.sh, environment.yml, checksums.sha256 via clawbio.common.reproducibility.# Default tests and demo are offline. Live-test failures are failures when opted in.
uv run --extra spatial --with pytest pytest skills/spatial-transcriptomics/tests/ -m 'not network'
CLAWBIO_RUN_PUBLIC_VISIUM=1 uv run --extra spatial --with pytest \
pytest skills/spatial-transcriptomics/tests/ -m network
# On a compatible machine, install the recorded environment and use the same source.
cd /path/to/output
sha256sum -c reproducibility/checksums.sha256
INPUT_PATH=/path/to/original/outs REPLAY_OUTPUT=/tmp/visium_replay \
bash reproducibility/commands.sh
The environment file pins the installed analysis dependency closure and Python version; the manifest records the platform and source hashes. Cross-platform bitwise numerical identity is not promised. The public integration test uses 400 measured spots for runtime; full-slide validation is a separate explicit run.
See the full-slide validation record.
The offline Squidpy 1.6 fixture was
generated in a separate pinned environment using the adjacent regeneration
script. It checks co-occurrence at explicit radii, Moran on an explicit graph,
and observed neighbourhood counts. It does not assert identical permutation
z-scores across different random streams. Undefined ratios use null here
instead of Squidpy's zero convention.
The agent dispatches and explains. The Python skill loads data, runs Scanpy and the spatial estimators, and writes files. The agent must not invent Moran's I, relabel clusters, or present demo values as a patient sample.
Trigger conditions: Visium, SpaceRanger outs/, spatially variable genes, Moran's I, neighbourhood enrichment, spot co-occurrence.
Chaining partners:
deepspot-m: complementary. Predicted per-tile expression is not a Visium outs/ tree; do not pipe it here without building a spatial AnnData first.scrna-orchestrator: dissociated scRNA-seq without coordinates.marker-dominance-mapper: downstream if you export a marker-by-spot table.flavor="igraph") and 10x position CSV headers each quarter.rank_genes_groups Wilcoxon, a request for Visium HD / Xenium.examples/demo_spec.json (opens in a new tab)examples/public_visium_validation.md (opens in a new tab)fixtures/generate_squidpy_v1_6_fixture.py (opens in a new tab)fixtures/squidpy_v1_6_co_occurrence.json (opens in a new tab)spatial_report.py (opens in a new tab)spatial_stats.py (opens in a new tab)spatial_transcriptomics.py (opens in a new tab)tests/test_spatial_regressions.py (opens in a new tab)tests/test_spatial_report.py (opens in a new tab)tests/test_spatial_stats.py (opens in a new tab)tests/test_spatial_transcriptomics.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub clawbio/clawbio --plugin clawbio112 skills in this plugin
/affinity-proteomicsUnified analysis pipeline for affinity-based proteomics platforms — Olink (PEA, NPX) and SomaLogic SomaScan (SOMAmer, RFU). Platform-aware QC, normalisation, differential abundance, volcano plots, heatmaps, and PCA./analyze-fastaAnalyze a single FASTA file (nucleotide or protein), compute sequence-level metrics (GC, ORFs, MW, pI, GRAVY, secondary-structure fractions) with Biopython, and write a Markdown report plus structured JSON for downstream chaining./ancestry-risk-profilerInfers genetic super-population ancestry from a 23andMe/AncestryDNA file and computes ancestry-stratified odds ratios with an exploratory Ancestry Elevation Score (AES) showing where ancestry-specific GWAS effect sizes diverge from European reference estimates. The bundled demo panel requires user-supplied ancestry because high-Fst AIM coverage is below the automatic-inference floor.Other plugins' skills for the same job