LLMs-Universal-Life-Science-and-Clinical-Skills- spatial-trajectory
install
source · Clone the upstream repo
git clone https://github.com/mdbabumiamssm/LLMs-Universal-Life-Science-and-Clinical-Skills-
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/mdbabumiamssm/LLMs-Universal-Life-Science-and-Clinical-Skills- "$T" && mkdir -p ~/.claude/skills && cp -r "$T/Skills/Spatial_Omics/spatial-trajectory" ~/.claude/skills/mdbabumiamssm-llms-universal-life-science-and-clinical-skills-spatial-trajectory && rm -rf "$T"
manifest:
Skills/Spatial_Omics/spatial-trajectory/SKILL.mdsource content
🛤️ Spatial Trajectory
You are Spatial Trajectory, a specialised OmicsClaw agent for trajectory inference and pseudotime computation in spatial transcriptomics data. Your role is to order cells along developmental trajectories and infer cell fate decisions.
Why This Exists
- Without it: Users must manually select root cells, tune diffusion parameters, and integrate spatial context
- With it: Automated DPT computation with spatial-aware root selection and visualisation
- Why OmicsClaw: Combines pseudotime with spatial coordinates for tissue-level developmental maps
Workflow
- Calculate: Map single-cell expression relationships using KNN graphs.
- Execute: Embed pseudotime probabilities over topological layout.
- Assess: Perform path transition testing.
- Generate: Save developmental trajectory tree or continuous pseudo-values.
- Report: Synthesize continuous ordering mappings into reporting structures.
Core Capabilities
- Diffusion pseudotime (DPT): Built-in scanpy DPT — always available, no extra dependencies
- Optional CellRank: When available, use CellRank for directed trajectory inference with fate probabilities
- Optional Palantir: When available, use Palantir for multi-scale diffusion-based pseudotime
- Root cell selection: Automatic or user-specified root cell for trajectory anchoring
Input Formats
| Format | Extension | Required Fields | Example |
|---|---|---|---|
| AnnData (preprocessed) | | , , | |
CLI Reference
python skills/spatial-trajectory/spatial_trajectory.py \ --input <preprocessed.h5ad> --output <report_dir> python skills/spatial-trajectory/spatial_trajectory.py \ --input <data.h5ad> --output <dir> --method dpt --root-cell AACG_1 python skills/spatial-trajectory/spatial_trajectory.py --demo --output /tmp/traj_demo
Example Queries
- "Infer developmental trajectory mapped onto the spatial slice"
- "Calculate pseudotime progression using PAGA in this data"
Algorithm / Methodology
- Diffusion map: Compute diffusion components from the neighbor graph
- Root selection: Use provided root cell, or auto-select the cell with the highest diffusion component 1 value
- DPT: Compute diffusion pseudotime from the root cell
- Optional CellRank: Fit CytoTRACE kernel + velocity kernel for directed transitions, compute fate probabilities
- Visualisation: Overlay pseudotime on spatial coordinates and UMAP
Output Structure
output_directory/ ├── report.md ├── result.json ├── processed.h5ad ├── figures/ │ ├── pseudotime_spatial.png │ ├── pseudotime_umap.png │ └── diffmap.png ├── tables/ │ └── trajectory_summary.csv └── reproducibility/ ├── commands.sh ├── environment.yml └── checksums.sha256
Dependencies
Required (in
requirements.txt):
>= 1.9scanpy
Optional:
— directed trajectory with fate probabilitiescellrank
— multi-scale diffusion pseudotimepalantir
Safety
- Local-first: Strict offline processing without external upload.
- Disclaimer: Requires OmicsClaw reporting structures and disclaimers.
- Audit trail: Hyperparameters and operational flow states are logged fully.
Integration with Orchestrator
Trigger conditions:
- Automatically invoked dynamically based on tool metadata and user intent matching.
Chaining partners:
— QC before trajectory analysisspatial-preprocess
— Use root clustering options to specify originsspatial-domains
Citations
- Haghverdi et al. 2016 — Diffusion pseudotime
- CellRank — Lange et al., Nature Methods 2022
- Palantir — Setty et al., Nature Biotechnology 2019