Agent skill

Spatial Trajectory

by TianGzlab in TianGzlab/OmicsClaw

Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint…

MITAuto-check passedResearch & Science

Install Spatial Trajectory

skills CLI
$ npx skills add TianGzlab/OmicsClaw --skill spatial-trajectory -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install TianGzlab/OmicsClaw spatial-trajectory --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/TianGzlab/OmicsClaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/spatial/spatial-trajectory .claude/skills/spatial-trajectory && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
spatial-trajectory
GitHub stars
161
Token cost
~1.8k tokens
SKILL.md length
449 words
Files
9 (incl. references)
Skills in repo
95
Repo updated
First seen
Licence
MIT

At a glance

Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint…

  • Works in 6 steps: Load AnnData (--input) or build a demo.… → Pick / pin root cell: --root-cell or… → Run chosen backend → …
  • Tasks that involve Bioinformatics
  • SKILL.md covers When to use, Inputs & Outputs, Flow and Gotchas, plus 2 more sections
  • Runs Python and R scripts from its folder; calls python

What it does

Spatial Trajectory is an agent skill from TianGzlab/OmicsClaw. 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); non-spatial scRNA pseudotime (use sc-pseudotime).

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 11 other files, including reference files (for example `r_visualization/README.md`, `references/methodology.md` and `references/output_contract.md`).

It sits in Research & Science, covering Bioinformatics. It works with AnnData. The repository describes itself as: Conversational & memory-enabled AI research partner for multi-omics analysis. CLI + Desktop App (installers in Releases). From biological idea to full research paper. The licence is MIT.

When your agent uses it

  • Tasks that involve Bioinformatics

Example prompts

  • “/spatial-trajectory”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Load AnnData (--input) or build a demo. Auto-detect --cluster-key from candidates if not passed.
  2. Pick / pin root cell: --root-cell or auto-pick via expression-rank; write uns["iroot"] (_lib/trajectory.py:273).
  3. Run chosen backend
  4. Compute trajectory genes (correlation with pseudotime) + cluster-mean / median pseudotime summary.
  5. Render embedding / spatial / diffmap / fate / gene-trend plots.
  6. Save tables + processed.h5ad + report.

What it can do on your machine

Read from SKILL.md and the folder at commit 6fbd79f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python and R), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Spatial Trajectory loads about 1.8k tokens when it runs, and up to ~5.6k if it reads all its reference files. Until then it costs about 100 tokens; SKILL.md has 449 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~100
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from TianGzlab/OmicsClaw at commit 6fbd79f, republished under its MIT licence (© TianGzlab). 449 words, ~1,771 tokens.

Download SKILL.mdSave it as .claude/skills/spatial-trajectory/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
spatial-trajectory
description
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); non-spatial scRNA pseudotime (use sc-pseudotime).
version
0.5.0
author
OmicsClaw
license
MIT
emoji
🛤️
tags
spatial, trajectory, pseudotime, dpt, cellrank, palantir, lineage
requires
anndata, cellrank, matplotlib, numpy, palantir, pandas, scanpy, scipy, scvelo, seaborn, statsmodels

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 via sc.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

<!-- AUTO-GENERATED from skill.yaml (interface) — do not edit by hand. Regenerate: python scripts/generate_skill_md.py <skill_dir> -->

Inputs

  • File types: .h5ad
  • Requires a preprocessed AnnData (X normalised, PCA/neighbours present)
  • Expects obsm: X_pca

Outputs

  • tables/cellrank_driver_genes.csv
  • tables/palantir_branch_probs.csv
  • tables/trajectory_cluster_summary.csv
  • tables/trajectory_diffmap_points.csv
  • tables/trajectory_driver_genes.csv
  • tables/trajectory_fate_probabilities.csv
  • tables/trajectory_fate_probabilities_wide.csv
  • tables/trajectory_genes.csv
  • tables/trajectory_run_summary.csv
  • tables/trajectory_spatial_points.csv
  • tables/trajectory_summary.csv
  • tables/trajectory_terminal_states.csv
  • tables/trajectory_umap_points.csv
  • figures/cellrank_fate_circular.png
  • figures/cellrank_fate_heatmap.png
  • figures/cellrank_fate_map.png
  • figures/cellrank_gene_trends.png
  • figures/trajectory_cluster_summary.png
  • figures/trajectory_diffmap.png
  • figures/trajectory_entropy_distribution.png
  • figures/trajectory_fate_probability_distribution.png
  • figures/trajectory_genes_barplot.png
  • figures/trajectory_pseudotime_distribution.png
  • figures/trajectory_pseudotime_embedding.png
  • figures/trajectory_pseudotime_spatial.png
  • processed.h5ad
  • report.md
  • result.json
  • Processed AnnData (saves_h5ad) — adds obs: dpt_pseudotime, traj_terminal_state, traj_fate_max_prob, traj_fate_entropy, palantir_pseudotime, palantir_entropy; obsm: palantir_branch_probs; uns: iroot, palantir_waypoints, palantir_branch_prob_columns

Flow

  1. Load AnnData (--input) or build a demo. Auto-detect --cluster-key from candidates if not passed.
  2. Pick / pin root cell: --root-cell <barcode> or auto-pick via expression-rank; write uns["iroot"] (_lib/trajectory.py:273).
  3. 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.
  4. Compute trajectory genes (correlation with pseudotime) + cluster-mean / median pseudotime summary.
  5. Render embedding / spatial / diffmap / fate / gene-trend plots.
  6. Save tables + processed.h5ad + report.
Show full SKILL.md (232 more words)Show less

Gotchas

  • --cluster-key is auto-detected from a candidate list. _lib/trajectory.py:25-31 (_CLUSTER_KEY_CANDIDATES) tries leiden → cell_type → celltype → annotation → cluster → clusters and the auto-detect at _lib/trajectory.py:62-67 returns None silently when no candidate column has ≥ 2 unique values — cluster summaries then run with cluster_key = None. By contrast, an explicit --cluster-key X whose column is missing raises ValueError at spatial_trajectory.py:1434. Pass an explicit key when you want a hard failure on a typo.
  • Both dpt and cellrank write obs["dpt_pseudotime"]. _lib/trajectory.py:255-280 populates it via sc.tl.dpt; CellRank reuses the same call (_lib/trajectory.py:341). Palantir writes obs["palantir_pseudotime"] instead — don't expect dpt_pseudotime from a Palantir run.
  • Palantir branch probabilities are conditional + dual-stored. _lib/trajectory.py:531-533 writes obsm["palantir_branch_probs"] (numeric matrix) AND uns["palantir_branch_prob_columns"] (terminal-state column names) ONLY when branch_probs is 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 as tables/palantir_branch_probs.csv when present.
  • CellRank traj_* keys are CellRank-only. spatial_trajectory.py:236-238 writes obs["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:273 writes the integer position into obs_names. Downstream tools that reload the AnnData and expect a string barcode need adata.obs_names[adata.uns["iroot"]].

Key CLI

bash
# Demo
python omicsclaw.py run spatial-trajectory --demo --output /tmp/traj_demo

# DPT (default)
python omicsclaw.py run spatial-trajectory \
  --input preprocessed.h5ad --output results/ \
  --method dpt --cluster-key leiden --dpt-n-dcs 10

# CellRank with explicit root cell
python omicsclaw.py run spatial-trajectory \
  --input preprocessed.h5ad --output results/ \
  --method cellrank --root-cell BARCODE_42 \
  --cellrank-n-states 5 --cellrank-frac-to-keep 0.3

# Palantir
python omicsclaw.py run spatial-trajectory \
  --input preprocessed.h5ad --output results/ \
  --method palantir --palantir-num-waypoints 1200 --palantir-knn 30

See also

  • references/parameters.md — every CLI flag, per-method tunables
  • references/methodology.md — when each backend wins
  • references/output_contract.md — per-method obs / obsm / uns keys
  • Adjacent skills: spatial-preprocess (upstream), spatial-domains (upstream — provides obs["leiden"]), spatial-velocity (parallel — RNA-velocity-driven dynamics), sc-pseudotime (parallel — non-spatial), spatial-condition (downstream — DE between trajectory branches)

© TianGzlab, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 8 other files (references) in skills/spatial/spatial-trajectory of TianGzlab/OmicsClaw.

  • SKILL.md
  • r_visualization/README.md
  • r_visualization/trajectory_publication_template.R
  • references/methodology.md
  • references/output_contract.md
  • references/parameters.md
  • skill.yaml
  • spatial_trajectory.py
  • tests/test_spatial_trajectory.py

Open the folder on GitHubat commit 6fbd79f

Compare with similar skills

Spatial Trajectory next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Spatial Trajectory compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Spatial Trajectory this skillTianGzlab/OmicsClaw161—~1.8kAutomated safety check: PassMIT
Scanpy Single-Cell Analysisdavila7/claude-code-templates32k16 repos~2.8kAutomated safety check: PassMIT
ScgptJimLiu/science-skills2274 repos~1.3kAutomated safety check: PassApache-2.0
PyDESeq2 Differential Expressiondavila7/claude-code-templates32k12 repos~4kAutomated safety check: PassMIT
Anndatadavila7/claude-code-templates32k12 repos~2.5kAutomated safety check: PassMIT
Single-Cell Initial AnalysisLigphiDonk/Oh-my--paper7381 repos~1.4kAutomated safety check: PassMIT

Similar skills

  • Scanpy Single-Cell Analysis

    davila7/claude-code-templates

    Walks through single-cell RNA-seq analysis with Scanpy: loading .h5ad and 10X data, QC, normalization, PCA and UMAP, Leiden clustering, marker genes and cell type annotation.

    32k GitHub starsUsed in 16 repos~2.8k tokens
    Research & ScienceAuto-check passed
  • Scgpt

    JimLiu/science-skills

    Embed and annotate single-cell expression data with scGPT, a foundation model for single-cell biology.

    227 GitHub starsUsed in 4 repos~1.3k tokens
    Research & ScienceAuto-check passed
  • PyDESeq2 Differential Expression

    davila7/claude-code-templates

    Runs differential gene expression analysis on bulk RNA-seq counts with PyDESeq2: design formulas, Wald tests, FDR correction and volcano or MA plots.

    32k GitHub starsUsed in 12 repos~4k tokens
    Research & ScienceAuto-check passed
  • Anndata

    davila7/claude-code-templates

    This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling…

    32k GitHub starsUsed in 12 repos~2.5k tokens
    Research & ScienceAuto-check passed
  • Single-Cell Initial Analysis

    LigphiDonk/Oh-my--paper

    Runs a seven-step quality-control and exploration pipeline on scRNA-seq, CyTOF or flow cytometry data and writes a plain-language report of what it found.

    738 GitHub starsUsed in 1 repo~1.4k tokens
    Research & ScienceAuto-check passed
  • Single Cell Data Prep Qc

    harrisongzhang/TheVirtualBiotech

    Single-cell RNA-seq data preparation and quality control pipeline.

    118 GitHub stars~2.9k tokensUpdated 20 days ago
    Research & ScienceAuto-check passed

More from TianGzlab/OmicsClaw

All 95 skills in this repo
  • Bulkrna Batch Correction

    TianGzlab/OmicsClaw

    Load when removing batch effects from a multi-cohort bulk RNA-seq dataset using ComBat (R or Python implementation).

    161 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna Coexpression

    TianGzlab/OmicsClaw

    Load when discovering gene co-expression modules and hub genes in a bulk RNA-seq cohort via WGCNA-style soft-thresholded networks.

    161 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna De

    TianGzlab/OmicsClaw

    Load when comparing gene expression between two conditions in bulk RNA-seq count data.

    161 GitHub stars~976 tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna Deconvolution

    TianGzlab/OmicsClaw

    Load when estimating cell-type proportions in bulk RNA-seq samples from a single-cell or signature-matrix reference.

    161 GitHub stars~984 tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna Enrichment

    TianGzlab/OmicsClaw

    Load when running pathway / GO term enrichment on a bulk RNA-seq DE result list.

    161 GitHub stars~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna Geneid Mapping

    TianGzlab/OmicsClaw

    Load when converting gene identifiers between Ensembl, Entrez, and HGNC symbol in a bulk RNA-seq count matrix.

    161 GitHub stars~1k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Spatial Trajectory

What does Spatial Trajectory do?

Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint…. Spatial Trajectory is an agent skill from TianGzlab/OmicsClaw. 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).

When should I use Spatial Trajectory?

Spatial Trajectory fits situations like: tasks that involve Bioinformatics.

How do I install Spatial Trajectory in Claude Code?

Run `npx skills add TianGzlab/OmicsClaw --skill spatial-trajectory -a claude-code`. Or copy the skill folder (skills/spatial/spatial-trajectory in TianGzlab/OmicsClaw) into .claude/skills/spatial-trajectory in your project. Claude Code loads it when a task matches its description.

How do I install Spatial Trajectory in Codex?

Run `npx skills add TianGzlab/OmicsClaw --skill spatial-trajectory -a codex`. Or copy the skill folder (skills/spatial/spatial-trajectory in TianGzlab/OmicsClaw) into .agents/skills/spatial-trajectory in your project. Codex loads it when a task matches its description.

Can I use Spatial Trajectory in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add TianGzlab/OmicsClaw --skill spatial-trajectory -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/spatial-trajectory, .gemini/skills/spatial-trajectory, .github/skills/spatial-trajectory and .opencode/skills/spatial-trajectory in your project.

What does Spatial Trajectory need to run?

Going by SKILL.md and its folder, Spatial Trajectory needs Python and R for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Spatial Trajectory access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Spatial Trajectory safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Spatial Trajectory use?

Spatial Trajectory is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Spatial Trajectory use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.8k tokens, read only when the agent opens those files.

What are the alternatives to Spatial Trajectory?

Skills that share tags, products or a category with Spatial Trajectory: Scanpy Single-Cell Analysis (davila7/claude-code-templates, 32k stars), Scgpt (JimLiu/science-skills, 227 stars), PyDESeq2 Differential Expression (davila7/claude-code-templates, 32k stars) and Anndata (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Spatial Trajectory?

TianGzlab (a GitHub organization) maintains it in TianGzlab/OmicsClaw, which has 161 GitHub stars. The repository holds 95 skills in this directory. The repository was last updated on July 28, 2026.

Source: TianGzlab/OmicsClaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.