Delete AGENTS.md
Browse files
AGENTS.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
| 1 |
-
# ZSP β Agent Guide
|
| 2 |
-
|
| 3 |
-
**What it is.** Gradio web app that scores protein sequence variants using ESM2, E1, and ESMC language models. Implements ESM-Scan methodology ([doi:10.1002/pro.5221](https://doi.org/10.1002/pro.5221)).
|
| 4 |
-
|
| 5 |
-
## Structure
|
| 6 |
-
|
| 7 |
-
```
|
| 8 |
-
app.py β Gradio UI, entry point
|
| 9 |
-
model.py β ModelFactory + wrappers for ESM/E1/ESMC models
|
| 10 |
-
data.py β Input parsing, scoring modes, output rendering (heatmap/table)
|
| 11 |
-
requirements.txt β deps (gradio, torch, esm[Biohub], pandas, seaborn, E1)
|
| 12 |
-
header.md β UI header text
|
| 13 |
-
instructions.md β user instructions tab content
|
| 14 |
-
out.* β generated outputs (gitignored)
|
| 15 |
-
```
|
| 16 |
-
|
| 17 |
-
## Run
|
| 18 |
-
|
| 19 |
-
```bash
|
| 20 |
-
source .venv/bin/activate # or however you activate
|
| 21 |
-
python app.py
|
| 22 |
-
```
|
| 23 |
-
|
| 24 |
-
Deploys as a HuggingFace Space (`sdk: gradio`, `app_file: app.py`). Python 3.12.
|
| 25 |
-
|
| 26 |
-
## Scoring Modes
|
| 27 |
-
|
| 28 |
-
Parsed from the substitutions input in `data.py`:
|
| 29 |
-
|
| 30 |
-
| Mode | Trigger | What it does |
|
| 31 |
-
|------|---------|-------------|
|
| 32 |
-
| **TMS** (triple mutational scan) | No match to other patterns | All-positions Γ all-amino-acids sweep β heatmap image |
|
| 33 |
-
| **DMS** (deep mutational scan) | All tokens are integers | Specified positions Γ all alternatives β sorted table |
|
| 34 |
-
| **MUT** (single mutations) | Tokens match `[A-Z]\d+[A-Z]` | Explicit substitution list β scored table |
|
| 35 |
-
| **MUT-seq-vs-seq** | Single token same length as sequence | Align two sequences, score differences β scored table |
|
| 36 |
-
|
| 37 |
-
Scoring strategy flag: `"masked-marginals"` (higher accuracy, slower) vs `"wt-marginals"`.
|
| 38 |
-
|
| 39 |
-
## Key Design Notes
|
| 40 |
-
|
| 41 |
-
- Models loaded lazily via `ModelFactory`; ESM and ESMC use shared `ESMModel` wrapper, E1 uses its own package (`E1@git+...`)
|
| 42 |
-
- ESMC requires `esm@git+Biohub/esm` β registers custom `esmc` architecture with transformers fork
|
| 43 |
-
- GPU auto-detected; falls back to CPU
|
| 44 |
-
- E1 model chunks batches at 60 to avoid OOM
|
| 45 |
-
- TMS mode produces a seaborn heatmap PNG; other modes produce styled HTML tables
|
| 46 |
-
- Output files always written to `out.csv` / `out.png` in CWD
|
| 47 |
-
- Progress tracking wired into Gradio's `Progress` object
|
| 48 |
-
|
| 49 |
-
## Edit Rules
|
| 50 |
-
|
| 51 |
-
- Match existing style: one-line docstrings on classes/methods, minimal comments
|
| 52 |
-
- No new dependencies unless absolutely necessary β stdlib or already-installed first
|
| 53 |
-
- Torch/transformers signatures: grep before guessing versions
|
| 54 |
-
- Output format changes affect both CSV and image/table paths β update both
|
| 55 |
-
- ModelFactory registry is class-level `_models` dict; adding a model type means registering there
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|