proteinground 0.2.1__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.
- proteinground-0.2.1/.gitignore +11 -0
- proteinground-0.2.1/CHANGELOG.md +48 -0
- proteinground-0.2.1/LICENSE +21 -0
- proteinground-0.2.1/PKG-INFO +231 -0
- proteinground-0.2.1/README.md +204 -0
- proteinground-0.2.1/pyproject.toml +86 -0
- proteinground-0.2.1/src/proteinground/__init__.py +3 -0
- proteinground-0.2.1/src/proteinground/alphafold.py +276 -0
- proteinground-0.2.1/src/proteinground/eval/__init__.py +1 -0
- proteinground-0.2.1/src/proteinground/eval/agent.py +360 -0
- proteinground-0.2.1/src/proteinground/eval/cli.py +207 -0
- proteinground-0.2.1/src/proteinground/eval/cost.py +54 -0
- proteinground-0.2.1/src/proteinground/eval/goldcheck.py +169 -0
- proteinground-0.2.1/src/proteinground/eval/grade.py +299 -0
- proteinground-0.2.1/src/proteinground/eval/report.py +241 -0
- proteinground-0.2.1/src/proteinground/eval/schema.py +91 -0
- proteinground-0.2.1/src/proteinground/eval/stub.py +119 -0
- proteinground-0.2.1/src/proteinground/fetch.py +291 -0
- proteinground-0.2.1/src/proteinground/models.py +241 -0
- proteinground-0.2.1/src/proteinground/pdb.py +616 -0
- proteinground-0.2.1/src/proteinground/server.py +187 -0
- proteinground-0.2.1/src/proteinground/tools.py +241 -0
- proteinground-0.2.1/src/proteinground/uniprot.py +769 -0
- proteinground-0.2.1/src/proteinground/version.py +3 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
Fixes
|
|
6
|
+
- The MCP server now forwards every parameter description and numeric bound from `tools.py` into its advertised `inputSchema`, matching what the eval agent sees.
|
|
7
|
+
- `PROTEINGROUND_CACHE_DIR` expands `~` (`~/.cache/proteinground` now writes to the user's home directory instead of a literal `./~/` folder).
|
|
8
|
+
- `list_structures(method=...)` understands common method names (`cryo-EM`, `X-RAY DIFFRACTION`, `electron microscopy`) instead of returning `found: false`, and reports unknown method filters without claiming no structures exist.
|
|
9
|
+
- Isoform-numbered variants and features no longer collide with canonical position lookups in `get_variants` and `get_features`.
|
|
10
|
+
- `get_alphafold_summary` selects the covering fragment when a long protein has multiple fragments, reports available isoform models when AlphaFold DB has no canonical model (e.g. dystrophin `P11532`), and accepts `model_id` to inspect a specific isoform or fragment.
|
|
11
|
+
- `get_structure` includes `r_free` and `r_work` for refined X-ray structures, distinguishes metal ions (`ZN`, `MG`, `CA`, etc.) from crystallisation additives, and keeps all source organisms on chimeric polymers.
|
|
12
|
+
- `map_structure_residue` accepts lowercase insertion codes and an optional `uniprot_accession` to disambiguate fusion chains.
|
|
13
|
+
- `search_proteins` rejects empty queries as invalid input and suggests `reviewed_only=False` when a Swiss-Prot-only search returns no hits.
|
|
14
|
+
- `Fetcher` stops accumulating `urls_seen` unboundedly in long-lived MCP servers, uses thread-safe temp paths for atomic cache writes, and respects `Retry-After` on HTTP 429.
|
|
15
|
+
- `proteinground-eval report` preserves scientific notation for small exact p-values (`< 0.0001`) instead of rounding them to `0.0`.
|
|
16
|
+
|
|
17
|
+
Eval v2
|
|
18
|
+
- Results, Claude Opus 5.5, 23 to 24 Nov 2026 (`evals/v2/results/2026-11-24-opus-5-5/`): three runs of each arm under each prompt. With no warning in the prompt the tools arm answered 100.0% of the 140 answerable questions and caught 91.4% of the 35 planted premises, against 32.9% and 60.0% closed book (medians). Nine of ten preregistered bars passed; the closed-book arm's run-to-run spread (5.7 points against 5) missed.
|
|
19
|
+
- `evals/v2/`: 175 questions on 43 long-tail proteins drawn from UniProtKB searches by seed (reviewed entries with low annotation scores, unreviewed entries, no model organisms), with families for the 0.2.0 tools: structure-to-sequence numbering, insertion codes, modelled residues, differences between a structure and the canonical sequence, substitutions checked with `get_variants`, isoform numbering and obsolete PDB entries. A fifth are planted false premises; each asks for something that is not there and shares its wording with an answerable twin.
|
|
20
|
+
- `proteinground-eval run --prompt primed|unprimed`: `primed` is the prompt v1 ran with; `unprimed` gives no warning about false premises and no instruction to look values up. `--max-miss-episodes` stops a run that keeps reading records outside its snapshot.
|
|
21
|
+
- Two answer types with their own graders and decoys: `mutation` (K123A, Lys123Ala) and `position` (a residue position, read strictly).
|
|
22
|
+
- `proteinground-eval report` summarises repeated runs of one arm by their median and range, and summaries carry `premise_discrimination` (false premises caught minus false alarms).
|
|
23
|
+
- Fallback models have price rows, so tokens a fallback served count toward a run's spend cap.
|
|
24
|
+
- The v1 questions, snapshot, preregistration and results are untouched; the published episodes regrade to the same outcomes.
|
|
25
|
+
|
|
26
|
+
## 0.2.0
|
|
27
|
+
|
|
28
|
+
Fixes
|
|
29
|
+
- An HTTP 400 from UniProtKB, RCSB PDB or AlphaFold DB is a tool error, not `found: false`. One renamed upstream field used to make every lookup report "no such entry", with a citation, and cache that for a day. GraphQL errors are treated the same way. Neither is cached.
|
|
30
|
+
- A value the database omits is left out of the result with a note. AlphaFold confidence fields no longer default to `0.0`, and a record without a sequence is an error instead of a length of 0.
|
|
31
|
+
- The MCP server passes lookup failures to the client with their reason. The SDK was masking them as "Error executing tool".
|
|
32
|
+
- An unparseable search query is an error, not "no matches".
|
|
33
|
+
- `get_features` understands common names ("signal peptide", "disulfide bonds", `ACT_SITE`). It used to reject the name its own description advertised.
|
|
34
|
+
- An obsolete PDB entry names its replacement, and a deposited-but-unreleased entry is reported as on hold.
|
|
35
|
+
- `get_structure` reads all entities in one request (was one request per entity, capped at 12 of each kind) and returns each polymer's chain IDs, source organism and length.
|
|
36
|
+
|
|
37
|
+
New
|
|
38
|
+
- `map_structure_residue`: residue numbering between a PDB chain and UniProtKB, in either direction, with insertion codes, mismatches and unmodelled residues reported.
|
|
39
|
+
- `get_variants`: the wild-type residue and curated natural variants and mutagenesis records at a position.
|
|
40
|
+
- `get_sequence_window` accepts isoform IDs; `get_features` filters by residue position; `get_alphafold_summary` reports the confidence of a region.
|
|
41
|
+
- `proteinground-eval report` prints 95% Wilson intervals and an exact paired test between arms.
|
|
42
|
+
|
|
43
|
+
Eval
|
|
44
|
+
- Questions, gold answers and the preregistration are unchanged; the published results were measured on 0.1.0. The snapshot gained 36 records for the new request paths and tests.
|
|
45
|
+
|
|
46
|
+
## 0.1.0
|
|
47
|
+
|
|
48
|
+
First version: seven lookup tools, the 68-question eval and its preregistered run.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shnksi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: proteinground
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Cited protein facts for AI agents: an MCP server over UniProt, RCSB PDB and AlphaFold DB, with an eval that plants false-premise questions.
|
|
5
|
+
Project-URL: Homepage, https://github.com/shnksi/protein-ground
|
|
6
|
+
Project-URL: Repository, https://github.com/shnksi/protein-ground
|
|
7
|
+
Project-URL: Issues, https://github.com/shnksi/protein-ground/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/shnksi/protein-ground/blob/main/CHANGELOG.md
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-agents,alphafold,bioinformatics,mcp,pdb,proteins,uniprot
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: httpx>=0.27
|
|
22
|
+
Requires-Dist: mcp<3,>=2.3
|
|
23
|
+
Requires-Dist: pydantic>=2.7
|
|
24
|
+
Provides-Extra: eval
|
|
25
|
+
Requires-Dist: anthropic<3,>=2.12; extra == 'eval'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# proteinground
|
|
29
|
+
|
|
30
|
+
Cited protein facts for AI agents. An MCP server over UniProtKB, RCSB PDB and AlphaFold DB that returns every value with the record it came from, and says "not found" when something doesn't exist, so the model doesn't guess. It comes with a preregistered eval that plants false premises, to measure whether an agent checks before it answers.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
> In UniProtKB entry P01308 (human insulin), which amino acid is at position 450?
|
|
34
|
+
|
|
35
|
+
get_sequence_window(accession="P01308", start=450, end=450)
|
|
36
|
+
→ found: false
|
|
37
|
+
note: "position 450 is beyond the end of P01308, which has 110 residues"
|
|
38
|
+
sources: [UniProtKB P01308, release 2026_04, https://www.uniprot.org/uniprotkb/P01308/entry]
|
|
39
|
+
|
|
40
|
+
> The sickle-cell mutation is Glu6Val in haemoglobin beta. Which UniProtKB position is that?
|
|
41
|
+
|
|
42
|
+
map_structure_residue(pdb_id="4HHB", chain="B", residue_number=6)
|
|
43
|
+
→ found: true
|
|
44
|
+
author_residue: "6" structure_residue: "E" observed: true
|
|
45
|
+
uniprot_accession: "P68871" uniprot_position: 7 uniprot_residue: "E" matches_uniprot: true
|
|
46
|
+
sources: [RCSB PDB 4HHB, UniProtKB P68871]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Why
|
|
50
|
+
|
|
51
|
+
Language models answer protein questions fluently, and often wrongly: a residue number off by one, a structure's method misremembered, a mouse structure cited as human. A scientist acting on that pays more for a confident wrong answer than for "I don't know". These tools make the checked answer the easy one, and the eval measures whether the agent takes it.
|
|
52
|
+
|
|
53
|
+
## What to use it for
|
|
54
|
+
|
|
55
|
+
- **Check a mutation before you write it down.** `get_variants("P01116", 12)` returns the wild-type residue (Gly) and the curated changes at that position (G12C, G12D, G12V), so "KRAS G12C" is confirmed against the sequence, not recalled.
|
|
56
|
+
- **Translate residue numbers between a structure and the sequence.** Papers, viewers and PDB files use the authors' numbering, which often differs from UniProtKB: haemoglobin beta's Glu6 is position 7, thrombin's catalytic Ser195 is position 568. `map_structure_residue` converts in either direction, handles insertion codes (`60A`), and reports when the structure carries a different residue (6OIM has Cys at KRAS position 12) or when the residue was never modelled.
|
|
57
|
+
- **Verify a structure citation.** `get_structure` gives the method, resolution, the source organism and chain IDs of each polymer, and the real ligand apart from the additives. That is how "human ABL1 bound to imatinib (1IEP)" turns out to be mouse Abl.
|
|
58
|
+
- **Decide whether an AlphaFold model can be trusted where you need it.** `get_alphafold_summary("P04637", start=100, end=290)` gives the confidence of that region (mean pLDDT 95.6) next to the whole model (75.1) and its disordered stretches.
|
|
59
|
+
- **Pick a structure.** `list_structures` ranks the cross-referenced entries by resolution and shows which residues each one covers.
|
|
60
|
+
|
|
61
|
+
## The tools
|
|
62
|
+
|
|
63
|
+
| Tool | Source | Returns |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `search_proteins` | UniProtKB | accessions for a gene, name or keyword |
|
|
66
|
+
| `get_protein` | UniProtKB | name, gene, organism, canonical length, function, location |
|
|
67
|
+
| `get_sequence_window` | UniProtKB | up to 50 residues, one numbered entry per position; accepts an isoform ID such as `P04637-2` |
|
|
68
|
+
| `get_features` | UniProtKB | domains, signal peptides, active and binding sites, disulfides, with positions; filter by type or by residue position |
|
|
69
|
+
| `get_variants` | UniProtKB | the wild-type residue and the curated natural variants and mutagenesis records at a position or short range |
|
|
70
|
+
| `list_structures` | UniProtKB → PDB | cross-referenced structures, best resolution first |
|
|
71
|
+
| `get_structure` | RCSB PDB | method, resolution, R-free/R-work, dates, each polymer's chain IDs, organism and UniProtKB accession, bound ligands |
|
|
72
|
+
| `map_structure_residue` | RCSB PDB + UniProtKB | a residue's number in a chain ↔ its UniProtKB position, the residue in both, whether they agree, whether it was modelled |
|
|
73
|
+
| `get_alphafold_summary` | AlphaFold DB | mean pLDDT, the share of residues in each confidence band, long low-confidence regions, and the confidence of a region (or specific isoform/fragment model) |
|
|
74
|
+
|
|
75
|
+
Design choices, each aimed at a known way agents go wrong:
|
|
76
|
+
|
|
77
|
+
- **Every result is `Cited[T]`**: `found`, `data`, `note`, and `sources` (database, record ID, a URL a person can open, retrieval time, release). The citation travels with the value, so the agent never has to reconstruct where a number came from.
|
|
78
|
+
- **"Doesn't exist" is a first-class answer.** A missing record, a position past the end of a sequence or an absent feature comes back as `found: false` with a reason, plus the feature types that *are* annotated. The usual failure is a tool that returns an empty list and leaves the model to fill the silence. The reverse matters too: asking for a feature type the tool doesn't retrieve says so, rather than claiming the entry has none, and common names ("signal peptide", "disulfide bonds", `ACT_SITE`) resolve to UniProt's own.
|
|
79
|
+
- **A failed lookup is an error, never "not found".** Only a real 404 means a record is missing. A request the database rejects (HTTP 400, or a GraphQL error after an upstream schema change) comes back as a tool error that says it is not evidence of absence, and is not cached. Before this rule, one renamed UniProt field would have made every lookup answer "no such entry", with a citation.
|
|
80
|
+
- **A missing value is null, never zero.** If AlphaFold DB omits a confidence field the result leaves it out and says which, and a record without a sequence is an error. Nothing defaults to `0.0` or a length of 0.
|
|
81
|
+
- **"Missing" says why.** An obsolete PDB entry names its replacement (1HHB → 4HHB), a deposited-but-unreleased entry is reported as on hold, and an isoform ID or entry name gets the call that will work.
|
|
82
|
+
- **Numbering is translated, not assumed.** Structure and sequence numbering are mapped through the deposited alignment, and a residue that differs between the two is flagged.
|
|
83
|
+
- **Residues are numbered for the model.** Sequence windows return `{position, one_letter, three_letter}` per residue, because models miscount offsets into long strings.
|
|
84
|
+
- **Ligands carry context.** Crystallisation additives and ions (glycerol, sulfate, chloride) are flagged, so the agent doesn't report glycerol as the bound drug.
|
|
85
|
+
- **Read-only and replayable.** Tools are annotated read-only and idempotent. Every response can be written to a cache and replayed offline, which is how the eval stays reproducible.
|
|
86
|
+
|
|
87
|
+
The tool surface is defined once (`src/proteinground/tools.py`) and shared by the MCP server and the eval agent, so what gets measured is what ships. Lookup failures reach an MCP client with their explanation instead of a bare "error executing tool".
|
|
88
|
+
|
|
89
|
+
## Install
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/shnksi/protein-ground && cd protein-ground
|
|
93
|
+
uv sync
|
|
94
|
+
uv run proteinground-mcp # MCP over stdio
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Add it to Claude Code:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
claude mcp add proteinground -- uvx --from git+https://github.com/shnksi/protein-ground proteinground-mcp
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Or to an MCP client config:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"mcpServers": {
|
|
108
|
+
"proteinground": {
|
|
109
|
+
"command": "uvx",
|
|
110
|
+
"args": ["--from", "git+https://github.com/shnksi/protein-ground", "proteinground-mcp"],
|
|
111
|
+
"env": { "PROTEINGROUND_CACHE_DIR": "~/.cache/proteinground" }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`PROTEINGROUND_CACHE_DIR` keeps a replayable copy of every response. `PROTEINGROUND_MODE` is `cache-first` (default), `live`, `replay` or `offline`.
|
|
118
|
+
|
|
119
|
+
## The eval
|
|
120
|
+
|
|
121
|
+
68 questions over 14 well-studied proteins, in 11 families: the residue at a position, sequence length, feature spans, experimental method and resolution, ligand component IDs, which UniProtKB entry a PDB chain maps to, best-resolution X-ray structure, AlphaFold confidence, and accession lookup.
|
|
122
|
+
|
|
123
|
+
**13 of them (19%) are planted false premises**, each checked against the data when the set is built:
|
|
124
|
+
|
|
125
|
+
- PDB IDs with no released entry (`9ZYZ`, `9ZZX`). The set calls these "does not exist"; they are in fact deposited and on hold, which the tools now report. The right answer is unchanged: there is no resolution to give.
|
|
126
|
+
- "UniProtKB entry P69905 is human hemoglobin subunit beta…" (it is alpha)
|
|
127
|
+
- "PDB entry 1IEP shows human ABL1 bound to imatinib…" (the chain is mouse Abl, P00520)
|
|
128
|
+
- "PDB entry 4HHB is a cryo-EM structure…" (X-ray, 1984)
|
|
129
|
+
- a position past the end of insulin, insulin's "kinase domain", Cas9's "signal peptide", myoglobin's "active site"
|
|
130
|
+
|
|
131
|
+
The right answer to a planted item is to say what is wrong. An agent that answers everything confidently scores 0% on them.
|
|
132
|
+
|
|
133
|
+
How it is kept honest:
|
|
134
|
+
|
|
135
|
+
- **Gold answers come from raw records, by separate code.** `evals/build_questions.py` computes each answer straight from the API JSON and shares only URL builders with the tools. `proteinground-eval check-gold` then confirms every answer is reachable through the tools, so a tool bug fails the check instead of grading itself correct. Currently 68/68.
|
|
136
|
+
- **A frozen snapshot.** The responses behind every gold answer (UniProtKB 2026_04, AlphaFold DB v6, RCSB PDB as of 23 Nov 2026) are in `evals/snapshot/`, 1 MB gzipped. Runs replay it, so the agent sees the records the answers came from. A call the snapshot doesn't hold (say, a search phrased differently) is fetched live and counted as a snapshot miss; `--strict-offline` makes the run fully hermetic instead.
|
|
137
|
+
- **No model grades a model.** Graders are parsers plus rules (residue codes, ranges, numeric tolerance, method plus resolution, ID sets). Each parser pulls out every candidate value, so a hedge like "P00520 or P00519" fails. `tests/test_grade.py` builds natural phrasings of every real gold answer (which must pass) and hedged or near-miss versions (which must fail): off-by-one ranges, 1.8 Å for 1.74 Å, "X-ray or cryo-EM", the pronoun "I" read as isoleucine, and the "90" in "pLDDT above 90" read as the answer.
|
|
138
|
+
- **Grounded, not just cited.** An answer counts as grounded only if the record it cites was actually returned by a tool during that episode. A `submit_answer` sent in the same turn as lookups is sent back, since it was written before their results arrived.
|
|
139
|
+
- **Two decoys bracket the false-premise score.** "Caught" only checks that the agent said the premise is false, so it is always read next to false alarms. A stub that always says "fine" scores 0% caught; a stub that always says "doesn't exist" scores 100% caught and 100% false alarms.
|
|
140
|
+
- **Preregistered.** Bars, arms, decoys and stop rules are frozen in [`evals/PREREG.md`](evals/PREREG.md) before any paid call.
|
|
141
|
+
|
|
142
|
+
Metrics per arm: accuracy on answerable items, false premises caught and accepted, false alarms (saying "doesn't exist" when it does), cited and grounded rates, tool calls and cost per item.
|
|
143
|
+
|
|
144
|
+
### Results
|
|
145
|
+
|
|
146
|
+
Claude Opus 5.5, 23 Nov 2026, all 68 items per arm, one run each. Measured on v0.1.0 (commit `737b8f8`) with its seven tools; the tools added in v0.2.0 were first run in eval v2, below. Full write-up and records: [`evals/results/2026-11-23-opus-5-5/`](evals/results/2026-11-23-opus-5-5/RESULTS.md).
|
|
147
|
+
|
|
148
|
+
| Arm | Answerable correct (95% interval) | False premise caught (95% interval) | False alarms | Grounded | Cost / item |
|
|
149
|
+
|---|---|---|---|---|---|
|
|
150
|
+
| tools | **100%** (55/55; 94–100) | **100%** (13/13; 77–100) | 0% | 100% | $0.0087 |
|
|
151
|
+
| closed_book | 78% (43/55; 66–87) | 100% (13/13; 77–100) | 2% (1/55) | – | $0.0103 |
|
|
152
|
+
| stub, always "fine" (decoy) | 0% | 0% | 0% | – | $0 |
|
|
153
|
+
| stub, always "doesn't exist" (decoy) | 0% | 100% | 100% | – | $0 |
|
|
154
|
+
|
|
155
|
+
The arms answer the same questions, so they are compared item by item: 12 items only the tools arm got right, none the other way (exact paired test, p = 0.0005). The gap is 22 points, with an approximate 95% interval of 11 to 33.
|
|
156
|
+
|
|
157
|
+
The whole run cost $1.38. With the tools, every answer was right and grounded in a record fetched during that episode, with about one lookup per question. The closed-book misses are values that can't be memorised: all six AlphaFold confidence fractions, most best-resolution structures (the record has moved on since training), and a signal-peptide boundary off by one.
|
|
158
|
+
|
|
159
|
+
Five of the six preregistered bars passed. The one that missed: the tools-minus-memory gap was 22 points against a preregistered 30 (the interval reaches 30, so the set cannot rule the bar in or out; it was scored as a miss, as preregistered). Opus 5.5 recalled residues, lengths, ligand IDs and every planted premise for these famous proteins from memory. So this set shows the tools are reliable and grounded; it does not show a large lift over a strong model's memory. That needs a harder set of less-studied proteins, which is eval v2.
|
|
160
|
+
|
|
161
|
+
### Eval v2: long-tail proteins, with and without the warning
|
|
162
|
+
|
|
163
|
+
v1 left two questions open: do the tools help where memory fails, and does an agent check when nothing tells it to? v2 asks both.
|
|
164
|
+
|
|
165
|
+
- **175 questions on 43 little-studied proteins**, drawn by seed from UniProtKB searches that leave out twelve model organisms (reviewed entries with low annotation scores, and unreviewed entries). No protein was picked by hand.
|
|
166
|
+
- **Families for the v0.2.0 tools**, next to v1's: structure-to-sequence numbering, insertion codes, modelled residues, differences from the canonical sequence, substitutions, isoform numbering and obsolete PDB entries.
|
|
167
|
+
- **35 planted false premises (20%)**, 23 of them subtle: a mutagenesis record named with the wrong wild-type residue, an author residue number passed off as the UniProtKB position, a residue with no coordinates, an isoform that does not exist. Each shares its wording with an answerable twin.
|
|
168
|
+
- **Two prompts.** `primed` is the prompt v1 ran with. `unprimed` gives no warning about false premises and no instruction to look values up.
|
|
169
|
+
- **Three runs** of each arm under each prompt, because one run cannot separate a real difference from sampling noise.
|
|
170
|
+
|
|
171
|
+
Bars, arms and stop rules were frozen in [`evals/v2/PREREG.md`](evals/v2/PREREG.md) before the pilot.
|
|
172
|
+
|
|
173
|
+
Claude Opus 5.5, 23 to 24 Nov 2026, tools v0.2.0, harness at commit `7c5d635`. Median of three runs, with the lowest and highest run in brackets. Full write-up and records: [`evals/v2/results/2026-11-24-opus-5-5/`](evals/v2/results/2026-11-24-opus-5-5/RESULTS.md).
|
|
174
|
+
|
|
175
|
+
| Arm, prompt | Answerable correct (140) | False premise caught (35) | False alarms | Grounded | Cost / item |
|
|
176
|
+
|---|---|---|---|---|---|
|
|
177
|
+
| tools, unprimed | **100.0%** [100.0–100.0] | **91.4%** [91.4–91.4] | 0.0% | 100% | $0.0106 |
|
|
178
|
+
| closed_book, unprimed | 32.9% [30.0–35.7] | 60.0% [51.4–65.7] | 7.9% [7.9–10.7] | – | $0.0144 |
|
|
179
|
+
| tools, primed | 100.0% [100.0–100.0] | 100.0% [100.0–100.0] | 0.0% | 100% | $0.0104 |
|
|
180
|
+
| closed_book, primed | 32.9% [30.0–33.6] | 48.6% [45.7–54.3] | 2.1% [1.4–2.1] | – | $0.0132 |
|
|
181
|
+
|
|
182
|
+
The headline is the unprimed pair. From memory, Opus 5.5 answered a third of these questions; with the tools it answered all 140 in all six runs, with about 1.1 lookups per question. In each of the three paired runs, 90 to 98 answerable items were right only with the tools and none only without (exact paired test, p below 1e-26 in every pair); the gap is 64 to 70 points. The twelve runs cost $25.77 with the pilot.
|
|
183
|
+
|
|
184
|
+
With no warning in the prompt, the tools arm still caught 32 of the 35 planted premises in every run, with no false alarms. The three it missed are the same every time: an author residue number said to be the same UniProtKB position. The model looked the mapping up, gave the residue at the author number, and wrote the correction in its explanation without setting the flag. The grader reads the flag, so these count as accepted. With the warning it set the flag on all three.
|
|
185
|
+
|
|
186
|
+
Closed book caught more planted premises without the warning (60.0% against 48.6%) and raised more false alarms (7.9% against 2.1%): it uses the flag to say it does not know. Read by hand, 19 of its 62 unprimed catches set the flag only because it could not recall the record, against none of the tools arm's.
|
|
187
|
+
|
|
188
|
+
Nine of the ten preregistered bars passed. The one that missed is run-to-run spread: closed book under the unprimed prompt ranged over 5.7 points of answerable accuracy (42, 46 and 50 of 140) against a bar of 5. As preregistered, differences smaller than that cannot be read from these runs. The gaps between the arms are more than ten times larger.
|
|
189
|
+
|
|
190
|
+
### Run it
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
uv sync --extra eval
|
|
194
|
+
uv run proteinground-eval check-gold
|
|
195
|
+
uv run proteinground-eval run --arm tools --stub --out runs/dry-run # free
|
|
196
|
+
|
|
197
|
+
export ANTHROPIC_API_KEY=...
|
|
198
|
+
uv run proteinground-eval run --arm tools --model claude-opus-5-5 --cap-usd 12 --out runs/opus-tools
|
|
199
|
+
uv run proteinground-eval run --arm closed_book --model claude-opus-5-5 --cap-usd 3 --out runs/opus-closed
|
|
200
|
+
uv run proteinground-eval report runs/opus-tools runs/opus-closed
|
|
201
|
+
|
|
202
|
+
# eval v2: name its questions and snapshot, and pick a prompt
|
|
203
|
+
uv run proteinground-eval run --arm tools --prompt unprimed --questions evals/v2/questions.jsonl --snapshot evals/v2/snapshot --cap-usd 5 --max-miss-episodes 17 --out runs/v2/tools-unprimed-1
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Runs resume where they stopped. `--ids` runs chosen items, `--no-fallbacks` measures the named model only, and `--strict-offline` fails any tool call that misses the snapshot. Rebuild the set with fresh residue positions with `uv run python evals/build_questions.py --seed 8 --refresh`.
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
uv sync --extra eval
|
|
212
|
+
uv run pytest # 187 tests, offline against the snapshot
|
|
213
|
+
uv run mypy # strict
|
|
214
|
+
uv run ruff check . && uv run ruff format --check .
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Limits
|
|
218
|
+
|
|
219
|
+
- v1 is 68 items, and each arm ran once. One answerable item is 1.8 points; its intervals are wide for that reason, so treat v1 differences under about 10 points as noise. v2 is 175 items run three times; its closed-book runs ranged over as much as 5.7 points, and smaller differences cannot be read. Both are one model.
|
|
220
|
+
- The primed prompt tells the model that some questions hide a false premise and, in the tools arm, to look every value up. v1's caught and grounded rates therefore measure behaviour when asked to be careful, not unprompted. v2's unprimed prompt drops both, but the answer form still has a flag and the tool descriptions still say what `found: false` means: "unprimed" means no warning from the prompt, not no hint at all.
|
|
221
|
+
- The grader only checks that the premise was rejected. Every planted item's explanation in both published runs was read by hand; the v2 results page has the count.
|
|
222
|
+
- v1 covers the seven v0.1.0 tools. `get_variants` and `map_structure_residue` were first run by a model in v2.
|
|
223
|
+
- v2's proteins are one seeded draw, even over sequence lengths and not over entries, with one stratum (peptidase S1) chosen for its insertion codes. The results describe that draw, not UniProtKB as a whole.
|
|
224
|
+
- `get_variants` reads UniProtKB's curated variants, which are a subset of what ClinVar and gnomAD hold. An empty result is reported as "none annotated", never as "does not occur".
|
|
225
|
+
- Residue mapping uses the alignment RCSB PDB publishes for each entity. A chain with no UniProtKB alignment (many antibodies, designed proteins) maps to nothing, and says so. Feature annotations are canonical-sequence only: an isoform ID works for sequence windows, not for features or variants.
|
|
226
|
+
- The questions are public, so later models may have trained on them. Rebuild with a new seed before reusing the numbers.
|
|
227
|
+
- Live mode drifts: new PDB entries change "best resolution", and the two unassigned PDB IDs may be assigned one day. The snapshot keeps them fixed.
|
|
228
|
+
- Both sets are saturated for a tool-using agent (100% of answerable items), and v1 is mostly memorisable for closed-book Opus 5.5 (78%). They check that the tools work, that answers are grounded and, in v2, that memory is no substitute; they can't rank strong agents or tool surfaces against each other.
|
|
229
|
+
- Data licences: UniProtKB and AlphaFold DB under CC BY 4.0, RCSB PDB under CC0 (see `evals/snapshot/README.md`).
|
|
230
|
+
|
|
231
|
+
Built with Claude Code. MIT licence.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# proteinground
|
|
2
|
+
|
|
3
|
+
Cited protein facts for AI agents. An MCP server over UniProtKB, RCSB PDB and AlphaFold DB that returns every value with the record it came from, and says "not found" when something doesn't exist, so the model doesn't guess. It comes with a preregistered eval that plants false premises, to measure whether an agent checks before it answers.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
> In UniProtKB entry P01308 (human insulin), which amino acid is at position 450?
|
|
7
|
+
|
|
8
|
+
get_sequence_window(accession="P01308", start=450, end=450)
|
|
9
|
+
→ found: false
|
|
10
|
+
note: "position 450 is beyond the end of P01308, which has 110 residues"
|
|
11
|
+
sources: [UniProtKB P01308, release 2026_04, https://www.uniprot.org/uniprotkb/P01308/entry]
|
|
12
|
+
|
|
13
|
+
> The sickle-cell mutation is Glu6Val in haemoglobin beta. Which UniProtKB position is that?
|
|
14
|
+
|
|
15
|
+
map_structure_residue(pdb_id="4HHB", chain="B", residue_number=6)
|
|
16
|
+
→ found: true
|
|
17
|
+
author_residue: "6" structure_residue: "E" observed: true
|
|
18
|
+
uniprot_accession: "P68871" uniprot_position: 7 uniprot_residue: "E" matches_uniprot: true
|
|
19
|
+
sources: [RCSB PDB 4HHB, UniProtKB P68871]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Why
|
|
23
|
+
|
|
24
|
+
Language models answer protein questions fluently, and often wrongly: a residue number off by one, a structure's method misremembered, a mouse structure cited as human. A scientist acting on that pays more for a confident wrong answer than for "I don't know". These tools make the checked answer the easy one, and the eval measures whether the agent takes it.
|
|
25
|
+
|
|
26
|
+
## What to use it for
|
|
27
|
+
|
|
28
|
+
- **Check a mutation before you write it down.** `get_variants("P01116", 12)` returns the wild-type residue (Gly) and the curated changes at that position (G12C, G12D, G12V), so "KRAS G12C" is confirmed against the sequence, not recalled.
|
|
29
|
+
- **Translate residue numbers between a structure and the sequence.** Papers, viewers and PDB files use the authors' numbering, which often differs from UniProtKB: haemoglobin beta's Glu6 is position 7, thrombin's catalytic Ser195 is position 568. `map_structure_residue` converts in either direction, handles insertion codes (`60A`), and reports when the structure carries a different residue (6OIM has Cys at KRAS position 12) or when the residue was never modelled.
|
|
30
|
+
- **Verify a structure citation.** `get_structure` gives the method, resolution, the source organism and chain IDs of each polymer, and the real ligand apart from the additives. That is how "human ABL1 bound to imatinib (1IEP)" turns out to be mouse Abl.
|
|
31
|
+
- **Decide whether an AlphaFold model can be trusted where you need it.** `get_alphafold_summary("P04637", start=100, end=290)` gives the confidence of that region (mean pLDDT 95.6) next to the whole model (75.1) and its disordered stretches.
|
|
32
|
+
- **Pick a structure.** `list_structures` ranks the cross-referenced entries by resolution and shows which residues each one covers.
|
|
33
|
+
|
|
34
|
+
## The tools
|
|
35
|
+
|
|
36
|
+
| Tool | Source | Returns |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `search_proteins` | UniProtKB | accessions for a gene, name or keyword |
|
|
39
|
+
| `get_protein` | UniProtKB | name, gene, organism, canonical length, function, location |
|
|
40
|
+
| `get_sequence_window` | UniProtKB | up to 50 residues, one numbered entry per position; accepts an isoform ID such as `P04637-2` |
|
|
41
|
+
| `get_features` | UniProtKB | domains, signal peptides, active and binding sites, disulfides, with positions; filter by type or by residue position |
|
|
42
|
+
| `get_variants` | UniProtKB | the wild-type residue and the curated natural variants and mutagenesis records at a position or short range |
|
|
43
|
+
| `list_structures` | UniProtKB → PDB | cross-referenced structures, best resolution first |
|
|
44
|
+
| `get_structure` | RCSB PDB | method, resolution, R-free/R-work, dates, each polymer's chain IDs, organism and UniProtKB accession, bound ligands |
|
|
45
|
+
| `map_structure_residue` | RCSB PDB + UniProtKB | a residue's number in a chain ↔ its UniProtKB position, the residue in both, whether they agree, whether it was modelled |
|
|
46
|
+
| `get_alphafold_summary` | AlphaFold DB | mean pLDDT, the share of residues in each confidence band, long low-confidence regions, and the confidence of a region (or specific isoform/fragment model) |
|
|
47
|
+
|
|
48
|
+
Design choices, each aimed at a known way agents go wrong:
|
|
49
|
+
|
|
50
|
+
- **Every result is `Cited[T]`**: `found`, `data`, `note`, and `sources` (database, record ID, a URL a person can open, retrieval time, release). The citation travels with the value, so the agent never has to reconstruct where a number came from.
|
|
51
|
+
- **"Doesn't exist" is a first-class answer.** A missing record, a position past the end of a sequence or an absent feature comes back as `found: false` with a reason, plus the feature types that *are* annotated. The usual failure is a tool that returns an empty list and leaves the model to fill the silence. The reverse matters too: asking for a feature type the tool doesn't retrieve says so, rather than claiming the entry has none, and common names ("signal peptide", "disulfide bonds", `ACT_SITE`) resolve to UniProt's own.
|
|
52
|
+
- **A failed lookup is an error, never "not found".** Only a real 404 means a record is missing. A request the database rejects (HTTP 400, or a GraphQL error after an upstream schema change) comes back as a tool error that says it is not evidence of absence, and is not cached. Before this rule, one renamed UniProt field would have made every lookup answer "no such entry", with a citation.
|
|
53
|
+
- **A missing value is null, never zero.** If AlphaFold DB omits a confidence field the result leaves it out and says which, and a record without a sequence is an error. Nothing defaults to `0.0` or a length of 0.
|
|
54
|
+
- **"Missing" says why.** An obsolete PDB entry names its replacement (1HHB → 4HHB), a deposited-but-unreleased entry is reported as on hold, and an isoform ID or entry name gets the call that will work.
|
|
55
|
+
- **Numbering is translated, not assumed.** Structure and sequence numbering are mapped through the deposited alignment, and a residue that differs between the two is flagged.
|
|
56
|
+
- **Residues are numbered for the model.** Sequence windows return `{position, one_letter, three_letter}` per residue, because models miscount offsets into long strings.
|
|
57
|
+
- **Ligands carry context.** Crystallisation additives and ions (glycerol, sulfate, chloride) are flagged, so the agent doesn't report glycerol as the bound drug.
|
|
58
|
+
- **Read-only and replayable.** Tools are annotated read-only and idempotent. Every response can be written to a cache and replayed offline, which is how the eval stays reproducible.
|
|
59
|
+
|
|
60
|
+
The tool surface is defined once (`src/proteinground/tools.py`) and shared by the MCP server and the eval agent, so what gets measured is what ships. Lookup failures reach an MCP client with their explanation instead of a bare "error executing tool".
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/shnksi/protein-ground && cd protein-ground
|
|
66
|
+
uv sync
|
|
67
|
+
uv run proteinground-mcp # MCP over stdio
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Add it to Claude Code:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
claude mcp add proteinground -- uvx --from git+https://github.com/shnksi/protein-ground proteinground-mcp
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or to an MCP client config:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"proteinground": {
|
|
82
|
+
"command": "uvx",
|
|
83
|
+
"args": ["--from", "git+https://github.com/shnksi/protein-ground", "proteinground-mcp"],
|
|
84
|
+
"env": { "PROTEINGROUND_CACHE_DIR": "~/.cache/proteinground" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`PROTEINGROUND_CACHE_DIR` keeps a replayable copy of every response. `PROTEINGROUND_MODE` is `cache-first` (default), `live`, `replay` or `offline`.
|
|
91
|
+
|
|
92
|
+
## The eval
|
|
93
|
+
|
|
94
|
+
68 questions over 14 well-studied proteins, in 11 families: the residue at a position, sequence length, feature spans, experimental method and resolution, ligand component IDs, which UniProtKB entry a PDB chain maps to, best-resolution X-ray structure, AlphaFold confidence, and accession lookup.
|
|
95
|
+
|
|
96
|
+
**13 of them (19%) are planted false premises**, each checked against the data when the set is built:
|
|
97
|
+
|
|
98
|
+
- PDB IDs with no released entry (`9ZYZ`, `9ZZX`). The set calls these "does not exist"; they are in fact deposited and on hold, which the tools now report. The right answer is unchanged: there is no resolution to give.
|
|
99
|
+
- "UniProtKB entry P69905 is human hemoglobin subunit beta…" (it is alpha)
|
|
100
|
+
- "PDB entry 1IEP shows human ABL1 bound to imatinib…" (the chain is mouse Abl, P00520)
|
|
101
|
+
- "PDB entry 4HHB is a cryo-EM structure…" (X-ray, 1984)
|
|
102
|
+
- a position past the end of insulin, insulin's "kinase domain", Cas9's "signal peptide", myoglobin's "active site"
|
|
103
|
+
|
|
104
|
+
The right answer to a planted item is to say what is wrong. An agent that answers everything confidently scores 0% on them.
|
|
105
|
+
|
|
106
|
+
How it is kept honest:
|
|
107
|
+
|
|
108
|
+
- **Gold answers come from raw records, by separate code.** `evals/build_questions.py` computes each answer straight from the API JSON and shares only URL builders with the tools. `proteinground-eval check-gold` then confirms every answer is reachable through the tools, so a tool bug fails the check instead of grading itself correct. Currently 68/68.
|
|
109
|
+
- **A frozen snapshot.** The responses behind every gold answer (UniProtKB 2026_04, AlphaFold DB v6, RCSB PDB as of 23 Nov 2026) are in `evals/snapshot/`, 1 MB gzipped. Runs replay it, so the agent sees the records the answers came from. A call the snapshot doesn't hold (say, a search phrased differently) is fetched live and counted as a snapshot miss; `--strict-offline` makes the run fully hermetic instead.
|
|
110
|
+
- **No model grades a model.** Graders are parsers plus rules (residue codes, ranges, numeric tolerance, method plus resolution, ID sets). Each parser pulls out every candidate value, so a hedge like "P00520 or P00519" fails. `tests/test_grade.py` builds natural phrasings of every real gold answer (which must pass) and hedged or near-miss versions (which must fail): off-by-one ranges, 1.8 Å for 1.74 Å, "X-ray or cryo-EM", the pronoun "I" read as isoleucine, and the "90" in "pLDDT above 90" read as the answer.
|
|
111
|
+
- **Grounded, not just cited.** An answer counts as grounded only if the record it cites was actually returned by a tool during that episode. A `submit_answer` sent in the same turn as lookups is sent back, since it was written before their results arrived.
|
|
112
|
+
- **Two decoys bracket the false-premise score.** "Caught" only checks that the agent said the premise is false, so it is always read next to false alarms. A stub that always says "fine" scores 0% caught; a stub that always says "doesn't exist" scores 100% caught and 100% false alarms.
|
|
113
|
+
- **Preregistered.** Bars, arms, decoys and stop rules are frozen in [`evals/PREREG.md`](evals/PREREG.md) before any paid call.
|
|
114
|
+
|
|
115
|
+
Metrics per arm: accuracy on answerable items, false premises caught and accepted, false alarms (saying "doesn't exist" when it does), cited and grounded rates, tool calls and cost per item.
|
|
116
|
+
|
|
117
|
+
### Results
|
|
118
|
+
|
|
119
|
+
Claude Opus 5.5, 23 Nov 2026, all 68 items per arm, one run each. Measured on v0.1.0 (commit `737b8f8`) with its seven tools; the tools added in v0.2.0 were first run in eval v2, below. Full write-up and records: [`evals/results/2026-11-23-opus-5-5/`](evals/results/2026-11-23-opus-5-5/RESULTS.md).
|
|
120
|
+
|
|
121
|
+
| Arm | Answerable correct (95% interval) | False premise caught (95% interval) | False alarms | Grounded | Cost / item |
|
|
122
|
+
|---|---|---|---|---|---|
|
|
123
|
+
| tools | **100%** (55/55; 94–100) | **100%** (13/13; 77–100) | 0% | 100% | $0.0087 |
|
|
124
|
+
| closed_book | 78% (43/55; 66–87) | 100% (13/13; 77–100) | 2% (1/55) | – | $0.0103 |
|
|
125
|
+
| stub, always "fine" (decoy) | 0% | 0% | 0% | – | $0 |
|
|
126
|
+
| stub, always "doesn't exist" (decoy) | 0% | 100% | 100% | – | $0 |
|
|
127
|
+
|
|
128
|
+
The arms answer the same questions, so they are compared item by item: 12 items only the tools arm got right, none the other way (exact paired test, p = 0.0005). The gap is 22 points, with an approximate 95% interval of 11 to 33.
|
|
129
|
+
|
|
130
|
+
The whole run cost $1.38. With the tools, every answer was right and grounded in a record fetched during that episode, with about one lookup per question. The closed-book misses are values that can't be memorised: all six AlphaFold confidence fractions, most best-resolution structures (the record has moved on since training), and a signal-peptide boundary off by one.
|
|
131
|
+
|
|
132
|
+
Five of the six preregistered bars passed. The one that missed: the tools-minus-memory gap was 22 points against a preregistered 30 (the interval reaches 30, so the set cannot rule the bar in or out; it was scored as a miss, as preregistered). Opus 5.5 recalled residues, lengths, ligand IDs and every planted premise for these famous proteins from memory. So this set shows the tools are reliable and grounded; it does not show a large lift over a strong model's memory. That needs a harder set of less-studied proteins, which is eval v2.
|
|
133
|
+
|
|
134
|
+
### Eval v2: long-tail proteins, with and without the warning
|
|
135
|
+
|
|
136
|
+
v1 left two questions open: do the tools help where memory fails, and does an agent check when nothing tells it to? v2 asks both.
|
|
137
|
+
|
|
138
|
+
- **175 questions on 43 little-studied proteins**, drawn by seed from UniProtKB searches that leave out twelve model organisms (reviewed entries with low annotation scores, and unreviewed entries). No protein was picked by hand.
|
|
139
|
+
- **Families for the v0.2.0 tools**, next to v1's: structure-to-sequence numbering, insertion codes, modelled residues, differences from the canonical sequence, substitutions, isoform numbering and obsolete PDB entries.
|
|
140
|
+
- **35 planted false premises (20%)**, 23 of them subtle: a mutagenesis record named with the wrong wild-type residue, an author residue number passed off as the UniProtKB position, a residue with no coordinates, an isoform that does not exist. Each shares its wording with an answerable twin.
|
|
141
|
+
- **Two prompts.** `primed` is the prompt v1 ran with. `unprimed` gives no warning about false premises and no instruction to look values up.
|
|
142
|
+
- **Three runs** of each arm under each prompt, because one run cannot separate a real difference from sampling noise.
|
|
143
|
+
|
|
144
|
+
Bars, arms and stop rules were frozen in [`evals/v2/PREREG.md`](evals/v2/PREREG.md) before the pilot.
|
|
145
|
+
|
|
146
|
+
Claude Opus 5.5, 23 to 24 Nov 2026, tools v0.2.0, harness at commit `7c5d635`. Median of three runs, with the lowest and highest run in brackets. Full write-up and records: [`evals/v2/results/2026-11-24-opus-5-5/`](evals/v2/results/2026-11-24-opus-5-5/RESULTS.md).
|
|
147
|
+
|
|
148
|
+
| Arm, prompt | Answerable correct (140) | False premise caught (35) | False alarms | Grounded | Cost / item |
|
|
149
|
+
|---|---|---|---|---|---|
|
|
150
|
+
| tools, unprimed | **100.0%** [100.0–100.0] | **91.4%** [91.4–91.4] | 0.0% | 100% | $0.0106 |
|
|
151
|
+
| closed_book, unprimed | 32.9% [30.0–35.7] | 60.0% [51.4–65.7] | 7.9% [7.9–10.7] | – | $0.0144 |
|
|
152
|
+
| tools, primed | 100.0% [100.0–100.0] | 100.0% [100.0–100.0] | 0.0% | 100% | $0.0104 |
|
|
153
|
+
| closed_book, primed | 32.9% [30.0–33.6] | 48.6% [45.7–54.3] | 2.1% [1.4–2.1] | – | $0.0132 |
|
|
154
|
+
|
|
155
|
+
The headline is the unprimed pair. From memory, Opus 5.5 answered a third of these questions; with the tools it answered all 140 in all six runs, with about 1.1 lookups per question. In each of the three paired runs, 90 to 98 answerable items were right only with the tools and none only without (exact paired test, p below 1e-26 in every pair); the gap is 64 to 70 points. The twelve runs cost $25.77 with the pilot.
|
|
156
|
+
|
|
157
|
+
With no warning in the prompt, the tools arm still caught 32 of the 35 planted premises in every run, with no false alarms. The three it missed are the same every time: an author residue number said to be the same UniProtKB position. The model looked the mapping up, gave the residue at the author number, and wrote the correction in its explanation without setting the flag. The grader reads the flag, so these count as accepted. With the warning it set the flag on all three.
|
|
158
|
+
|
|
159
|
+
Closed book caught more planted premises without the warning (60.0% against 48.6%) and raised more false alarms (7.9% against 2.1%): it uses the flag to say it does not know. Read by hand, 19 of its 62 unprimed catches set the flag only because it could not recall the record, against none of the tools arm's.
|
|
160
|
+
|
|
161
|
+
Nine of the ten preregistered bars passed. The one that missed is run-to-run spread: closed book under the unprimed prompt ranged over 5.7 points of answerable accuracy (42, 46 and 50 of 140) against a bar of 5. As preregistered, differences smaller than that cannot be read from these runs. The gaps between the arms are more than ten times larger.
|
|
162
|
+
|
|
163
|
+
### Run it
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
uv sync --extra eval
|
|
167
|
+
uv run proteinground-eval check-gold
|
|
168
|
+
uv run proteinground-eval run --arm tools --stub --out runs/dry-run # free
|
|
169
|
+
|
|
170
|
+
export ANTHROPIC_API_KEY=...
|
|
171
|
+
uv run proteinground-eval run --arm tools --model claude-opus-5-5 --cap-usd 12 --out runs/opus-tools
|
|
172
|
+
uv run proteinground-eval run --arm closed_book --model claude-opus-5-5 --cap-usd 3 --out runs/opus-closed
|
|
173
|
+
uv run proteinground-eval report runs/opus-tools runs/opus-closed
|
|
174
|
+
|
|
175
|
+
# eval v2: name its questions and snapshot, and pick a prompt
|
|
176
|
+
uv run proteinground-eval run --arm tools --prompt unprimed --questions evals/v2/questions.jsonl --snapshot evals/v2/snapshot --cap-usd 5 --max-miss-episodes 17 --out runs/v2/tools-unprimed-1
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Runs resume where they stopped. `--ids` runs chosen items, `--no-fallbacks` measures the named model only, and `--strict-offline` fails any tool call that misses the snapshot. Rebuild the set with fresh residue positions with `uv run python evals/build_questions.py --seed 8 --refresh`.
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
uv sync --extra eval
|
|
185
|
+
uv run pytest # 187 tests, offline against the snapshot
|
|
186
|
+
uv run mypy # strict
|
|
187
|
+
uv run ruff check . && uv run ruff format --check .
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Limits
|
|
191
|
+
|
|
192
|
+
- v1 is 68 items, and each arm ran once. One answerable item is 1.8 points; its intervals are wide for that reason, so treat v1 differences under about 10 points as noise. v2 is 175 items run three times; its closed-book runs ranged over as much as 5.7 points, and smaller differences cannot be read. Both are one model.
|
|
193
|
+
- The primed prompt tells the model that some questions hide a false premise and, in the tools arm, to look every value up. v1's caught and grounded rates therefore measure behaviour when asked to be careful, not unprompted. v2's unprimed prompt drops both, but the answer form still has a flag and the tool descriptions still say what `found: false` means: "unprimed" means no warning from the prompt, not no hint at all.
|
|
194
|
+
- The grader only checks that the premise was rejected. Every planted item's explanation in both published runs was read by hand; the v2 results page has the count.
|
|
195
|
+
- v1 covers the seven v0.1.0 tools. `get_variants` and `map_structure_residue` were first run by a model in v2.
|
|
196
|
+
- v2's proteins are one seeded draw, even over sequence lengths and not over entries, with one stratum (peptidase S1) chosen for its insertion codes. The results describe that draw, not UniProtKB as a whole.
|
|
197
|
+
- `get_variants` reads UniProtKB's curated variants, which are a subset of what ClinVar and gnomAD hold. An empty result is reported as "none annotated", never as "does not occur".
|
|
198
|
+
- Residue mapping uses the alignment RCSB PDB publishes for each entity. A chain with no UniProtKB alignment (many antibodies, designed proteins) maps to nothing, and says so. Feature annotations are canonical-sequence only: an isoform ID works for sequence windows, not for features or variants.
|
|
199
|
+
- The questions are public, so later models may have trained on them. Rebuild with a new seed before reusing the numbers.
|
|
200
|
+
- Live mode drifts: new PDB entries change "best resolution", and the two unassigned PDB IDs may be assigned one day. The snapshot keeps them fixed.
|
|
201
|
+
- Both sets are saturated for a tool-using agent (100% of answerable items), and v1 is mostly memorisable for closed-book Opus 5.5 (78%). They check that the tools work, that answers are grounded and, in v2, that memory is no substitute; they can't rank strong agents or tool surfaces against each other.
|
|
202
|
+
- Data licences: UniProtKB and AlphaFold DB under CC BY 4.0, RCSB PDB under CC0 (see `evals/snapshot/README.md`).
|
|
203
|
+
|
|
204
|
+
Built with Claude Code. MIT licence.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "proteinground"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Cited protein facts for AI agents: an MCP server over UniProt, RCSB PDB and AlphaFold DB, with an eval that plants false-premise questions."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
keywords = ["mcp", "proteins", "uniprot", "pdb", "alphafold", "bioinformatics", "ai-agents"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"Intended Audience :: Science/Research",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"httpx>=0.27",
|
|
21
|
+
"mcp>=2.3,<3",
|
|
22
|
+
"pydantic>=2.7",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
eval = ["anthropic>=2.12,<3"]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
proteinground = "proteinground.server:main"
|
|
30
|
+
proteinground-mcp = "proteinground.server:main"
|
|
31
|
+
proteinground-eval = "proteinground.eval.cli:main"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/shnksi/protein-ground"
|
|
35
|
+
Repository = "https://github.com/shnksi/protein-ground"
|
|
36
|
+
Issues = "https://github.com/shnksi/protein-ground/issues"
|
|
37
|
+
Changelog = "https://github.com/shnksi/protein-ground/blob/main/CHANGELOG.md"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"mypy>=1.10",
|
|
42
|
+
"pytest>=8",
|
|
43
|
+
"ruff>=0.5",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[build-system]
|
|
47
|
+
requires = ["hatchling"]
|
|
48
|
+
build-backend = "hatchling.build"
|
|
49
|
+
|
|
50
|
+
[tool.hatch.version]
|
|
51
|
+
path = "src/proteinground/version.py"
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.wheel]
|
|
54
|
+
packages = ["src/proteinground"]
|
|
55
|
+
|
|
56
|
+
[tool.hatch.build.targets.sdist]
|
|
57
|
+
include = [
|
|
58
|
+
"/src",
|
|
59
|
+
"/README.md",
|
|
60
|
+
"/LICENSE",
|
|
61
|
+
"/CHANGELOG.md",
|
|
62
|
+
"/pyproject.toml",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.ruff]
|
|
66
|
+
line-length = 100
|
|
67
|
+
target-version = "py311"
|
|
68
|
+
|
|
69
|
+
[tool.ruff.lint]
|
|
70
|
+
select = ["E", "F", "I", "B", "UP", "SIM", "RUF"]
|
|
71
|
+
# Dashes and the angstrom sign are parsed on purpose.
|
|
72
|
+
ignore = ["RUF001", "RUF002", "RUF003"]
|
|
73
|
+
|
|
74
|
+
[tool.mypy]
|
|
75
|
+
strict = true
|
|
76
|
+
python_version = "3.11"
|
|
77
|
+
plugins = ["pydantic.mypy"]
|
|
78
|
+
files = ["src", "tests", "evals"]
|
|
79
|
+
|
|
80
|
+
[[tool.mypy.overrides]]
|
|
81
|
+
module = ["anthropic", "anthropic.*"]
|
|
82
|
+
follow_untyped_imports = true
|
|
83
|
+
|
|
84
|
+
[tool.pytest.ini_options]
|
|
85
|
+
testpaths = ["tests"]
|
|
86
|
+
addopts = "-q"
|