spatial-de
БесплатноБез исполняемых скриптовНе проверенLoad when ranking spatial cluster markers or comparing two spatial groups in spatial transcriptomics. Skip if the data is single-cell (use sc-de) or bulk (use…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-de
When to use
The user has a preprocessed spatial transcriptomics AnnData (Visium /
Xenium / MERFISH / Slide-seq) and wants either (a) cluster-marker
ranking via Scanpy wilcoxon / t-test, or (b) replicate-aware
two-group condition DE via pydeseq2 pseudobulk. The wrapper exposes
the official Scanpy filter controls and PyDESeq2 GLM controls directly,
and refuses to fabricate replicates — pseudobulk requires a real
sample_key.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Preprocessed AnnData | .h5ad |
yes (or --demo) |
Sample/replicate column in obs |
--sample-key (default sample_id) |
only for pydeseq2 |
Raw counts in layers["counts"] |
layer | recommended for pydeseq2; fallback chain to adata.raw then adata.X with warning |
| Output | Path | Notes |
|---|---|---|
| Processed AnnData | processed.h5ad |
DE results stashed in uns |
| Full DE table | tables/de_full.csv |
per-gene results across all groups |
| Top markers | tables/markers_top.csv |
--n-top-genes per group |
| Standard gallery | figures/*.png |
recipe-driven (overview / diagnostic / supporting / uncertainty roles) |
figure_data/manifest.json |
for the optional R customization layer | |
| Report | report.md + result.json |
always |
Flow
- Load the preprocessed AnnData; if absent and not
--demo, runspatial-preprocessfirst (raisesRuntimeErroratspatial_de.py:1370if upstream script missing). - Validate the matrix contract and method-specific arguments (Scanpy methods need
X = log_normalized;pydeseq2needs counts). - For Scanpy paths: run
rank_genes_groupsand (default-on) the officialfilter_rank_genes_groupspost-filter. - For
pydeseq2: pseudobulk bysample_key× group, drop bins below--min-cells-per-sample/--min-counts-per-gene, fit PyDESeq2 GLM. If the same biological sample is in both groups, auto-switch to paired design~ sample_id + condition. - Render the recipe-driven standard gallery.
- Write
processed.h5ad, tables,figure_data/manifest.json,report.md,result.json, and reproducibility script.
Gotchas
pydeseq2requires--sample-keydistinct from--groupby. Hard-fails atspatial_de.py:1455with"--sample-key and --groupby must be different for pydeseq2". Defaultsample_keyissample_id; if the user's grouping column happens to be the same name, swap one.pydeseq2requires explicit--group1and--group2. Hard-fails atspatial_de.py:1458(the--demopath bypasses this by picking the first two groups it finds). Other methods treat them as optional (cluster-vs-rest if absent).- Counts-layer fallback to
adata.Xis logged but not blocked. Whenpydeseq2cannot findlayers["counts"]oradata.raw,spatial_de.py:1684-1686falls through toadata.Xwith a warning that says verbatim "Ifadata.Xis log-normalized, pseudobulk DE will be statistically invalid." Verifyresult.json["summary"]["expression_source"]after every pseudobulk run; do not assume the warning blocked the run. - Paired design auto-activates when ≥2 samples each contribute to both groups (with ≥2 cells per side). Per
skills/spatial/_lib/de.py:485-506(_choose_pydeseq2_design): the wrapper switches the DESeq2 formula to~ sample_id + conditiononly when at least 2 distinctsample_idvalues appear in both groups AND each side of the resulting paired split retains ≥2 cells; otherwise it stays unpaired (~ condition). Checkresult.json["summary"]["paired_design"](also surfaced atspatial_de.py:454); if the run was unintentionally paired (e.g. the user merged samples by accident), the LFC interpretation changes. - Skipped sample-group bins ARE surfaced (unlike sc-de's silent drops). The full reason list lives in
result.json's skipped-sample summary (each row carriessample_id,condition,reason,n_cellsperspatial_de.py:1198). When pydeseq2 reports few DEGs, inspect this list before assuming biological null. - Scanpy
filter_markersis cluster-style only. The--filter-markerspost-filter (default on) enforces themin_in_group_fraction/min_fold_change/max_out_group_fractiontriplet fromscanpy.tl.filter_rank_genes_groups— appropriate for cluster markers, but for a--group1 vs --group2contrast it can drop genuine effect genes whose between-condition cell coverage is low. Pass--no-filter-markersfor two-group condition comparisons.
Key CLI
# Demo: 200-spot synthetic Visium with three domains
python omicsclaw.py run spatial-de --demo
# Default exploratory cluster-marker discovery
python omicsclaw.py run spatial-de \
--input processed.h5ad --output results/ \
--groupby leiden --method wilcoxon
# Replicate-aware condition contrast via PyDESeq2 pseudobulk
python omicsclaw.py run spatial-de \
--input processed.h5ad --output results/ \
--method pydeseq2 --groupby condition \
--group1 treated --group2 contr
Установить spatial-de в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-de?
Load when ranking spatial cluster markers or comparing two spatial groups in spatial transcriptomics. Skip if the data is single-cell (use sc-de) or bulk (use bulkrna-de), or for spatially variable expression discovery (use spatial-genes).
Как установить скилл spatial-de?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-de запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic