spatial-domains
БесплатноБез исполняемых скриптовНе проверенLoad when detecting tissue domains / niches on a preprocessed spatial AnnData via Leiden / Louvain (spatial-weighted) or graph-neural backends (SpaGCN /…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-domains
When to use
The user has a preprocessed spatial AnnData (obsm["X_pca"] and
obsm["spatial"] populated) and wants tissue regions / niches
identified per spot (obs["spatial_domain"]). Seven methods:
leiden(default) — spatial-weighted Leiden (--resolution,--spatial-weight). No GPU.louvain— spatial-weighted Louvain. No GPU.spagcn— graph convolutional, fixed-K (--n-domains,--epochs,--spagcn-p). Requirestorch+SpaGCN.stagate— graph attention with cell-type-aware regularisation (--stagate-alpha,--pre-resolution,--rad-cutoff/--k-nn). Requirestorch+torch-geometric.graphst— graph-self-supervised (--epochs,--dim-output,--n-domains). Auto-detects 10x platform. Requirestorch+GraphST.banksy— neighbourhood expression matrix + PCA (--lambda-param,--num-neighbours). 0.2 = cell-typing mode, 0.8 = domain mode.cellcharter— niche-graph clustering with auto-k (--auto-k,--auto-k-min/--auto-k-max,--n-layers). Requirescellcharter+pyro-ppl.
For spatially variable genes use spatial-genes; for spot-level
cell-type labels use spatial-annotate.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Preprocessed spatial AnnData | .h5ad with obsm["X_pca"] + obsm["spatial"] |
yes (unless --demo) |
| Output | Path | Notes |
|---|---|---|
| Annotated AnnData | processed.h5ad |
adds obs["spatial_domain"] (categorical); per-method embedding (obsm["X_stagate"] / X_graphst / X_banksy_pca / X_cellcharter) |
| Domain summary | tables/domain_summary.csv |
per-domain count + proportion |
| Per-spot assignment | tables/domain_assignments.csv |
always |
| Neighbour mixing | tables/domain_neighbor_mixing.csv |
when neighbourhood metrics computed |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or build a demo. Auto-computeobsm["X_pca"]if missing (logs a warning). - Default
--n-domainsto 7 for GNN methods (spagcn/stagate/graphst) and forcellcharterwhen--auto-kis off. - For
graphst: infer--data-typefrom input metadata / path (10x Visium auto-detected). - Run the chosen method; write
obs["spatial_domain"](categorical) and method-specificobsmembedding. - Optionally refine domain assignments with neighbourhood smoothing (
--refine). - Compute domain counts + proportions; per-domain neighbour-mixing summary.
- Save tables, figures,
processed.h5ad,report.md,result.json.
Gotchas
--inputmissing →sys.exit(1)viaprint+sys.exit, NOTparser.error.spatial_domains.py:959-960prints"ERROR: Provide --input or --demo"to stderr andsys.exit(1)— different from sibling skills'parser.error. Caller wrappers expectingparser.error(exit 2) get exit 1.obsm["X_pca"]is auto-computed when missing.spatial_domains.py:953-957logs a warning and runssc.pp.pca. The implicit PCA uses defaults (no HVG selection, no batch correction). For real data preferspatial-preprocessupstream so the PCA reflects HVG-aware preprocessing.- GNN methods auto-default
--n-domainsto 7.spatial_domains.py:962-968silently setsargs.n_domains = 7forspagcn/stagate/graphstand forcellcharter(when--auto-kis off). Override explicitly or these K-fixed methods quietly target 7 clusters. obsm["spatial"]↔obsm["X_spatial"]sync.spatial_domains.py:77-79ensures both keys exist (copies one to the other if missing). Some upstream skills only write one; this skill normalises.- Per-method
obsmembedding key.spatial_domains.py:110-113records: STAGATE →obsm["X_stagate"], GraphST →obsm["X_graphst"], BANKSY →obsm["X_banksy_pca"], CellCharter →obsm["X_cellcharter"]. Leiden / Louvain / SpaGCN do NOT write a method-specific embedding. - Performance warning at 30K cells.
spatial_domains.py:548logs a warning whenn_cells > 30000and method ∈ {graphst,spagcn,stagate}. The methods still run; consider downsampling or switching toleidenfor large datasets. - GraphST is unrecommended above 5K cells.
spatial_domains.py:554logs a separate warning specifically forgraphstwhenn_cells is None or n_cells > 5000.
Key CLI
# Demo (synthetic spatial)
python omicsclaw.py run spatial-domains --demo --output /tmp/spatial_dom_demo
# Default leiden with spatial weighting
python omicsclaw.py run spatial-domains \
--input preprocessed.h5ad --output results/ \
--method leiden --resolution 1.0 --spatial-weight 0.3
# SpaGCN with explicit K
python omicsclaw.py run spatial-domains \
--input preprocessed.h5ad --output results/ \
--method spagcn --n-domains 8 --spagcn-p 0.5 --epochs 200
# STAGATE with cell-type-aware module
python omicsclaw.py run spatial-domains \
--input preprocessed.h5ad --output results/ \
--method stagate --rad-cutoff 150 --stagate-alpha 0.5 --n-domains 7
Установить spatial-domains в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-domains?
Load when detecting tissue domains / niches on a preprocessed spatial AnnData via Leiden / Louvain (spatial-weighted) or graph-neural backends (SpaGCN / STAGATE / GraphST / BANKSY / CellCharter). Skip when ranking spatially variable genes (use spatial-genes) or for spot-level cell-type annotation (use spatial-annotate).
Как установить скилл spatial-domains?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-domains запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic