spatial-register
БесплатноБез исполняемых скриптовНе проверенLoad when aligning multiple spatial slices into a common coordinate frame on a multi-slice spatial AnnData via PASTE optimal transport or STalign image-aware…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-register
When to use
The user has a multi-slice spatial AnnData (slices stacked into one
object with a --slice-key column) and wants the slices registered
into a shared coordinate frame so a downstream analysis can use the
common axes. Two methods:
paste(default) — PASTE optimal-transport alignment based on gene expression similarity + spatial proximity (--paste-alpha,--paste-dissimilarity). Requirespaste-bio+pot(+ optionaltorchfor GPU).stalign— STalign image-aware diffeomorphic registration; best when histology images are available (--stalign-niter,--stalign-image-size,--stalign-a). RequiresSTalign+torch.
For expression-space batch correction across slices use
spatial-integrate. For aligning a single slice to a reference atlas
use the same skill with that atlas as the reference slice.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Multi-slice AnnData | .h5ad with obs[--slice-key] (≥ 2 slices) |
yes (unless --demo) |
| Histology images | obsm keys (stalign only) |
conditional |
| Output | Path | Notes |
|---|---|---|
| Registered AnnData | processed.h5ad |
adds obsm["spatial_aligned"] (registered coords from _lib/register.py:184/476); the original obsm["spatial"] is preserved as-is (the script does NOT overwrite it). A legacy duplicate also lives at obsm["X_spatial"] (spatial_register.py:80/83). |
| Registration summary | tables/registration_summary.csv |
per-slice shift / disparity stats |
| Per-slice metrics | tables/registration_metrics.csv |
always |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or build a multi-slice demo via the bundledspatial-preprocessrunner (chains across slices). parser.errorvalidates numeric flag ranges (--paste-alpha∈ [0, 1];--stalign-niter/-image-size/-a> 0).- Resolve
--slice-key(auto-pick fromslice/sample/library_idif unset); raise if< 2slices. - Pick a reference slice (largest by default) and align all others to it.
- For PASTE: compute pairwise transport plans using
--paste-alpha(gene-vs-spatial weight); apply translations. - For STalign: run iterative image-aware diffeomorphism with
--stalign-niteriterations. - Save
processed.h5ad(registered coords inobsm["spatial_aligned"]; originalobsm["spatial"]preserved unchanged), tables, figures,report.md,result.json.
Gotchas
- All input + parameter validation goes through
parser.error(exit code 2).spatial_register.py:896for missing--input;:898for missing path;:901for--paste-alphaout of [0, 1];:903-907for non-positive STalign params. Wrappers expectingValueErrorneed to catch exit-2 separately. - Slice-key validation raises
ValueErrorpost-argparse.spatial_register.py:913raisesValueError(f"Slice key '<requested_key>' not found in adata.obs");:915raisesValueError(f"Slice key '<requested_key>' must contain at least 2 slices"). These fire after argparse, so they're real PythonValueErrors — different from theparser.errorgroup above. pasterequirespaste-bio+pot;stalignrequiresSTalign+torch.spatial_register.py:827-829lists the optional packages by method; the actual import sites raiseImportErrorif missing. The skill records what's installed inreproducibility/environment.txt.- Registered coordinates land in
obsm["spatial_aligned"], NOT inobsm["spatial"]. The originalobsm["spatial"]is preserved unchanged; the aligned coords are added as a separate key. Downstream tools that consumeobsm["spatial"]will keep using the original coords unless they explicitly switch toobsm["spatial_aligned"]. The legacy duplicateobsm["X_spatial"]also exists (spatial_register.py:80/83) for back-compat. - Demo mode chains through
spatial-preprocessfirst.spatial_register.py:988raisesFileNotFoundError(f"spatial-preprocess not found at {preprocess_script}")if the sibling skill is missing from the install;:1005raisesFileNotFoundError(f"Expected {processed}")when the demo preprocess output isn't where expected. Real runs skip this chain. - Disparity / shift metrics are best-effort. When
paste-bioorSTaligndoesn't expose disparity scores, the metric columns intables/registration_metrics.csvwill be NaN —:178documents the column initialisation. Quote the per-slice shifts (mean_shift,median_shift,max_shift) instead.
Key CLI
# Demo (multi-slice synthetic; chains through spatial-preprocess)
python omicsclaw.py run spatial-register --demo --output /tmp/spatial_reg_demo
# PASTE alignment on a multi-slice Visium object
python omicsclaw.py run spatial-register \
--input multi_slice.h5ad --output results/ \
--slice-key library_id --method paste --paste-alpha 0.1
# STalign with strong image regularisation
python omicsclaw.py run spatial-register \
--input m
Установить spatial-register в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-register?
Load when aligning multiple spatial slices into a common coordinate frame on a multi-slice spatial AnnData via PASTE optimal transport or STalign image-aware registration. Skip when data is single-slice (no registration needed) or for cross-sample integration in the gene-expression space (use spatial-integrate).
Как установить скилл spatial-register?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-register запускает скрипты?
Нет, скилл состоит только из инструкций (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