spatial-preprocess
БесплатноБез исполняемых скриптовНе проверенLoad when running the foundational spatial transcriptomics QC + filtering + normalisation + HVG + PCA + neighbour-graph + Leiden pipeline on a Visium / Xenium…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-preprocess
When to use
The user has a spatial AnnData (Visium / Xenium / SpaceRanger output /
generic) — either freshly loaded or coming out of
spatial-raw-processing — and wants the canonical
"QC → filter → normalise → HVG → PCA → neighbours → Leiden" path
producing a downstream-ready processed.h5ad. This is the foundation
skill — most other spatial analyses (spatial-domains,
spatial-de, spatial-genes, spatial-deconv,
spatial-communication, ...) consume its output. Single backend:
scanpy_standard.
For raw FASTQ → matrix conversion use spatial-raw-processing. For
explicit tissue-domain detection (SpaGCN / STAGATE) on top of this
output use spatial-domains.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Spatial AnnData | .h5ad (Visium / Xenium / generic, with obsm["spatial"] recommended) |
yes (unless --demo) |
| Tissue preset | --tissue (one of TISSUE_PRESETS) |
optional — overrides QC defaults |
| Output | Path | Notes |
|---|---|---|
| Processed AnnData | processed.h5ad |
X = normalised, layers["counts"] = raw, obsm["X_pca"], obsm["X_umap"], var["highly_variable"], obs["leiden"] |
| Run summary | tables/preprocess_summary.csv |
always |
| Cluster sizes | tables/cluster_summary.csv |
always |
| QC summary | tables/qc_summary.csv |
per-cluster QC metrics |
| PCA variance | tables/pca_variance_ratio.csv |
per-PC variance |
| Multi-resolution sweep | tables/multi_resolution_summary.csv |
when --resolutions is provided |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or build a synthetic spatial demo. - Apply tissue preset if
--tissue <preset>is given (overrides default--min-genes/--min-cells/--max-mt-pct/--max-genes). - QC + filter spots / genes; mitochondrial-percentage filter uses
--speciesfor gene prefix (MT-for human,mt-for mouse). - Normalise (CP10k log) → HVG (
--n-top-hvg) → PCA (--n-pcs). - Build neighbour graph (
--n-neighbors) → Leiden at--leiden-resolution. - If
--resolutions a,b,c,...is set, sweep additional Leiden resolutions and write the multi-resolution table. - Save
processed.h5ad, tables, figures,report.md,result.json.
Gotchas
- All input + parameter validation goes through
parser.error(exit code 2), notValueError/SystemExit(1).spatial_preprocess.py:1006for missing--input;:1008for missing path;:1010for unknown--tissue;:1012-1028for negative / out-of-range numeric flags. Wrappers expecting standardValueErrorneed to handle exit code 2 separately. result.json["n_pcs_used"]may be smaller than the requested--n-pcs. The dimensionality is clipped in the helper atskills/spatial/_lib/preprocessing.py:307(cross-file anchor — lint skips). The clipped value is surfaced into the per-row metrics CSV atspatial_preprocess.py:193(n_pcs_used) and:191(n_pcs_requested). Passn_pcs_used(notn_pcs_requested) to downstream skills likespatial-domains --n-pcs.--tissueoverrides numeric defaults silently. When a preset matches,TISSUE_PRESETSrewrites--min-genes/--min-cells/--max-mt-pct/--max-genesfrom the preset table. Pass values explicitly to override;result.json["effective_params"]records what was actually applied.- No UMAP fallback — missing
umap-learnaborts the run.sc.tl.umapis called unconditionally; ifumap-learn(or igraph for Leiden) isn't installed, the run raisesImportErrorand exits non-zero. There is no_safe_umapshim in the script — installumap-learnandigraphbefore running on a fresh env. --resolutionsparsing errors viaparser.error.spatial_preprocess.py:1026raises on malformed comma-separated values;:1028raises if any value is<= 0. Format:0.4,0.6,0.8,1.0(no spaces inside the value).- Default
--tissueisNone(no preset). When unset, the skill uses the generic defaults fromdefaultsdict at:956-958— typically the right call. Tissue presets (brain,tumor, etc.) tighten thresholds and may filter aggressively on tissues with low UMI counts.
Key CLI
# Demo (synthetic Visium)
python omicsclaw.py run spatial-preprocess --demo --output /tmp/spatial_pp_demo
# Visium with default presets
python omicsclaw.py run spatial-preprocess \
--input visium.h5ad --output results/
# Tissue preset + custom resolution
python omicsclaw.py run spatial-preprocess \
--input visium.h5ad --output results/ \
--data-type visium --tissue brain --leiden-resolution 1.2
# Multi-resolution sweep for picking optimal clustering
python omicsclaw.py run spatial-preprocess \
--input visium.h5ad --output results/ \
--resolutions 0.4,0.6,0.8,1.0,1.4
# Mouse Xenium
python omicsclaw.py run spatial-preprocess \
--input xenium.h5ad --output results/ \
--data-type xenium --species mouse --max-mt-pct 15
See also
references/parameters.md—
Установить spatial-preprocess в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-preprocess?
Load when running the foundational spatial transcriptomics QC + filtering + normalisation + HVG + PCA + neighbour-graph + Leiden pipeline on a Visium / Xenium / generic spatial AnnData. Skip when raw FASTQs need converting first (use spatial-raw-processing) or for tissue-domain detection on already-preprocessed data (use spatial-domains).
Как установить скилл spatial-preprocess?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-preprocess запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
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…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic