spatial-statistics
БесплатноБез исполняемых скриптовНе проверенLoad when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-statistics
When to use
The user has a clustered spatial AnnData (obs[--cluster-key] for
cluster-aware analyses; obsm["spatial"] populated) and wants a
specific spatial-statistics analysis. Pick --analysis-type from
VALID_ANALYSIS_TYPES:
moran/geary— global spatial autocorrelation per gene.local_moran— per-spot LISA + GeoDa quadrants (--local-moran-geoda-quads).getis_ord— per-spot hotspot Z-scores.bivariate_moran— exactly two genes (--genes geneA,geneB).neighborhood_enrichment— squidpy NES between cluster pairs.ripley— Ripley K / L / G / F (--ripley-mode,--ripley-metric).co_occurrence— pairwise label co-occurrence at distance bins (--coocc-interval,--coocc-n-splits).spatial_centrality— graph-centrality per spot.
For per-gene SVG ranking use spatial-genes; for tissue-domain
detection use spatial-domains.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Clustered spatial AnnData | .h5ad with obsm["spatial"] + obs[--cluster-key] |
yes (unless --demo) |
| Genes | --genes geneA,geneB,... (comma-separated) |
required for bivariate_moran |
| Output | Path | Notes |
|---|---|---|
| Annotated AnnData | processed.h5ad |
adds per-gene analysis-specific obs columns: obs[f"local_moran_<gene>"] / obs[f"local_moran_pval_<gene>"] / obs[f"local_moran_q_<gene>"] (_lib/statistics.py:739-741); obs[f"getis_ord_<gene>"] / obs[f"getis_ord_pval_<gene>"] (:832-833). Other analyses write to uns. |
| Analysis summary | tables/analysis_summary.csv |
always |
| Neighbourhood Z-score matrix | tables/neighborhood_zscore.csv |
when --analysis-type neighborhood_enrichment |
| Neighbourhood counts | tables/neighborhood_counts.csv |
when --analysis-type neighborhood_enrichment |
| Bivariate-Moran summary | tables/bivariate_moran_summary.csv |
when --analysis-type bivariate_moran |
| Per-analysis result tables | tables/<analysis-specific>.csv |
dispatched per analysis-type |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or chain throughspatial-preprocess --demovia subprocess (spatial_statistics.py:1499-1515). parser.errorvalidates--analysis-type∈VALID_ANALYSIS_TYPES; per-analysis numeric ranges (lines:1558-1601).- Auto-resolve
--cluster-keyif unset; auto-leiden if no cluster column exists (with size guard at:1546). - Dispatch to analysis-type runner; squidpy graph build uses
--stats-n-neighs/--stats-n-rings/--stats-n-perms. - Build standardised result tables; collect per-spot metrics.
- Save tables, figures,
processed.h5ad,report.md,result.json.
Gotchas
- All input + parameter validation goes through
parser.error(exit code 2).spatial_statistics.py:1530for missing--input;:1546for too-small dataset to auto-leiden;:1558for invalid--analysis-type;:1560-1601for numeric / multi-value flag validation. Wrappers expectingValueErrorneed to catch exit-2. bivariate_moranrequires exactly TWO genes.spatial_statistics.py:1601raisesparser.error("--analysis-type bivariate_moran requires exactly two genes via --genes geneA,geneB"). Pass them comma-separated, no spaces.- Demo chains through
spatial-preprocessvia subprocess.spatial_statistics.py:1499raisesFileNotFoundError(f"spatial-preprocess not found at {preprocess_script}")if the sibling skill is missing;:1510raisesRuntimeError("spatial-preprocess --demo failed (exit ...)")on chained failure;:1515raisesFileNotFoundError(f"Expected {processed}")when the demo output isn't where expected. --cluster-keyauto-leiden has a size guard.spatial_statistics.py:1546raisesparser.error("Dataset is too small to auto-computeleidenclusters.")when the auto-fallback can't run. Pass--cluster-key <existing-column>for small datasets.local_moranwritesn_significant_spots;getis_ordwritesn_hotspots.spatial_statistics.py:555documents the value-column divergence. Downstream tools reading "spatially significant cell count" need to branch on--analysis-type.neighborhood_enrichmentconsumes<cluster_key>_nhood_enrichmentfromuns. Computed lazily within squidpy; if you re-run with a different--cluster-key, the previousunskey remains and won't be reused for the new cluster column. Cleanadata.unsbetween runs or expect stale keys.spatial_centralityis graph-only. It produces per-spot centrality without any cluster-key dependency — useful when--cluster-keyis unavailable.
Key CLI
# Demo (chained from spatial-preprocess --demo)
python omicsclaw.py run spatial-statistics --demo --analysis-type moran --output /tmp/spatial_stats_demo
# Global Moran's I on a clustered AnnData
python omicsclaw.py run spatial-statistics \
--input clustered.h5ad --output results/ \
--analysis-type moran --cluster-key spatial_doma
Установить spatial-statistics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-statistics?
Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes) or for tissue domain detection (use spatial-domains).
Как установить скилл spatial-statistics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-statistics запускает скрипты?
Нет, скилл состоит только из инструкций (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