Spatial Transcriptomics Agent
Run STAgent to align histology images with expression matrices, perform clustering/SVG detection, and generate literature-backed spatial reports.
When to Use
- Analysis of Visium/Xenium or similar ST datasets.
- Visual reasoning over spatial plots, H&E images, or cluster maps.
- Automatically generating Scanpy/Squidpy code for new ST workflows.
- Hypothesis generation about spatial gene expression patterns.
Core Capabilities
- Dynamic code generation: Create/execute Python scripts for QC, clustering, SVG detection.
- Visual reasoning: Interpret spatial plots to identify tissue domains and cell neighborhoods.
- Literature retrieval: Pull references that contextualize findings.
- Report generation: Deliver publication-style writeups with plots and SVG tables.
Workflow
- Env setup:
conda env create -f environment.yml && conda activate STAgent.
- Data prep: Supply
expression_path (.h5ad/Spaceranger) + image_path (H&E/IF) and metadata.
- Task selection: Choose tasks such as
cluster, find_svg, annotate_domains, or composite instructions; run python repo/src/main.py --data_path ... --task "...".
- Execute & interpret: Let STAgent generate scripts, run analyses, and interpret results with literature references.
- Package outputs: Save UMAP/spatial plots, SVG tables, QC details, and summary markdown.
Example Usage
User: "Analyze this breast cancer ST dataset, find immune infiltrates."
Agent: loads data, runs `sqidpy.gr.spatial_neighbors`, computes Leiden clusters, plots marker genes (CD3D, CD19), and summarizes which clusters map to tumor core vs. stromal/immune zones.
Guardrails
- Document coordinate systems and any scaling between imaging and expression coordinates.
- Avoid definitive cell-type labels without supporting markers.
- Capture QC parameters for reproducibility.
References
1---2name: spatial-transcriptomics-agent3description: Spatial analyst4license: MIT5---67<!--8# COPYRIGHT NOTICE9# This file is part of the "Universal Biomedical Skills" project.10# Copyright (c) 2026 MD BABU MIA, PhD <md.babu.mia@mssm.edu>11# All Rights Reserved.12#13# This code is proprietary and confidential.14# Unauthorized copying of this file, via any medium is strictly prohibited.15#16# Provenance: Authenticated by MD BABU MIA1718-->192021# Spatial Transcriptomics Agent2223Run STAgent to align histology images with expression matrices, perform clustering/SVG detection, and generate literature-backed spatial reports.2425## When to Use26- Analysis of Visium/Xenium or similar ST datasets.27- Visual reasoning over spatial plots, H&E images, or cluster maps.28- Automatically generating Scanpy/Squidpy code for new ST workflows.29- Hypothesis generation about spatial gene expression patterns.3031## Core Capabilities321. **Dynamic code generation:** Create/execute Python scripts for QC, clustering, SVG detection.332. **Visual reasoning:** Interpret spatial plots to identify tissue domains and cell neighborhoods.343. **Literature retrieval:** Pull references that contextualize findings.354. **Report generation:** Deliver publication-style writeups with plots and SVG tables.3637## Workflow381. **Env setup:** `conda env create -f environment.yml && conda activate STAgent`.392. **Data prep:** Supply `expression_path` (`.h5ad`/Spaceranger) + `image_path` (H&E/IF) and metadata.403. **Task selection:** Choose tasks such as `cluster`, `find_svg`, `annotate_domains`, or composite instructions; run `python repo/src/main.py --data_path ... --task "..."`.414. **Execute & interpret:** Let STAgent generate scripts, run analyses, and interpret results with literature references.425. **Package outputs:** Save UMAP/spatial plots, SVG tables, QC details, and summary markdown.4344## Example Usage45```text46User: "Analyze this breast cancer ST dataset, find immune infiltrates."47Agent: loads data, runs `sqidpy.gr.spatial_neighbors`, computes Leiden clusters, plots marker genes (CD3D, CD19), and summarizes which clusters map to tumor core vs. stromal/immune zones.48```4950## Guardrails51- Document coordinate systems and any scaling between imaging and expression coordinates.52- Avoid definitive cell-type labels without supporting markers.53- Capture QC parameters for reproducibility.5455## References56- Source repo: https://github.com/LiuLab-Bioelectronics-Harvard/STAgent57- See local `README.md` for detailed instructions.585960<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->