spatial-enrichment
БесплатноБез исполняемых скриптовНе проверенLoad when running pathway / gene-set enrichment per cluster on a preprocessed spatial AnnData via Enrichr (over-representation), GSEA (preranked), or ssGSEA…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-enrichment
When to use
The user has a preprocessed spatial AnnData with cluster labels in
obs[groupby] (default leiden) and wants pathway / gene-set
enrichment per cluster. Three backends:
enrichr(default) — over-representation against an Enrichr hosted gene-set library. Tunables--enrichr-padj-cutoff,--enrichr-log2fc-cutoff,--enrichr-max-genes.gsea— preranked GSEA. Tunables--gsea-min-size,--gsea-max-size,--gsea-permutation-num,--gsea-weight,--gsea-threads,--gsea-seed.ssgsea— single-sample GSEA per cell, scores written back toobs[...]. Tunables--ssgsea-min-size,--ssgsea-max-size,--ssgsea-weight.
--gene-set selects a hosted library (e.g. MSigDB_Hallmark_2020);
--gene-set-file accepts a custom GMT. Species: human (default)
or mouse. For non-spatial enrichment use sc-enrichment.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Preprocessed spatial AnnData | .h5ad with obsm["spatial"], obs[groupby] (auto-runs Leiden if missing) |
yes (unless --demo) |
| Gene set | --gene-set <library_name> (Enrichr lib) or --gene-set-file <path.gmt> |
one of the two for non-default runs |
| Output | Path | Notes |
|---|---|---|
| Annotated AnnData | processed.h5ad |
Enrichr/GSEA/ssGSEA: uns["enrichment_results"] + uns["{method}_results"] (uns["enrichr_results"] / uns["gsea_results"] / uns["ssgsea_results"], written at _lib/enrichment.py:1113-1117); ssGSEA additionally writes per-cell scores as obs[<score_col>] columns and a list uns["enrichment_score_columns"] (_lib/enrichment.py:907-910) |
| Full results | tables/enrichment_results.csv |
every term, every group |
| Significant subset | tables/enrichment_significant.csv |
filtered by --fdr-threshold |
| Ranked markers | tables/ranked_markers.csv |
input to enrichment |
| Top terms | tables/top_enriched_terms.csv |
top-N per group |
| Group metrics | tables/enrichment_group_metrics.csv |
n_terms / n_significant per group |
| Run summary | tables/enrichment_run_summary.csv |
params used |
| Report | report.md + result.json |
always |
Flow
- Load AnnData; if
obs[groupby]is missing, auto-cluster with Leiden (orparser.errorif dataset too small). - For Enrichr / GSEA: rank markers per group via
sc.tl.rank_genes_groups(--de-method wilcoxon/t-test), then submit to Enrichr or run preranked GSEA. - For ssGSEA: compute per-cell pathway scores; write columns to
obs[...]+ register them inuns["enrichment_score_columns"](_lib/enrichment.py:907-910). - Persist canonical results to
uns["enrichment_results"]plus a per-method copy atuns[f"{method}_results"](_lib/enrichment.py:1113-1117). - Filter by
--fdr-threshold+--n-top-terms; export per-group ranked tables. - Render barplot / dotplot / spatial / violin / score-distribution plots.
- Save tables +
processed.h5ad+ report.
Gotchas
- Default groupby is
leiden._lib/enrichment.py:32-39and the CLI default--groupby leiden. Ifobs["leiden"]is missing, the script auto-runs Leiden — but only if the dataset is large enough; otherwisespatial_enrichment.py:1298callsparser.error("Dataset is too small to auto-compute leiden clusters"). - Enrichr requires internet access. Enrichr is a hosted API — runs fail in air-gapped environments. Use
--method gseaor--method ssgseawith a local--gene-set-filefor offline workflows. - ssGSEA score-column NAMES are not stable across runs.
_lib/enrichment.py:907-910constructs them from the geneset library + term name, then registers the list inuns["enrichment_score_columns"]. Always read that key — don't hard-code column names. obs[groupby]is double-cast. The wrapper atspatial_enrichment.py:422-423first casts topd.Categorical(...)(so plotting / report ordering uses sorted categories). Later,_lib/enrichment.py:94-97(_ensure_obs_string) re-casts to plainstrfor the marker-ranking step. The on-diskprocessed.h5adreflects the final string cast — Categorical ordering on input is lost either way.- GSEA permutation tests are slow.
--gsea-permutation-num(default 1000) drives runtime; for sketch runs drop to 100. Use--gsea-threads Nfor parallelism. uns["{method}_results"]mirrorsuns["enrichment_results"]._lib/enrichment.py:1113-1117writes the canonical key plus a per-method alias (uns["ssgsea_results"]/uns["gsea_results"]). Downstream readers should prefer the canonical key.
Key CLI
# Demo
python omicsclaw.py run spatial-enrichment --demo --output /tmp/enr_demo
# Enrichr over-representation (default)
python omicsclaw.py run spatial-enrichment \
--input preprocessed.h5ad --output results/ \
--method enrichr --groupby leiden --species human \
--gene-set MSigDB_Hallmark_2020 --fdr-threshold 0.05 --n-top-terms 20
# GSEA preranked with custom GMT
python omicsclaw.py run spatial-enrichment
Установить spatial-enrichment в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-enrichment?
Load when running pathway / gene-set enrichment per cluster on a preprocessed spatial AnnData via Enrichr (over-representation), GSEA (preranked), or ssGSEA (per-cell scores). Skip when ranking spatially variable genes (use `spatial-genes`) or when comparing pathways across conditions (use `spatial-condition` for DE first, then this skill on the ranked output).
Как установить скилл spatial-enrichment?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-enrichment запускает скрипты?
Нет, скилл состоит только из инструкций (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