stat-agent 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stat_agent-0.1.0/LICENSE +29 -0
- stat_agent-0.1.0/PKG-INFO +198 -0
- stat_agent-0.1.0/README.md +146 -0
- stat_agent-0.1.0/pyproject.toml +121 -0
- stat_agent-0.1.0/setup.cfg +4 -0
- stat_agent-0.1.0/stat_agent/__init__.py +47 -0
- stat_agent-0.1.0/stat_agent/agent/__init__.py +5 -0
- stat_agent-0.1.0/stat_agent/agent/clarification_context.py +445 -0
- stat_agent-0.1.0/stat_agent/agent/conversation_orchestrator.py +795 -0
- stat_agent-0.1.0/stat_agent/agent/error_reflection.py +284 -0
- stat_agent-0.1.0/stat_agent/agent/executor.py +277 -0
- stat_agent-0.1.0/stat_agent/agent/llm_backend.py +1734 -0
- stat_agent-0.1.0/stat_agent/agent/memory.py +1063 -0
- stat_agent-0.1.0/stat_agent/agent/model_config.py +328 -0
- stat_agent-0.1.0/stat_agent/agent/notebook_logger.py +289 -0
- stat_agent-0.1.0/stat_agent/agent/pipeline_executor.py +720 -0
- stat_agent-0.1.0/stat_agent/agent/prompt_logger.py +282 -0
- stat_agent-0.1.0/stat_agent/agent/query_planner.py +388 -0
- stat_agent-0.1.0/stat_agent/agent/skill_filter.py +235 -0
- stat_agent-0.1.0/stat_agent/agent/skill_registry.py +728 -0
- stat_agent-0.1.0/stat_agent/agent/skill_verifier.py +418 -0
- stat_agent-0.1.0/stat_agent/agent/spatial_agent_core.py +4299 -0
- stat_agent-0.1.0/stat_agent/agent/tools.py +484 -0
- stat_agent-0.1.0/stat_agent/core/__init__.py +12 -0
- stat_agent-0.1.0/stat_agent/core/data_slice.py +344 -0
- stat_agent-0.1.0/stat_agent/core/roi_manager.py +447 -0
- stat_agent-0.1.0/stat_agent/core/session.py +885 -0
- stat_agent-0.1.0/stat_agent/functions/__init__.py +16 -0
- stat_agent-0.1.0/stat_agent/functions/io.py +735 -0
- stat_agent-0.1.0/stat_agent.egg-info/PKG-INFO +198 -0
- stat_agent-0.1.0/stat_agent.egg-info/SOURCES.txt +37 -0
- stat_agent-0.1.0/stat_agent.egg-info/dependency_links.txt +1 -0
- stat_agent-0.1.0/stat_agent.egg-info/entry_points.txt +2 -0
- stat_agent-0.1.0/stat_agent.egg-info/requires.txt +34 -0
- stat_agent-0.1.0/stat_agent.egg-info/top_level.txt +1 -0
- stat_agent-0.1.0/tests/test_celltype_optional.py +201 -0
- stat_agent-0.1.0/tests/test_llm_skill_matching.py +111 -0
- stat_agent-0.1.0/tests/test_new_pipeline.py +610 -0
- stat_agent-0.1.0/tests/test_niche_detection_integration.py +137 -0
stat_agent-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Yihang Chen
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stat-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: STAT: Spatial Transcriptomics Analytical agenT - AI-powered platform for spatial omics analysis
|
|
5
|
+
Author-email: Yihang Chen <ychenlp@connect.ust.hk>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/chenyhvvvv/STAT-agent
|
|
8
|
+
Project-URL: Repository, https://github.com/chenyhvvvv/STAT-agent
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/chenyhvvvv/STAT-agent/issues
|
|
10
|
+
Keywords: spatial transcriptomics,single-cell,agent,AI,bioinformatics,anndata,scanpy
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy>=1.21
|
|
23
|
+
Requires-Dist: pandas>=1.3
|
|
24
|
+
Requires-Dist: anndata>=0.9
|
|
25
|
+
Requires-Dist: scipy>=1.7
|
|
26
|
+
Requires-Dist: scanpy>=1.9
|
|
27
|
+
Requires-Dist: geopandas>=0.10
|
|
28
|
+
Requires-Dist: shapely>=2.0
|
|
29
|
+
Requires-Dist: pillow>=9.0
|
|
30
|
+
Requires-Dist: tifffile>=2021.0
|
|
31
|
+
Requires-Dist: matplotlib>=3.5
|
|
32
|
+
Requires-Dist: seaborn>=0.11
|
|
33
|
+
Requires-Dist: pyyaml>=6.0
|
|
34
|
+
Provides-Extra: llm
|
|
35
|
+
Requires-Dist: anthropic>=0.18; extra == "llm"
|
|
36
|
+
Requires-Dist: openai>=1.12; extra == "llm"
|
|
37
|
+
Requires-Dist: google-generativeai>=0.3; extra == "llm"
|
|
38
|
+
Provides-Extra: web
|
|
39
|
+
Requires-Dist: flask>=3.0; extra == "web"
|
|
40
|
+
Provides-Extra: skills
|
|
41
|
+
Requires-Dist: squidpy>=1.2; extra == "skills"
|
|
42
|
+
Requires-Dist: gseapy>=1.0; extra == "skills"
|
|
43
|
+
Requires-Dist: scvi-tools>=1.0; extra == "skills"
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
47
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
48
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: stat-agent[dev,llm,skills,web]; extra == "all"
|
|
51
|
+
Dynamic: license-file
|
|
52
|
+
|
|
53
|
+
# STAT
|
|
54
|
+
|
|
55
|
+
**Spatial Transcriptomics Analytical agenT**
|
|
56
|
+
|
|
57
|
+
An AI-powered platform for spatial omics analysis with multi-format support, interactive visualization, and intelligent code generation.
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **AI Agent**: Natural language interface for spatial transcriptomics analysis — ask questions, get results
|
|
62
|
+
- **Multi-format support**: Single-slice, multi-slice, and multi-omics (gene + protein) datasets
|
|
63
|
+
- **Interactive viewer**: Canvas-based spatial visualization with zoom/pan, ROI drawing, and cell overlays
|
|
64
|
+
- **Skill system**: Extensible analysis skills (cell type annotation, deconvolution, spatial domains, etc.)
|
|
65
|
+
- **Code execution**: Agent generates and runs analysis code in a sandboxed environment
|
|
66
|
+
- **Multi-provider LLM**: Works with OpenAI, Anthropic, Google, Deepseek, and Poe
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install stat-agent
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
With all optional dependencies:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install "stat-agent[all]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or install specific extras:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install "stat-agent[web]" # Flask web interface
|
|
84
|
+
pip install "stat-agent[llm]" # LLM providers
|
|
85
|
+
pip install "stat-agent[skills]" # Analysis skill dependencies
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Quick Start
|
|
89
|
+
|
|
90
|
+
### Web Interface
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
stat-web
|
|
94
|
+
# Open http://localhost:8889
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Or with the startup script (includes Jupyter Lab):
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
./start_web.sh
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### In the web UI:
|
|
104
|
+
|
|
105
|
+
1. Enter path to your dataset directory
|
|
106
|
+
2. Configure LLM (API key, model)
|
|
107
|
+
3. Click "Load Dataset"
|
|
108
|
+
4. Ask questions in the chat panel: *"Annotate cell types"*, *"Find spatially variable genes"*, *"Show BRCA1 expression"*
|
|
109
|
+
|
|
110
|
+
## Data Format
|
|
111
|
+
|
|
112
|
+
STAT auto-detects your data layout. Place files in a single directory:
|
|
113
|
+
|
|
114
|
+
**Single-slice:**
|
|
115
|
+
```
|
|
116
|
+
dataset/
|
|
117
|
+
├── tissue.h5ad # Required: AnnData with x, y coordinates in obs
|
|
118
|
+
└── he.tif # Optional: H&E image (pixel coords = cell coords)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Multi-slice:**
|
|
122
|
+
```
|
|
123
|
+
dataset/
|
|
124
|
+
├── tissue_slice_0.h5ad
|
|
125
|
+
├── he_slice_0.tif
|
|
126
|
+
├── tissue_slice_1.h5ad
|
|
127
|
+
└── he_slice_1.tif
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Multi-omics:**
|
|
131
|
+
```
|
|
132
|
+
dataset/
|
|
133
|
+
├── tissue.h5ad # Gene expression
|
|
134
|
+
├── tissue_protein.h5ad # Protein expression
|
|
135
|
+
├── he.tif
|
|
136
|
+
└── protein_CD3.tif
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Key**: Cell coordinates `(x, y)` in `adata.obs` map directly to image pixels `(x, y)`. No coordinate transformation needed.
|
|
140
|
+
|
|
141
|
+
## Built-in Skills
|
|
142
|
+
|
|
143
|
+
| Skill | Description |
|
|
144
|
+
|-------|-------------|
|
|
145
|
+
| Cell Type Annotation (GPT) | Unsupervised clustering + LLM-based annotation |
|
|
146
|
+
| Cell Type Annotation (scANVI) | Transfer learning from scRNA-seq reference |
|
|
147
|
+
| Deconvolution (RCTD) | Spot-level cell type deconvolution |
|
|
148
|
+
| Spatial Domains (SpaGCN) | Graph-based spatial domain identification |
|
|
149
|
+
| SVG (SpatialDE) | Spatially variable gene detection |
|
|
150
|
+
| Neighborhood Enrichment | Cell type co-localization analysis |
|
|
151
|
+
| Cell Communication (LIANA+) | Ligand-receptor interaction analysis |
|
|
152
|
+
| Cell Communication (CellPhoneDB) | Permutation-based interaction testing |
|
|
153
|
+
| GO Enrichment | Gene Ontology pathway analysis |
|
|
154
|
+
| Niche Detection (Harmonics) | Spatial niche identification |
|
|
155
|
+
| Integration (Harmony) | Multi-slice batch correction |
|
|
156
|
+
| Alignment (STalign) | Spatial slice alignment |
|
|
157
|
+
|
|
158
|
+
## Architecture
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
User Query → QueryPlanner → SkillFilter → LLM Matching → SkillVerifier → Code Generation → Execution
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- **QueryPlanner**: Determines target slices, breaks complex queries into steps
|
|
165
|
+
- **SkillFilter**: Programmatic filtering by modality, data level, number of slices
|
|
166
|
+
- **SkillVerifier**: Checks prerequisites, requests missing information
|
|
167
|
+
- **SpatialAgent**: Generates analysis code using skill instructions + session context
|
|
168
|
+
- **CodeExecutor**: Sandboxed execution with state change detection
|
|
169
|
+
|
|
170
|
+
## Project Structure
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
stat_agent/
|
|
174
|
+
├── core/ # Data layer
|
|
175
|
+
│ ├── session.py # Multi-slice/multi-omics session
|
|
176
|
+
│ ├── data_slice.py # Single data slice wrapper
|
|
177
|
+
│ └── roi_manager.py # ROI geometry management
|
|
178
|
+
├── agent/ # Agent pipeline
|
|
179
|
+
│ ├── spatial_agent_core.py
|
|
180
|
+
│ ├── conversation_orchestrator.py
|
|
181
|
+
│ ├── pipeline_executor.py
|
|
182
|
+
│ ├── query_planner.py
|
|
183
|
+
│ ├── skill_registry.py
|
|
184
|
+
│ ├── skill_filter.py
|
|
185
|
+
│ ├── skill_verifier.py
|
|
186
|
+
│ ├── llm_backend.py
|
|
187
|
+
│ └── memory.py
|
|
188
|
+
└── functions/
|
|
189
|
+
└── io.py # Data loading
|
|
190
|
+
.claude/skills/ # Skill definitions (SKILL.md + helper libs)
|
|
191
|
+
web_interface.py # Flask backend + API endpoints
|
|
192
|
+
static/ # Frontend (JS + CSS)
|
|
193
|
+
templates/ # HTML templates
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
BSD-3-Clause
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# STAT
|
|
2
|
+
|
|
3
|
+
**Spatial Transcriptomics Analytical agenT**
|
|
4
|
+
|
|
5
|
+
An AI-powered platform for spatial omics analysis with multi-format support, interactive visualization, and intelligent code generation.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **AI Agent**: Natural language interface for spatial transcriptomics analysis — ask questions, get results
|
|
10
|
+
- **Multi-format support**: Single-slice, multi-slice, and multi-omics (gene + protein) datasets
|
|
11
|
+
- **Interactive viewer**: Canvas-based spatial visualization with zoom/pan, ROI drawing, and cell overlays
|
|
12
|
+
- **Skill system**: Extensible analysis skills (cell type annotation, deconvolution, spatial domains, etc.)
|
|
13
|
+
- **Code execution**: Agent generates and runs analysis code in a sandboxed environment
|
|
14
|
+
- **Multi-provider LLM**: Works with OpenAI, Anthropic, Google, Deepseek, and Poe
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install stat-agent
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
With all optional dependencies:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install "stat-agent[all]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or install specific extras:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install "stat-agent[web]" # Flask web interface
|
|
32
|
+
pip install "stat-agent[llm]" # LLM providers
|
|
33
|
+
pip install "stat-agent[skills]" # Analysis skill dependencies
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
### Web Interface
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
stat-web
|
|
42
|
+
# Open http://localhost:8889
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or with the startup script (includes Jupyter Lab):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
./start_web.sh
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### In the web UI:
|
|
52
|
+
|
|
53
|
+
1. Enter path to your dataset directory
|
|
54
|
+
2. Configure LLM (API key, model)
|
|
55
|
+
3. Click "Load Dataset"
|
|
56
|
+
4. Ask questions in the chat panel: *"Annotate cell types"*, *"Find spatially variable genes"*, *"Show BRCA1 expression"*
|
|
57
|
+
|
|
58
|
+
## Data Format
|
|
59
|
+
|
|
60
|
+
STAT auto-detects your data layout. Place files in a single directory:
|
|
61
|
+
|
|
62
|
+
**Single-slice:**
|
|
63
|
+
```
|
|
64
|
+
dataset/
|
|
65
|
+
├── tissue.h5ad # Required: AnnData with x, y coordinates in obs
|
|
66
|
+
└── he.tif # Optional: H&E image (pixel coords = cell coords)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Multi-slice:**
|
|
70
|
+
```
|
|
71
|
+
dataset/
|
|
72
|
+
├── tissue_slice_0.h5ad
|
|
73
|
+
├── he_slice_0.tif
|
|
74
|
+
├── tissue_slice_1.h5ad
|
|
75
|
+
└── he_slice_1.tif
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Multi-omics:**
|
|
79
|
+
```
|
|
80
|
+
dataset/
|
|
81
|
+
├── tissue.h5ad # Gene expression
|
|
82
|
+
├── tissue_protein.h5ad # Protein expression
|
|
83
|
+
├── he.tif
|
|
84
|
+
└── protein_CD3.tif
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Key**: Cell coordinates `(x, y)` in `adata.obs` map directly to image pixels `(x, y)`. No coordinate transformation needed.
|
|
88
|
+
|
|
89
|
+
## Built-in Skills
|
|
90
|
+
|
|
91
|
+
| Skill | Description |
|
|
92
|
+
|-------|-------------|
|
|
93
|
+
| Cell Type Annotation (GPT) | Unsupervised clustering + LLM-based annotation |
|
|
94
|
+
| Cell Type Annotation (scANVI) | Transfer learning from scRNA-seq reference |
|
|
95
|
+
| Deconvolution (RCTD) | Spot-level cell type deconvolution |
|
|
96
|
+
| Spatial Domains (SpaGCN) | Graph-based spatial domain identification |
|
|
97
|
+
| SVG (SpatialDE) | Spatially variable gene detection |
|
|
98
|
+
| Neighborhood Enrichment | Cell type co-localization analysis |
|
|
99
|
+
| Cell Communication (LIANA+) | Ligand-receptor interaction analysis |
|
|
100
|
+
| Cell Communication (CellPhoneDB) | Permutation-based interaction testing |
|
|
101
|
+
| GO Enrichment | Gene Ontology pathway analysis |
|
|
102
|
+
| Niche Detection (Harmonics) | Spatial niche identification |
|
|
103
|
+
| Integration (Harmony) | Multi-slice batch correction |
|
|
104
|
+
| Alignment (STalign) | Spatial slice alignment |
|
|
105
|
+
|
|
106
|
+
## Architecture
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
User Query → QueryPlanner → SkillFilter → LLM Matching → SkillVerifier → Code Generation → Execution
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- **QueryPlanner**: Determines target slices, breaks complex queries into steps
|
|
113
|
+
- **SkillFilter**: Programmatic filtering by modality, data level, number of slices
|
|
114
|
+
- **SkillVerifier**: Checks prerequisites, requests missing information
|
|
115
|
+
- **SpatialAgent**: Generates analysis code using skill instructions + session context
|
|
116
|
+
- **CodeExecutor**: Sandboxed execution with state change detection
|
|
117
|
+
|
|
118
|
+
## Project Structure
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
stat_agent/
|
|
122
|
+
├── core/ # Data layer
|
|
123
|
+
│ ├── session.py # Multi-slice/multi-omics session
|
|
124
|
+
│ ├── data_slice.py # Single data slice wrapper
|
|
125
|
+
│ └── roi_manager.py # ROI geometry management
|
|
126
|
+
├── agent/ # Agent pipeline
|
|
127
|
+
│ ├── spatial_agent_core.py
|
|
128
|
+
│ ├── conversation_orchestrator.py
|
|
129
|
+
│ ├── pipeline_executor.py
|
|
130
|
+
│ ├── query_planner.py
|
|
131
|
+
│ ├── skill_registry.py
|
|
132
|
+
│ ├── skill_filter.py
|
|
133
|
+
│ ├── skill_verifier.py
|
|
134
|
+
│ ├── llm_backend.py
|
|
135
|
+
│ └── memory.py
|
|
136
|
+
└── functions/
|
|
137
|
+
└── io.py # Data loading
|
|
138
|
+
.claude/skills/ # Skill definitions (SKILL.md + helper libs)
|
|
139
|
+
web_interface.py # Flask backend + API endpoints
|
|
140
|
+
static/ # Frontend (JS + CSS)
|
|
141
|
+
templates/ # HTML templates
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
BSD-3-Clause
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stat-agent"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "STAT: Spatial Transcriptomics Analytical agenT - AI-powered platform for spatial omics analysis"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "BSD-3-Clause"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Yihang Chen", email = "ychenlp@connect.ust.hk"},
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"spatial transcriptomics",
|
|
17
|
+
"single-cell",
|
|
18
|
+
"agent",
|
|
19
|
+
"AI",
|
|
20
|
+
"bioinformatics",
|
|
21
|
+
"anndata",
|
|
22
|
+
"scanpy",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 3 - Alpha",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.9",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
dependencies = [
|
|
36
|
+
# Core data
|
|
37
|
+
"numpy>=1.21",
|
|
38
|
+
"pandas>=1.3",
|
|
39
|
+
"anndata>=0.9",
|
|
40
|
+
"scipy>=1.7",
|
|
41
|
+
"scanpy>=1.9",
|
|
42
|
+
|
|
43
|
+
# Spatial geometry
|
|
44
|
+
"geopandas>=0.10",
|
|
45
|
+
"shapely>=2.0",
|
|
46
|
+
|
|
47
|
+
# Imaging
|
|
48
|
+
"pillow>=9.0",
|
|
49
|
+
"tifffile>=2021.0",
|
|
50
|
+
|
|
51
|
+
# Visualization
|
|
52
|
+
"matplotlib>=3.5",
|
|
53
|
+
"seaborn>=0.11",
|
|
54
|
+
|
|
55
|
+
# Config
|
|
56
|
+
"pyyaml>=6.0",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[project.optional-dependencies]
|
|
60
|
+
# LLM providers
|
|
61
|
+
llm = [
|
|
62
|
+
"anthropic>=0.18",
|
|
63
|
+
"openai>=1.12",
|
|
64
|
+
"google-generativeai>=0.3",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
# Web interface
|
|
68
|
+
web = [
|
|
69
|
+
"flask>=3.0",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
# Skill dependencies (for specific analysis skills)
|
|
73
|
+
skills = [
|
|
74
|
+
"squidpy>=1.2",
|
|
75
|
+
"gseapy>=1.0",
|
|
76
|
+
"scvi-tools>=1.0",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
# Development
|
|
80
|
+
dev = [
|
|
81
|
+
"pytest>=7.0",
|
|
82
|
+
"pytest-cov>=4.0",
|
|
83
|
+
"pytest-asyncio>=0.23",
|
|
84
|
+
"ruff>=0.1",
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
# All optional dependencies
|
|
88
|
+
all = [
|
|
89
|
+
"stat-agent[llm,web,skills,dev]",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[project.scripts]
|
|
93
|
+
stat-web = "web_interface:main"
|
|
94
|
+
|
|
95
|
+
[project.urls]
|
|
96
|
+
Homepage = "https://github.com/chenyhvvvv/STAT-agent"
|
|
97
|
+
Repository = "https://github.com/chenyhvvvv/STAT-agent"
|
|
98
|
+
"Bug Tracker" = "https://github.com/chenyhvvvv/STAT-agent/issues"
|
|
99
|
+
|
|
100
|
+
[tool.setuptools.packages.find]
|
|
101
|
+
where = ["."]
|
|
102
|
+
include = ["stat_agent*"]
|
|
103
|
+
exclude = ["tests*", "docs*", "external*", "paper*", "examples*"]
|
|
104
|
+
|
|
105
|
+
[tool.setuptools.package-data]
|
|
106
|
+
"*" = ["*.md", "*.yaml", "*.yml"]
|
|
107
|
+
|
|
108
|
+
[tool.pytest.ini_options]
|
|
109
|
+
testpaths = ["tests"]
|
|
110
|
+
python_files = "test_*.py"
|
|
111
|
+
python_classes = "Test*"
|
|
112
|
+
python_functions = "test_*"
|
|
113
|
+
asyncio_mode = "auto"
|
|
114
|
+
|
|
115
|
+
[tool.ruff]
|
|
116
|
+
line-length = 120
|
|
117
|
+
target-version = "py39"
|
|
118
|
+
|
|
119
|
+
[tool.ruff.lint]
|
|
120
|
+
select = ["E", "F", "W"]
|
|
121
|
+
ignore = ["E501"]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
STAT
|
|
3
|
+
|
|
4
|
+
Spatial Transcriptomics Analytical agenT
|
|
5
|
+
|
|
6
|
+
Your AI Laboratory for Spatial Transcriptomics Analysis.
|
|
7
|
+
An AI-powered platform for spatial omics analysis with multi-format support,
|
|
8
|
+
interactive visualization, and intelligent code generation.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
__version__ = "0.1.0"
|
|
12
|
+
|
|
13
|
+
from stat_agent.core.session import SimpleSession
|
|
14
|
+
from stat_agent.core.roi_manager import ROIManager, ROI
|
|
15
|
+
|
|
16
|
+
# Import and expose IO functions
|
|
17
|
+
from stat_agent.functions.io import (
|
|
18
|
+
load_anndata,
|
|
19
|
+
load_image,
|
|
20
|
+
load_data,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"SimpleSession",
|
|
25
|
+
"ROIManager",
|
|
26
|
+
"ROI",
|
|
27
|
+
"load_anndata",
|
|
28
|
+
"load_image",
|
|
29
|
+
"load_data",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def create_session(name="session"):
|
|
34
|
+
"""
|
|
35
|
+
Create a new simplified spatial analysis session.
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
name : str
|
|
40
|
+
Session name
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
SimpleSession
|
|
45
|
+
Initialized session object
|
|
46
|
+
"""
|
|
47
|
+
return SimpleSession(name=name)
|