spatial-genes
БесплатноБез исполняемых скриптовНе проверенLoad when ranking spatially variable genes (SVGs) on a preprocessed spatial AnnData via Moran's I, SpatialDE, SPARK-X, or FlashS. Skip when detecting tissue…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-genes
When to use
The user has a preprocessed spatial AnnData (obsm["spatial"]
populated; ideally layers["counts"] for count-based methods) and
wants per-gene spatial-variability scores. Four methods:
morans(default) — Moran's I viasquidpy.gr.spatial_autocorr(--morans-n-neighs,--morans-n-perms). Fast.spatialde— SpatialDE Gaussian-process model (--spatialde-min-counts,--spatialde-aeh-patterns/--spatialde-aeh-lengthscale,--spatialde-no-aeh). Most rigorous, slower.sparkx— SPARK-X non-parametric covariance (--sparkx-num-cores,--sparkx-max-genes). Scales to large slides.flashs— FLASH-S random-Fourier-feature approximation (--flashs-n-rand-features,--flashs-bandwidth). Fastest.
For tissue domain detection use spatial-domains; for between-group
DE use spatial-de.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Preprocessed spatial AnnData | .h5ad with obsm["spatial"] |
yes (unless --demo) |
Raw counts (spatialde / sparkx) |
layers["counts"] recommended |
optional fallback to .X |
| Output | Path | Notes |
|---|---|---|
| Annotated AnnData | processed.h5ad |
preserved; morans additionally writes adata.uns["moranI"] (squidpy convention). No method writes a var column — scores live only in the tables. |
| All SVG results | tables/svg_results.csv |
per-gene score / pvalue / padj |
| Top SVGs | tables/top_svg_scores.csv |
top---n-top-genes |
| Significant SVGs | tables/significant_svgs.csv |
filtered at --fdr-threshold |
| Per-spot metrics | tables/svg_observation_metrics.csv |
when method exposes them |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or chain throughspatial-preprocess --demovia subprocess (spatial_genes.py:1043-1050). parser.errorvalidates per-method numeric ranges (--morans-n-neighs≥ 1, etc.) at lines:1062-1078.- Validate input matrix: count-based methods (
spatialde/sparkx) expectlayers["counts"]; if missing the script logs a warning and falls back toadata.X— results may be suboptimal. - Dispatch to chosen method; method-specific kwargs flow from
_collect_run_configuration(args). - Build standardised SVG result table with score / pvalue / padj columns; rank by score.
- Detect significance at
--fdr-threshold; build top-N table. - Save tables, figures,
processed.h5ad,report.md,result.json.
Gotchas
--inputmissing → bareprint+sys.exit(1), NOTparser.error.spatial_genes.py:1240doesprint("ERROR: Provide --input or --demo", file=sys.stderr); sys.exit(1). Different from sibling skills'parser.error(exit 2).spatialde/sparkxsilently fall back to.Xwhenlayers["counts"]is missing.spatial_genes.py:1244-1257logs a warning and continues —result.jsondoes NOT record the fallback as a separate flag. Always addadata.layers["counts"] = adata.X.copy()upstream when running these count-based methods on preprocessed data.- Demo mode chains through
spatial-preprocess --demovia subprocess.spatial_genes.py:1050raisesRuntimeError(f"spatial-preprocess --demo failed: {result.stderr}")if the chained run fails. Real runs skip this chain. - Per-method numeric flag validation goes through
parser.error(exit 2).spatial_genes.py:1062-1078covers Moran's-I, SpatialDE, SPARK-X, FlashS numeric ranges. Out-of-range values exit 2 before the method dispatches. - No method writes a
varcolumn — scores live inadata.uns(morans only) andtables/svg_results.csv.spatial_genes.py:377checkssummary["method"] == "morans" and "moranI" in adata.uns;_lib/genes.py:163consumes fromadata.uns["moranI"]only. There is novar["moranI"]mirror. SpatialDE / SPARK-X / FlashS write totables/svg_results.csvexclusively. - Result-table column varies by method.
tables/svg_results.csvalways hasgene+score+pvalue+padj, but thescorecolumn's semantic differs: Moran's I (in [-1, 1], higher = more spatial), SpatialDE LL difference, SPARK-X test stat, FLASH-S coefficient. Compare scores within method only.
Key CLI
# Demo (chained from spatial-preprocess --demo)
python omicsclaw.py run spatial-genes --demo --output /tmp/spatial_genes_demo
# Default Moran's I
python omicsclaw.py run spatial-genes \
--input preprocessed.h5ad --output results/ \
--method morans --morans-n-neighs 6 --morans-n-perms 100
# SpatialDE on raw counts
python omicsclaw.py run spatial-genes \
--input preprocessed.h5ad --output results/ \
--method spatialde --spatialde-min-counts 3 --spatialde-aeh-patterns 5
# SPARK-X for large slides
python omicsclaw.py run spatial-genes \
--input preprocessed.h5ad --output results/ \
--method sparkx --sparkx-num-cores 8 --sparkx-max-genes 5000
# FLASH-S fast approximation
python omicsclaw.py run spatial-genes \
--input preprocessed.h5ad --output results/ \
--me
Установить spatial-genes в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-genes?
Load when ranking spatially variable genes (SVGs) on a preprocessed spatial AnnData via Moran's I, SpatialDE, SPARK-X, or FlashS. Skip when detecting tissue domains (use spatial-domains) or for differential expression between groups (use spatial-de).
Как установить скилл spatial-genes?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-genes запускает скрипты?
Нет, скилл состоит только из инструкций (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