| name | spatial-trajectory |
| description | Trajectory inference and pseudotime analysis for spatial transcriptomics data. |
| version | 0.2.0 |
| author | SpatialClaw Team |
| license | MIT |
| tags | ["spatial","trajectory","pseudotime","DPT","CellRank","Palantir"] |
| metadata | {"omicsclaw":{"domain":"spatial","requires":{"bins":"[Truncated]","env":"[Truncated]","config":"[Truncated]"},"emoji":"🛤️","homepage":"https://github.com/zhou-1314/OmicsClaw","os":["macos","linux"],"install":["[Truncated]"],"trigger_keywords":["trajectory","pseudotime","DPT","diffusion pseudotime","CellRank","Palantir","cell fate"]}} |
🛤️ 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) | .h5ad | X, obsm["X_pca"], uns["neighbors"] | preprocessed.h5ad |
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):
Optional:
cellrank — directed trajectory with fate probabilities
palantir — multi-scale diffusion pseudotime
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:
spatial-preprocess — QC before trajectory analysis
spatial-domains — Use root clustering options to specify origins
Citations