Skip to main content

STAT: Spatial Transcriptomics Analytical agenT - AI-powered platform for spatial omics analysis

Project description

STAT

Spatial Transcriptomics Analytical agenT

An AI-powered platform for spatial omics analysis with multi-format support, interactive visualization, and intelligent code generation.

Features

  • AI Agent: Natural language interface for spatial transcriptomics analysis — ask questions, get results
  • Multi-format support: Single-slice, multi-slice, and multi-omics (gene + protein) datasets
  • Interactive viewer: Canvas-based spatial visualization with zoom/pan, ROI drawing, and cell overlays
  • Skill system: Extensible analysis skills (cell type annotation, deconvolution, spatial domains, etc.)
  • Code execution: Agent generates and runs analysis code in a sandboxed environment
  • Multi-provider LLM: Works with OpenAI, Anthropic, Google, Deepseek, and Poe

Installation

pip install stat-agent

With all optional dependencies:

pip install "stat-agent[all]"

Or install specific extras:

pip install "stat-agent[web]"      # Flask web interface
pip install "stat-agent[llm]"      # LLM providers
pip install "stat-agent[skills]"   # Analysis skill dependencies

Quick Start

Web Interface

stat-web
# Open http://localhost:8889

Or with the startup script (includes Jupyter Lab):

./start_web.sh

In the web UI:

  1. Enter path to your dataset directory
  2. Configure LLM (API key, model)
  3. Click "Load Dataset"
  4. Ask questions in the chat panel: "Annotate cell types", "Find spatially variable genes", "Show BRCA1 expression"

Data Format

STAT auto-detects your data layout. Place files in a single directory:

Single-slice:

dataset/
├── tissue.h5ad          # Required: AnnData with x, y coordinates in obs
└── he.tif               # Optional: H&E image (pixel coords = cell coords)

Multi-slice:

dataset/
├── tissue_slice_0.h5ad
├── he_slice_0.tif
├── tissue_slice_1.h5ad
└── he_slice_1.tif

Multi-omics:

dataset/
├── tissue.h5ad          # Gene expression
├── tissue_protein.h5ad  # Protein expression
├── he.tif
└── protein_CD3.tif

Key: Cell coordinates (x, y) in adata.obs map directly to image pixels (x, y). No coordinate transformation needed.

Built-in Skills

Skill Description
Cell Type Annotation (GPT) Unsupervised clustering + LLM-based annotation
Cell Type Annotation (scANVI) Transfer learning from scRNA-seq reference
Deconvolution (RCTD) Spot-level cell type deconvolution
Spatial Domains (SpaGCN) Graph-based spatial domain identification
SVG (SpatialDE) Spatially variable gene detection
Neighborhood Enrichment Cell type co-localization analysis
Cell Communication (LIANA+) Ligand-receptor interaction analysis
Cell Communication (CellPhoneDB) Permutation-based interaction testing
GO Enrichment Gene Ontology pathway analysis
Niche Detection (Harmonics) Spatial niche identification
Integration (Harmony) Multi-slice batch correction
Alignment (STalign) Spatial slice alignment

Architecture

User Query → QueryPlanner → SkillFilter → LLM Matching → SkillVerifier → Code Generation → Execution
  • QueryPlanner: Determines target slices, breaks complex queries into steps
  • SkillFilter: Programmatic filtering by modality, data level, number of slices
  • SkillVerifier: Checks prerequisites, requests missing information
  • SpatialAgent: Generates analysis code using skill instructions + session context
  • CodeExecutor: Sandboxed execution with state change detection

Project Structure

stat_agent/
├── core/                  # Data layer
│   ├── session.py         # Multi-slice/multi-omics session
│   ├── data_slice.py      # Single data slice wrapper
│   └── roi_manager.py     # ROI geometry management
├── agent/                 # Agent pipeline
│   ├── spatial_agent_core.py
│   ├── conversation_orchestrator.py
│   ├── pipeline_executor.py
│   ├── query_planner.py
│   ├── skill_registry.py
│   ├── skill_filter.py
│   ├── skill_verifier.py
│   ├── llm_backend.py
│   └── memory.py
└── functions/
    └── io.py              # Data loading
.claude/skills/            # Skill definitions (SKILL.md + helper libs)
web_interface.py           # Flask backend + API endpoints
static/                    # Frontend (JS + CSS)
templates/                 # HTML templates

License

BSD-3-Clause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stat_agent-0.1.0.tar.gz (134.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stat_agent-0.1.0-py3-none-any.whl (138.0 kB view details)

Uploaded Python 3

File details

Details for the file stat_agent-0.1.0.tar.gz.

File metadata

  • Download URL: stat_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 134.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stat_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6461fb7ba40cb6ea8b188ff2a83dffeff9fce0c0c3b3a0f7c2d64a452fa235bd
MD5 b2bb687781247d2d0cd705ea9eff2d26
BLAKE2b-256 458ae5687af607b7189a22a857b2d3ac2525c5c4b91c23c97ea13f9a22681bed

See more details on using hashes here.

Provenance

The following attestation bundles were made for stat_agent-0.1.0.tar.gz:

Publisher: publish.yml on chenyhvvvv/STAT-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stat_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stat_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 138.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stat_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d414ac16dec8da1c7c9fdb2e127d96048dec10fcc464305b768d0e165ef57e9f
MD5 b511db1a54ef429821539819a50b752a
BLAKE2b-256 576a392a70967ae1355dda2a3aace40532948534ddc4138c196928d4c7d70ff9

See more details on using hashes here.

Provenance

The following attestation bundles were made for stat_agent-0.1.0-py3-none-any.whl:

Publisher: publish.yml on chenyhvvvv/STAT-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page