spatial-trajectory
БесплатноБез исполняемых скриптовНе проверенLoad when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state +…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
spatial-trajectory
When to use
The user has a preprocessed spatial AnnData (obsm["X_pca"] or
neighbour graph populated) and wants pseudotime / branching
trajectories. Three backends:
dpt(default) — diffusion pseudotime viasc.tl.dpt. Cheap. Tunable--dpt-n-dcs.cellrank— GPCCA macrostates, terminal-state probabilities, fate maps, driver-gene ranking. Tunables--cellrank-n-states,--cellrank-frac-to-keep,--cellrank-schur-components.palantir— waypoint sampling + multi-scale Markov for branch probabilities. Tunables--palantir-num-waypoints,--palantir-knn,--palantir-n-components,--palantir-max-iterations.
Cluster column (--cluster-key) auto-detected from leiden /
cell_type / celltype / annotation / cluster / clusters.
For RNA-velocity-driven trajectories use spatial-velocity.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Preprocessed spatial AnnData | .h5ad with obsm["X_pca"], neighbour graph (built if missing); optional obs[cluster_key] for grouped exports |
yes (unless --demo) |
| Root cell | --root-cell <barcode> (else auto-pick by expression rank) |
optional |
| Output | Path | Notes |
|---|---|---|
| Annotated AnnData | processed.h5ad |
DPT/CellRank: obs["dpt_pseudotime"] (set by sc.tl.dpt at _lib/trajectory.py:276), uns["iroot"] (_lib/trajectory.py:273); CellRank also: obs["traj_terminal_state"], obs["traj_fate_max_prob"], obs["traj_fate_entropy"] (spatial_trajectory.py:236-238); Palantir: obs["palantir_pseudotime"], obs["palantir_entropy"], uns["palantir_waypoints"] (_lib/trajectory.py:527-529); when ≥ 1 branch is non-empty also obsm["palantir_branch_probs"] + uns["palantir_branch_prob_columns"] (_lib/trajectory.py:531-533) |
| Summary | tables/trajectory_summary.csv |
per-cell pseudotime + cluster |
| Cluster summary | tables/trajectory_cluster_summary.csv |
per-cluster mean/median pseudotime |
| Trajectory genes | tables/trajectory_genes.csv |
top correlated with pseudotime |
| Terminal states | tables/trajectory_terminal_states.csv + tables/{method}_terminal_states.csv |
CellRank / Palantir |
| Driver genes | tables/trajectory_driver_genes.csv (+ cellrank_driver_genes.csv alias) |
CellRank only |
| Fate probabilities | tables/trajectory_fate_probabilities_wide.csv |
CellRank wide form |
| Branch probs | tables/palantir_branch_probs.csv |
Palantir |
| Run summary | tables/trajectory_run_summary.csv |
params used |
| Report | report.md + result.json |
always |
Flow
- Load AnnData (
--input) or build a demo. Auto-detect--cluster-keyfrom candidates if not passed. - Pick / pin root cell:
--root-cell <barcode>or auto-pick via expression-rank; writeuns["iroot"](_lib/trajectory.py:273). - Run chosen backend:
dpt:sc.tl.dpt(adata, n_dcs=...)→obs["dpt_pseudotime"].cellrank: build kernel, GPCCA macrostates, terminal states, fate probabilities, driver genes.palantir: waypoint sampling, multi-scale Markov, branch probabilities.
- Compute trajectory genes (correlation with pseudotime) + cluster-mean / median pseudotime summary.
- Render embedding / spatial / diffmap / fate / gene-trend plots.
- Save tables +
processed.h5ad+ report.
Gotchas
--cluster-keyis auto-detected from a candidate list._lib/trajectory.py:25-31(_CLUSTER_KEY_CANDIDATES) triesleiden→cell_type→celltype→annotation→cluster→clustersand the auto-detect at_lib/trajectory.py:62-67returnsNonesilently when no candidate column has ≥ 2 unique values — cluster summaries then run withcluster_key = None. By contrast, an explicit--cluster-key Xwhose column is missing raisesValueErroratspatial_trajectory.py:1434. Pass an explicit key when you want a hard failure on a typo.- Both
dptandcellrankwriteobs["dpt_pseudotime"]._lib/trajectory.py:255-280populates it viasc.tl.dpt; CellRank reuses the same call (_lib/trajectory.py:341). Palantir writesobs["palantir_pseudotime"]instead — don't expectdpt_pseudotimefrom a Palantir run. - Palantir branch probabilities are conditional + dual-stored.
_lib/trajectory.py:531-533writesobsm["palantir_branch_probs"](numeric matrix) ANDuns["palantir_branch_prob_columns"](terminal-state column names) ONLY whenbranch_probsis non-empty (if not branch_probs.empty:at_lib/trajectory.py:531). Single-terminal-state runs leave both keys absent. The cells × terminals matrix is also exported astables/palantir_branch_probs.csvwhen present. - CellRank
traj_*keys are CellRank-only.spatial_trajectory.py:236-238writesobs["traj_terminal_state"]/obs["traj_fate_max_prob"]/obs["traj_fate_entropy"]only when the CellRank branch executes — DPT and Palantir runs leave those keys absent. uns["iroot"]is an integer index, not a barcode._lib/trajectory.py:273writes the integer
Установить spatial-trajectory в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл spatial-trajectory?
Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint branch probabilities). Skip when the data has spliced/unspliced layers and you want velocity-driven dynamics (use `spatial-velocity`) or for non-spatial scRNA pseudotime (use `sc-pseudotime`).
Как установить скилл spatial-trajectory?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spatial-trajectory запускает скрипты?
Нет, скилл состоит только из инструкций (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