pesto-genetics 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.
- pesto_genetics-0.1.0/LICENSE +21 -0
- pesto_genetics-0.1.0/PKG-INFO +187 -0
- pesto_genetics-0.1.0/README.md +163 -0
- pesto_genetics-0.1.0/pyproject.toml +44 -0
- pesto_genetics-0.1.0/setup.cfg +4 -0
- pesto_genetics-0.1.0/src/pesto/__init__.py +0 -0
- pesto_genetics-0.1.0/src/pesto/aliases.tsv +44693 -0
- pesto_genetics-0.1.0/src/pesto/cli.py +549 -0
- pesto_genetics-0.1.0/src/pesto/config.py +155 -0
- pesto_genetics-0.1.0/src/pesto/cost.py +176 -0
- pesto_genetics-0.1.0/src/pesto/credentials.py +40 -0
- pesto_genetics-0.1.0/src/pesto/flow/__init__.py +7 -0
- pesto_genetics-0.1.0/src/pesto/flow/arms.py +191 -0
- pesto_genetics-0.1.0/src/pesto/flow/render.py +46 -0
- pesto_genetics-0.1.0/src/pesto/flow/run.py +150 -0
- pesto_genetics-0.1.0/src/pesto/flow/spec.py +168 -0
- pesto_genetics-0.1.0/src/pesto/flow/steps.py +679 -0
- pesto_genetics-0.1.0/src/pesto/flow/store.py +98 -0
- pesto_genetics-0.1.0/src/pesto/flow/types.py +224 -0
- pesto_genetics-0.1.0/src/pesto/harness.py +263 -0
- pesto_genetics-0.1.0/src/pesto/open_targets.py +438 -0
- pesto_genetics-0.1.0/src/pesto/ot_matcher.py +281 -0
- pesto_genetics-0.1.0/src/pesto/ot_shortlist.py +210 -0
- pesto_genetics-0.1.0/src/pesto/parsers/__init__.py +2 -0
- pesto_genetics-0.1.0/src/pesto/parsers/llm_parsers.py +108 -0
- pesto_genetics-0.1.0/src/pesto/prompts/broad_term_prompt.txt +31 -0
- pesto_genetics-0.1.0/src/pesto/prompts/evidence_band_general.txt +52 -0
- pesto_genetics-0.1.0/src/pesto/prompts/evidence_band_prompt.txt +52 -0
- pesto_genetics-0.1.0/src/pesto/prompts/knowledge_probabilities.txt +44 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_assessment_general.txt +52 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_assessment_prompt.txt +52 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_probabilities.txt +55 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_probabilities_bare.txt +41 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_probabilities_general.txt +55 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_probabilities_open.txt +26 -0
- pesto_genetics-0.1.0/src/pesto/prompts/novelty_score.txt +16 -0
- pesto_genetics-0.1.0/src/pesto/prompts/ot_tagged_gate_prompt.txt +30 -0
- pesto_genetics-0.1.0/src/pesto/prompts/ot_tagged_match_reasons_prompt.txt +76 -0
- pesto_genetics-0.1.0/src/pesto/prompts/ot_tagged_match_v7_prompt.txt +219 -0
- pesto_genetics-0.1.0/src/pesto/prompts/phenotype_anchors_prompt.txt +21 -0
- pesto_genetics-0.1.0/src/pesto/prompts/phenotype_kind_prompt.txt +17 -0
- pesto_genetics-0.1.0/src/pesto/prompts/phenotype_synonyms_general.txt +30 -0
- pesto_genetics-0.1.0/src/pesto/prompts/phenotype_synonyms_prompt.txt +30 -0
- pesto_genetics-0.1.0/src/pesto/prompts/title_kick_prompt.txt +26 -0
- pesto_genetics-0.1.0/src/pesto/scoring.py +65 -0
- pesto_genetics-0.1.0/src/pesto/services/__init__.py +2 -0
- pesto_genetics-0.1.0/src/pesto/services/fulltext_service.py +196 -0
- pesto_genetics-0.1.0/src/pesto/services/llm_service.py +123 -0
- pesto_genetics-0.1.0/src/pesto/services/pubmed_service.py +784 -0
- pesto_genetics-0.1.0/src/pesto/utils/__init__.py +2 -0
- pesto_genetics-0.1.0/src/pesto/utils/data_loader.py +122 -0
- pesto_genetics-0.1.0/src/pesto/utils/helpers.py +24 -0
- pesto_genetics-0.1.0/src/pesto_genetics.egg-info/PKG-INFO +187 -0
- pesto_genetics-0.1.0/src/pesto_genetics.egg-info/SOURCES.txt +56 -0
- pesto_genetics-0.1.0/src/pesto_genetics.egg-info/dependency_links.txt +1 -0
- pesto_genetics-0.1.0/src/pesto_genetics.egg-info/entry_points.txt +2 -0
- pesto_genetics-0.1.0/src/pesto_genetics.egg-info/requires.txt +7 -0
- pesto_genetics-0.1.0/src/pesto_genetics.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeremy Guez
|
|
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,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pesto-genetics
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PESTO: is a gene-phenotype association already known? Prior evidence from the literature and from Open Targets
|
|
5
|
+
Author: Jeremy Guez
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/jeremyguez/PESTO-release
|
|
8
|
+
Project-URL: Source, https://github.com/jeremyguez/PESTO-release
|
|
9
|
+
Keywords: genetics,literature,novelty,gene-phenotype,rare variants,GWAS
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: anthropic>=0.40
|
|
17
|
+
Requires-Dist: pandas>=2.0
|
|
18
|
+
Requires-Dist: numpy>=1.24
|
|
19
|
+
Requires-Dist: requests>=2.28
|
|
20
|
+
Requires-Dist: python-dotenv>=1.0
|
|
21
|
+
Requires-Dist: torch>=2.0
|
|
22
|
+
Requires-Dist: transformers>=4.30
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# PESTO
|
|
26
|
+
|
|
27
|
+
**P**rior **E**vidence **S**tatus from **T**ext and **O**ntologies. Given a gene and
|
|
28
|
+
a phenotype, PESTO says how much prior evidence links them, on four ordered
|
|
29
|
+
levels:
|
|
30
|
+
|
|
31
|
+
| Level | Meaning |
|
|
32
|
+
|---|---|
|
|
33
|
+
| Novel | no identified prior association |
|
|
34
|
+
| Hypothesized | mechanistic, animal or indirect support, no human genetic evidence for this pair |
|
|
35
|
+
| Existing | reported human genetic evidence |
|
|
36
|
+
| Established | replicated, accepted human genetic evidence |
|
|
37
|
+
|
|
38
|
+
Two branches answer independently, and are kept apart on purpose:
|
|
39
|
+
|
|
40
|
+
- **Literature.** PubMed is searched under the phenotype's synonyms and the gene's
|
|
41
|
+
aliases, Claude Haiku 4.5 sorts every hit into four relevance bands, and Claude
|
|
42
|
+
Opus 5 reads up to twenty abstracts and spreads 100 points over the four levels,
|
|
43
|
+
citing the PMIDs it relied on.
|
|
44
|
+
- **Open Targets.** The gene's associated traits are fetched from the Open Targets
|
|
45
|
+
Platform, the twenty nearest to the phenotype are ranked by an embedding model
|
|
46
|
+
(BioLORD-2023), and Claude grades how each relates to the queried phenotype. The
|
|
47
|
+
association score of a matching trait sets the level.
|
|
48
|
+
|
|
49
|
+
This is the code of *Large language model classifies prior evidence in
|
|
50
|
+
gene–phenotype associations* (Guez et al., 2026). The [`paper/`](paper/) directory
|
|
51
|
+
redraws every figure and table of the manuscript.
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install pesto-genetics # or: pipx install pesto-genetics
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The install is about 1.3 GB, nearly all of it PyTorch, which the Open Targets
|
|
60
|
+
branch uses to rank traits locally. On Linux, pip's default index serves the CUDA
|
|
61
|
+
build of torch; nothing here uses a GPU, and the CPU build is several hundred
|
|
62
|
+
megabytes smaller:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install pesto-genetics --extra-index-url https://download.pytorch.org/whl/cpu
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The embedding model weights (439 MB) are downloaded on first use into
|
|
69
|
+
`~/.cache/huggingface`. `pesto --download-models` fetches them beforehand.
|
|
70
|
+
|
|
71
|
+
## Your Anthropic API key
|
|
72
|
+
|
|
73
|
+
PESTO calls Claude through the Anthropic API, with your own key, billed to your
|
|
74
|
+
account. Create one at [console.anthropic.com](https://console.anthropic.com), then:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
or put the same line, without `export`, in `~/.local/share/pesto/.env`.
|
|
81
|
+
|
|
82
|
+
**The key stays on your machine.** PESTO never writes it to disk, never prints it,
|
|
83
|
+
and never stores it in a saved run. It is read in one place,
|
|
84
|
+
[`src/pesto/credentials.py`](src/pesto/credentials.py), and handed only to the
|
|
85
|
+
official `anthropic` client in
|
|
86
|
+
[`src/pesto/services/llm_service.py`](src/pesto/services/llm_service.py), which
|
|
87
|
+
sends it to `api.anthropic.com` and nowhere else. Those two files are short; read
|
|
88
|
+
them to check.
|
|
89
|
+
|
|
90
|
+
An NCBI key (`NCBI_API_KEY`, optional) raises the PubMed rate limit from 3 to 10
|
|
91
|
+
requests a second and is handled the same way.
|
|
92
|
+
|
|
93
|
+
## Use
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pesto --gene DDX41 --phenotype "myelodysplastic syndrome"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
prints the literature verdict, the Open Targets verdict, how many articles were
|
|
100
|
+
found and read, and what the pair cost. `--json` returns everything, including
|
|
101
|
+
the probability distribution, the justification and the supporting PMIDs.
|
|
102
|
+
|
|
103
|
+
A table of pairs (tab-separated, columns `gene` and `phenotype`) runs in parallel:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pesto --bench pairs.tsv --workers 10 # writes pesto.tsv and pesto.cost.tsv
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
| Option | What it does |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `--fulltext` | also search Europe PMC for articles that name the gene only in their body (see below) |
|
|
112
|
+
| `--arm NAME` | run one pipeline by name instead of choosing automatically |
|
|
113
|
+
| `--json` | the whole result as JSON |
|
|
114
|
+
| `--no-cache` | read the literature again even if this pair was already answered |
|
|
115
|
+
| `--resume` | with `--bench`, keep the rows an earlier attempt finished |
|
|
116
|
+
| `--model ID`, `--model-fast ID` | use other Claude models; the fingerprint records it |
|
|
117
|
+
| `--ot-encoder biolord\|sapbert\|none` | how Open Targets traits are ranked; `none` reads them all |
|
|
118
|
+
| `--show-pipeline` | print the blocks of the pipeline and their fingerprints, call nothing |
|
|
119
|
+
|
|
120
|
+
`pesto --help` lists the rest.
|
|
121
|
+
|
|
122
|
+
## Pipelines
|
|
123
|
+
|
|
124
|
+
A pipeline ("arm") is declared in [`src/pesto/flow/arms.py`](src/pesto/flow/arms.py)
|
|
125
|
+
as a list of blocks. Its fingerprint hashes every block's parameters and prompts,
|
|
126
|
+
and every saved run carries it, so a result says exactly which pipeline produced it.
|
|
127
|
+
|
|
128
|
+
By default PESTO asks Claude whether the phenotype is a disease, and runs:
|
|
129
|
+
|
|
130
|
+
- **`abstracts`** for a disease: PESTO as in the paper.
|
|
131
|
+
- **`abstracts-trait`** otherwise: the same pipeline with prompts that do not assume
|
|
132
|
+
a disease, so replicated cohort and GWAS evidence can reach Established.
|
|
133
|
+
|
|
134
|
+
With `--fulltext`, it runs **`fulltext`** or **`fulltext-trait`** instead. These add a
|
|
135
|
+
Europe PMC search for articles that report the gene only in their body (a results
|
|
136
|
+
table, a supplementary file) and append the passages naming it for the reader.
|
|
137
|
+
PubMed cannot return those articles, and the deciding paper is often one of them.
|
|
138
|
+
On 20 GWAS associations whose deciding article names the gene only in its body,
|
|
139
|
+
`abstracts` placed 1 at Existing or above and `fulltext` 18, and both kept all 20
|
|
140
|
+
negative controls at Novel or Hypothesized (Supplementary Figure 3). `fulltext` was not used for the analyses of the paper,
|
|
141
|
+
and `fulltext-trait` has not been benchmarked.
|
|
142
|
+
|
|
143
|
+
The other arms reproduce the paper's comparisons: `titles` (titles only),
|
|
144
|
+
`knowledge` (the model's own knowledge, no search), and `abstracts-bare`,
|
|
145
|
+
`abstracts-open` and `abstracts-score` (reading-prompt ablations).
|
|
146
|
+
|
|
147
|
+
## Cost
|
|
148
|
+
|
|
149
|
+
At Anthropic list prices, the literature branch costs about $0.07–0.11 a pair
|
|
150
|
+
with `abstracts` (Extended Data Fig. 2 and Supplementary Figure 3), and 2–3%
|
|
151
|
+
more with `fulltext`; the Open Targets branch about $0.03. Well-studied genes cost more. A
|
|
152
|
+
pair already answered by the same pipeline is read from the cache and costs
|
|
153
|
+
nothing. With `--bench`, the cost of every pair is written to `pesto.cost.tsv`
|
|
154
|
+
as it runs.
|
|
155
|
+
|
|
156
|
+
## Where things are written
|
|
157
|
+
|
|
158
|
+
Runs are saved under `~/.local/share/pesto` (or `$PESTO_PROJECT_ROOT`), one JSON
|
|
159
|
+
per pair with the corpus, the prompts and the model's answer.
|
|
160
|
+
|
|
161
|
+
## Reproducing the paper
|
|
162
|
+
|
|
163
|
+
See [`paper/README.md`](paper/README.md). Every figure and table is redrawn from
|
|
164
|
+
the tables in `paper/results/` without calling any model. The saved model answers
|
|
165
|
+
behind them are on Zenodo:
|
|
166
|
+
[doi:10.5281/zenodo.23230222](https://doi.org/10.5281/zenodo.23230222).
|
|
167
|
+
|
|
168
|
+
## Tests
|
|
169
|
+
|
|
170
|
+
Free, no model calls, no network:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
python3 tests/replay.py # fingerprints, prompts, selection rules, parsing
|
|
174
|
+
python3 tests/script_imports.py # every paper script still imports
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Citation
|
|
178
|
+
|
|
179
|
+
Guez J, Auwerx C, Lu W, Satterstrom FK, Berkowitz J, Fu JM, Betancur C,
|
|
180
|
+
Talkowski ME, Daly MJ, Karczewski KJ. Large language model classifies prior
|
|
181
|
+
evidence in gene–phenotype associations. 2026.
|
|
182
|
+
Code and data: [doi:10.5281/zenodo.23230222](https://doi.org/10.5281/zenodo.23230222).
|
|
183
|
+
|
|
184
|
+
## Licence
|
|
185
|
+
|
|
186
|
+
Code: MIT. Tables and model answers produced for the paper: CC-BY 4.0.
|
|
187
|
+
Third-party content they include keeps the terms of its source.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# PESTO
|
|
2
|
+
|
|
3
|
+
**P**rior **E**vidence **S**tatus from **T**ext and **O**ntologies. Given a gene and
|
|
4
|
+
a phenotype, PESTO says how much prior evidence links them, on four ordered
|
|
5
|
+
levels:
|
|
6
|
+
|
|
7
|
+
| Level | Meaning |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Novel | no identified prior association |
|
|
10
|
+
| Hypothesized | mechanistic, animal or indirect support, no human genetic evidence for this pair |
|
|
11
|
+
| Existing | reported human genetic evidence |
|
|
12
|
+
| Established | replicated, accepted human genetic evidence |
|
|
13
|
+
|
|
14
|
+
Two branches answer independently, and are kept apart on purpose:
|
|
15
|
+
|
|
16
|
+
- **Literature.** PubMed is searched under the phenotype's synonyms and the gene's
|
|
17
|
+
aliases, Claude Haiku 4.5 sorts every hit into four relevance bands, and Claude
|
|
18
|
+
Opus 5 reads up to twenty abstracts and spreads 100 points over the four levels,
|
|
19
|
+
citing the PMIDs it relied on.
|
|
20
|
+
- **Open Targets.** The gene's associated traits are fetched from the Open Targets
|
|
21
|
+
Platform, the twenty nearest to the phenotype are ranked by an embedding model
|
|
22
|
+
(BioLORD-2023), and Claude grades how each relates to the queried phenotype. The
|
|
23
|
+
association score of a matching trait sets the level.
|
|
24
|
+
|
|
25
|
+
This is the code of *Large language model classifies prior evidence in
|
|
26
|
+
gene–phenotype associations* (Guez et al., 2026). The [`paper/`](paper/) directory
|
|
27
|
+
redraws every figure and table of the manuscript.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install pesto-genetics # or: pipx install pesto-genetics
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The install is about 1.3 GB, nearly all of it PyTorch, which the Open Targets
|
|
36
|
+
branch uses to rank traits locally. On Linux, pip's default index serves the CUDA
|
|
37
|
+
build of torch; nothing here uses a GPU, and the CPU build is several hundred
|
|
38
|
+
megabytes smaller:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install pesto-genetics --extra-index-url https://download.pytorch.org/whl/cpu
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The embedding model weights (439 MB) are downloaded on first use into
|
|
45
|
+
`~/.cache/huggingface`. `pesto --download-models` fetches them beforehand.
|
|
46
|
+
|
|
47
|
+
## Your Anthropic API key
|
|
48
|
+
|
|
49
|
+
PESTO calls Claude through the Anthropic API, with your own key, billed to your
|
|
50
|
+
account. Create one at [console.anthropic.com](https://console.anthropic.com), then:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
or put the same line, without `export`, in `~/.local/share/pesto/.env`.
|
|
57
|
+
|
|
58
|
+
**The key stays on your machine.** PESTO never writes it to disk, never prints it,
|
|
59
|
+
and never stores it in a saved run. It is read in one place,
|
|
60
|
+
[`src/pesto/credentials.py`](src/pesto/credentials.py), and handed only to the
|
|
61
|
+
official `anthropic` client in
|
|
62
|
+
[`src/pesto/services/llm_service.py`](src/pesto/services/llm_service.py), which
|
|
63
|
+
sends it to `api.anthropic.com` and nowhere else. Those two files are short; read
|
|
64
|
+
them to check.
|
|
65
|
+
|
|
66
|
+
An NCBI key (`NCBI_API_KEY`, optional) raises the PubMed rate limit from 3 to 10
|
|
67
|
+
requests a second and is handled the same way.
|
|
68
|
+
|
|
69
|
+
## Use
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pesto --gene DDX41 --phenotype "myelodysplastic syndrome"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
prints the literature verdict, the Open Targets verdict, how many articles were
|
|
76
|
+
found and read, and what the pair cost. `--json` returns everything, including
|
|
77
|
+
the probability distribution, the justification and the supporting PMIDs.
|
|
78
|
+
|
|
79
|
+
A table of pairs (tab-separated, columns `gene` and `phenotype`) runs in parallel:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pesto --bench pairs.tsv --workers 10 # writes pesto.tsv and pesto.cost.tsv
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Option | What it does |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `--fulltext` | also search Europe PMC for articles that name the gene only in their body (see below) |
|
|
88
|
+
| `--arm NAME` | run one pipeline by name instead of choosing automatically |
|
|
89
|
+
| `--json` | the whole result as JSON |
|
|
90
|
+
| `--no-cache` | read the literature again even if this pair was already answered |
|
|
91
|
+
| `--resume` | with `--bench`, keep the rows an earlier attempt finished |
|
|
92
|
+
| `--model ID`, `--model-fast ID` | use other Claude models; the fingerprint records it |
|
|
93
|
+
| `--ot-encoder biolord\|sapbert\|none` | how Open Targets traits are ranked; `none` reads them all |
|
|
94
|
+
| `--show-pipeline` | print the blocks of the pipeline and their fingerprints, call nothing |
|
|
95
|
+
|
|
96
|
+
`pesto --help` lists the rest.
|
|
97
|
+
|
|
98
|
+
## Pipelines
|
|
99
|
+
|
|
100
|
+
A pipeline ("arm") is declared in [`src/pesto/flow/arms.py`](src/pesto/flow/arms.py)
|
|
101
|
+
as a list of blocks. Its fingerprint hashes every block's parameters and prompts,
|
|
102
|
+
and every saved run carries it, so a result says exactly which pipeline produced it.
|
|
103
|
+
|
|
104
|
+
By default PESTO asks Claude whether the phenotype is a disease, and runs:
|
|
105
|
+
|
|
106
|
+
- **`abstracts`** for a disease: PESTO as in the paper.
|
|
107
|
+
- **`abstracts-trait`** otherwise: the same pipeline with prompts that do not assume
|
|
108
|
+
a disease, so replicated cohort and GWAS evidence can reach Established.
|
|
109
|
+
|
|
110
|
+
With `--fulltext`, it runs **`fulltext`** or **`fulltext-trait`** instead. These add a
|
|
111
|
+
Europe PMC search for articles that report the gene only in their body (a results
|
|
112
|
+
table, a supplementary file) and append the passages naming it for the reader.
|
|
113
|
+
PubMed cannot return those articles, and the deciding paper is often one of them.
|
|
114
|
+
On 20 GWAS associations whose deciding article names the gene only in its body,
|
|
115
|
+
`abstracts` placed 1 at Existing or above and `fulltext` 18, and both kept all 20
|
|
116
|
+
negative controls at Novel or Hypothesized (Supplementary Figure 3). `fulltext` was not used for the analyses of the paper,
|
|
117
|
+
and `fulltext-trait` has not been benchmarked.
|
|
118
|
+
|
|
119
|
+
The other arms reproduce the paper's comparisons: `titles` (titles only),
|
|
120
|
+
`knowledge` (the model's own knowledge, no search), and `abstracts-bare`,
|
|
121
|
+
`abstracts-open` and `abstracts-score` (reading-prompt ablations).
|
|
122
|
+
|
|
123
|
+
## Cost
|
|
124
|
+
|
|
125
|
+
At Anthropic list prices, the literature branch costs about $0.07–0.11 a pair
|
|
126
|
+
with `abstracts` (Extended Data Fig. 2 and Supplementary Figure 3), and 2–3%
|
|
127
|
+
more with `fulltext`; the Open Targets branch about $0.03. Well-studied genes cost more. A
|
|
128
|
+
pair already answered by the same pipeline is read from the cache and costs
|
|
129
|
+
nothing. With `--bench`, the cost of every pair is written to `pesto.cost.tsv`
|
|
130
|
+
as it runs.
|
|
131
|
+
|
|
132
|
+
## Where things are written
|
|
133
|
+
|
|
134
|
+
Runs are saved under `~/.local/share/pesto` (or `$PESTO_PROJECT_ROOT`), one JSON
|
|
135
|
+
per pair with the corpus, the prompts and the model's answer.
|
|
136
|
+
|
|
137
|
+
## Reproducing the paper
|
|
138
|
+
|
|
139
|
+
See [`paper/README.md`](paper/README.md). Every figure and table is redrawn from
|
|
140
|
+
the tables in `paper/results/` without calling any model. The saved model answers
|
|
141
|
+
behind them are on Zenodo:
|
|
142
|
+
[doi:10.5281/zenodo.23230222](https://doi.org/10.5281/zenodo.23230222).
|
|
143
|
+
|
|
144
|
+
## Tests
|
|
145
|
+
|
|
146
|
+
Free, no model calls, no network:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
python3 tests/replay.py # fingerprints, prompts, selection rules, parsing
|
|
150
|
+
python3 tests/script_imports.py # every paper script still imports
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Citation
|
|
154
|
+
|
|
155
|
+
Guez J, Auwerx C, Lu W, Satterstrom FK, Berkowitz J, Fu JM, Betancur C,
|
|
156
|
+
Talkowski ME, Daly MJ, Karczewski KJ. Large language model classifies prior
|
|
157
|
+
evidence in gene–phenotype associations. 2026.
|
|
158
|
+
Code and data: [doi:10.5281/zenodo.23230222](https://doi.org/10.5281/zenodo.23230222).
|
|
159
|
+
|
|
160
|
+
## Licence
|
|
161
|
+
|
|
162
|
+
Code: MIT. Tables and model answers produced for the paper: CC-BY 4.0.
|
|
163
|
+
Third-party content they include keeps the terms of its source.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pesto-genetics"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "PESTO: is a gene-phenotype association already known? Prior evidence from the literature and from Open Targets"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Jeremy Guez" }]
|
|
14
|
+
keywords = ["genetics", "literature", "novelty", "gene-phenotype", "rare variants", "GWAS"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"anthropic>=0.40",
|
|
22
|
+
"pandas>=2.0",
|
|
23
|
+
"numpy>=1.24",
|
|
24
|
+
"requests>=2.28",
|
|
25
|
+
"python-dotenv>=1.0",
|
|
26
|
+
# The Open Targets matcher ranks a gene's traits with a 110M-parameter
|
|
27
|
+
# embedding model before reading the nearest twenty. `--ot-encoder none`
|
|
28
|
+
# reads the whole answer without it.
|
|
29
|
+
"torch>=2.0",
|
|
30
|
+
"transformers>=4.30",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/jeremyguez/PESTO-release"
|
|
35
|
+
Source = "https://github.com/jeremyguez/PESTO-release"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
pesto = "pesto.cli:main"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.package-data]
|
|
44
|
+
pesto = ["prompts/*.txt", "aliases.tsv"]
|
|
File without changes
|