spatial-annotate
БесплатноБез исполняемых скриптовНе проверенLoad when assigning per-spot cell-type labels on a spatial AnnData via marker-gene scoring or scRNA-reference mapping (Tangram / scANVI / CellAssign). Skip…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-annotate
When to use
The user has a single-cell-per-spot spatial AnnData (Xenium / MERFISH / Slide-seq) OR wants a discrete per-spot label even for Visium and has either marker genes or a labelled scRNA reference. Four methods:
marker_based(default) — built-in marker dictionaries (--species,--marker-n-genes,--marker-padj-cutoff); optional custom marker model via--model. No reference needed.tangram— gradient mapping from a labelled scRNA reference (--tangram-num-epochs,--tangram-train-genes,--tangram-device). Requirestangram+torch.scanvi— scvi-tools scANVI semi-supervised classifier (--scanvi-n-hidden/--scanvi-n-latent/--scanvi-n-layers,--scanvi-max-epochs). Requiresscvi-tools+torch.cellassign— Bayesian probabilistic assignment with marker matrix (--cellassign-max-epochs).
For proportion deconvolution on Visium-style multi-cell spots use
spatial-deconv. For tissue domains use spatial-domains.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Spatial AnnData | .h5ad with obsm["spatial"] |
yes (unless --demo) |
| scRNA reference | .h5ad with cell-type labels (--reference) |
required for tangram / scanvi |
| Custom marker model | path (--model) |
optional for marker_based |
| Output | Path | Notes |
|---|---|---|
| Annotated AnnData | processed.h5ad |
adds obs["cell_type"] (Categorical); per-method probability matrices in obsm — obsm["tangram_ct_pred"] (_lib/annotation.py:334), obsm["scanvi_probabilities"] (:482), obsm["cellassign_probabilities"] (:612). There is no unified obsm["cell_type_probabilities"] key. |
| Annotation summary | tables/annotation_summary.csv |
per-celltype count + proportion |
| Per-spot assignments | tables/cell_type_assignments.csv |
always |
| Cluster ↔ celltype | tables/cluster_annotations.csv |
when an existing cluster column was used |
| Probabilities | figure_data/annotation_probabilities.csv |
tangram / scanvi / cellassign (per-spot × celltype matrix) |
| Marker overlap | per-method figure_data/... CSVs |
when --analysis-type marker_based finds a marker DB |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or chain throughspatial-preprocess --demo. parser.errorvalidates per-method numeric flags (lines:730-746);:748raises if--referenceis missing for tangram / scanvi;:750for missing reference path;:752for missing--modelpath.- Dispatch to method:
marker_based: runsc.tl.rank_genes_groups(or use--model), score against species marker DB.tangram: train Tangram mapping from scRNA → spatial, project labels.scanvi: train scANVI on reference + spatial, predict labels.cellassign: solve probabilistic assignment given marker matrix.
- Write
obs["cell_type"](Categorical); per-method extras (probabilities, marker overlap). - Save
processed.h5ad, tables, figures,report.md,result.json.
Gotchas
--referenceis required fortangram/scanvi.spatial_annotate.py:748raisesparser.error(f"--reference is required for {args.method}").marker_basedandcellassigncan run reference-free (using marker DB or marker matrix).- All numeric / file-path validation goes through
parser.error(exit 2).spatial_annotate.py:730-746for numeric ranges;:748-752for required-file paths. --inputmissing →sys.exit(1)viaprint(NOTparser.error). Same pattern as spatial-domains. Caller wrappers expecting exit-2 get exit-1.marker_basedspecies default ishuman.spatial_annotate.py:866defaults--species human. For mouse data pass--species mouseso the built-in markers match HGNC vs MGI symbols.- Probabilities matrix is method-conditional. Only
tangram/scanvi/cellassignproduce a per-spot × celltype probability matrix.spatial_annotate.py:441writes it tofigure_data/annotation_probabilities.csv(note: figure_data, not tables; filename isannotation_probabilities.csv).marker_basedwrites only the discreteobs["cell_type"]. Downstream tools reading probabilities must guard for absence. obsm["spatial"]↔obsm["X_spatial"]sync at:102-104. Same dual-key pattern as spatial-domains / spatial-deconv.- Demo chains through
spatial-preprocess --demovia subprocess.spatial_annotate.py:723raisesRuntimeError(f"spatial-preprocess --demo failed: {result.stderr}")on chained-run failure. - Tangram requires
tangram-sc(PyPI name) but imports astangram.spatial_annotate.py:699records this naming wart; pip installtangram-sc, nottangram.
Key CLI
# Demo (chained from spatial-preprocess --demo, marker_based)
python omicsclaw.py run spatial-annotate --demo --output /tmp/spatial_annot_demo
# Marker-based on a Visium with built-in human markers
python omicsclaw.py run spatial-annotate \
--input clust
Установить spatial-annotate в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-annotate?
Load when assigning per-spot cell-type labels on a spatial AnnData via marker-gene scoring or scRNA-reference mapping (Tangram / scANVI / CellAssign). Skip when computing spot-level cell-type proportions for multi-cell-per-spot platforms (use spatial-deconv) or for tissue-domain detection (use spatial-domains).
Как установить скилл spatial-annotate?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-annotate запускает скрипты?
Нет, скилл состоит только из инструкций (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