omnimissense 0.2.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The omnimissense contributors
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,319 @@
1
+ Metadata-Version: 2.4
2
+ Name: omnimissense
3
+ Version: 0.2.0
4
+ Summary: Score missense variants in any species with protein language models, straight from a VCF.
5
+ Keywords: bioinformatics,variant-effect-prediction,missense,protein-language-model,esm,vcf
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
15
+ Requires-Dist: numpy>=2
16
+ Requires-Dist: pyarrow>=20
17
+ Requires-Dist: pysam>=0.24
18
+ Requires-Dist: torch>=2.6
19
+ Requires-Dist: tqdm>=4.66
20
+ Requires-Dist: transformers>=4.56
21
+ Requires-Dist: typer>=0.29
22
+ Requires-Python: >=3.11
23
+ Project-URL: Homepage, https://github.com/dsmear/omnimissense
24
+ Project-URL: Repository, https://github.com/dsmear/omnimissense
25
+ Project-URL: Issues, https://github.com/dsmear/omnimissense/issues
26
+ Description-Content-Type: text/markdown
27
+
28
+ # omnimissense
29
+
30
+ [![CI](https://github.com/dsmear/omnimissense/actions/workflows/ci.yml/badge.svg)](https://github.com/dsmear/omnimissense/actions/workflows/ci.yml)
31
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dsmear/omnimissense/blob/main/LICENSE)
32
+
33
+ **Score missense variants in any species with protein language models, straight from a VCF.**
34
+
35
+ > **Status: alpha.** The pipeline works end to end, reproduces published ESM-2 results and
36
+ > separates known dog disease variants from common dog variants (see [Validation](#validation)).
37
+ > The scores measure how disruptive a substitution looks to the protein, **not** whether it
38
+ > causes disease: do not use them alone for breeding or clinical decisions.
39
+
40
+ ## Why
41
+
42
+ For human variants, precomputed missense effect scores are everywhere (AlphaMissense,
43
+ ESM1b from Brandes et al. 2023, VESM, …). For other species there is almost nothing:
44
+ the usual workaround is to lift variants over to the human genome and borrow human scores,
45
+ which drops variants that have no alignable human counterpart and scores the wrong protein.
46
+
47
+ omnimissense scores each variant on the **species' own protein**, using only files that
48
+ exist for any sequenced genome:
49
+
50
+ | Input | What it is |
51
+ |---|---|
52
+ | VCF | the variants (differences from the reference genome) |
53
+ | FASTA | the reference genome sequence |
54
+ | GFF3 | the gene annotation (where genes, exons and coding sequences are), Ensembl-style |
55
+
56
+ It outputs the same VCF (all records, all samples) with protein-language-model scores in the
57
+ `INFO` field, plus a TSV with one row per missense consequence.
58
+
59
+ ## How it works
60
+
61
+ 1. **REF check.** Every VCF record's REF allele is compared with the genome. Mismatching
62
+ records are flagged (`OMS_REF_MISMATCH`) and skipped; if more than 10% mismatch, the run
63
+ stops (VCF and FASTA are probably from different assemblies).
64
+ 2. **Consequences** are called with [`bcftools csq`](https://samtools.github.io/bcftools/howtos/csq-calling.html)
65
+ (bundled in pysam, nothing to install), one record at a time, for every ALT allele.
66
+ 3. **Proteins** are translated from the FASTA + GFF3. The reference amino acid reported by
67
+ csq must match the translated protein; mismatches are reported (`ref_aa_mismatch`).
68
+ 4. **Scores** come from a protein language model, by default **VESM 650M** (an ESM-2 650M
69
+ re-trained for variant effects, MIT license; fp16 on GPU), as log-likelihood ratios
70
+ `log P(alt) − log P(ref)` at the mutated position (more negative = more likely damaging):
71
+ - `wt_marginal` (default): one forward pass per protein gives all 19 substitutions at
72
+ every position; the whole proteome can be precomputed once (`omnimissense precompute`),
73
+ after which annotating a VCF takes seconds.
74
+ - `masked_marginal` (`--masked`): the position is masked and predicted from its context;
75
+ one forward pass per position, computed only for the variants in the VCF. Usually the
76
+ better mode for plain ESM-2, not for VESM (see Validation).
77
+ - Proteins longer than 1022 residues are split into 1022-residue windows overlapping by
78
+ 511; each residue's scores are a weighted average over the windows that contain it, with
79
+ weights fading near artificial window edges (scheme of Brandes et al. 2023).
80
+ 5. **Cache.** Scores are stored on disk (Parquet) keyed by the SHA-256 of the protein
81
+ sequence, so identical isoforms and repeated runs are never recomputed.
82
+
83
+ ## Quick start: dog
84
+
85
+ The dog reference used by Ensembl (release 116, checked 2026-11-25) is **ROS_Cfam_1.0**
86
+ (GenBank GCA_014441545.1, genebuild 2020-10).
87
+
88
+ ```bash
89
+ mkdir -p data/dog && cd data/dog
90
+ B=https://ftp.ensembl.org/pub/release-116
91
+ curl -O $B/fasta/canis_lupus_familiaris/dna/Canis_lupus_familiaris.ROS_Cfam_1.0.dna.toplevel.fa.gz
92
+ curl -O $B/gff3/canis_lupus_familiaris/Canis_lupus_familiaris.ROS_Cfam_1.0.116.gff3.gz
93
+ cd ../..
94
+
95
+ FASTA=data/dog/Canis_lupus_familiaris.ROS_Cfam_1.0.dna.toplevel.fa.gz
96
+ GFF3=data/dog/Canis_lupus_familiaris.ROS_Cfam_1.0.116.gff3.gz
97
+
98
+ # optional, once: score the whole proteome into the cache (default model: VESM 650M)
99
+ uv run omnimissense precompute --fasta $FASTA --gff3 $GFF3
100
+
101
+ uv run omnimissense annotate --vcf my_dogs.vcf.gz --fasta $FASTA --gff3 $GFF3 \
102
+ -o my_dogs.omnimissense.vcf.gz # also writes my_dogs.omnimissense.tsv
103
+
104
+ # optional: all scores of all coding transcripts in one Parquet file
105
+ uv run omnimissense export --fasta $FASTA --gff3 $GFF3 -o dog_scores.parquet
106
+ ```
107
+
108
+ The plain-gzip FASTA distributed by Ensembl is recompressed once to BGZF (`.fa.bgz`) next to
109
+ the original, because random access needs it.
110
+
111
+ ## Precomputed scores
112
+
113
+ | Species | Assembly / annotation | Model | Dataset |
114
+ |---|---|---|---|
115
+ | Dog | ROS_Cfam_1.0, Ensembl 116 (43,524 coding transcripts) | VESM 650M, wild-type marginal | [DavideMacchia/omnimissense-dog-ros-cfam-1.0-vesm-650m](https://huggingface.co/datasets/DavideMacchia/omnimissense-dog-ros-cfam-1.0-vesm-650m) (Parquet, 1.55 GB, CC-BY-4.0) |
116
+
117
+ Produced with `omnimissense precompute` + `omnimissense export`; the dataset card documents the
118
+ schema, provenance and limitations.
119
+
120
+ ## Output
121
+
122
+ **VCF `INFO` fields**
123
+
124
+ | Field | Number | Content |
125
+ |---|---|---|
126
+ | `OMS` | `.` | one entry per missense consequence: `Allele\|Gene\|Transcript\|Canonical\|ProteinPos\|RefAA\|AltAA\|WTMarginal\|MaskedMarginal\|Status` |
127
+ | `OMS_WT` | `A` | lowest (most damaging) wild-type-marginal score across transcripts, per ALT allele |
128
+ | `OMS_MM` | `A` | lowest masked-marginal score across transcripts, per ALT allele (only with `--masked`) |
129
+ | `OMS_REF_MISMATCH` | flag | the REF allele does not match the genome; record not annotated |
130
+ | `BCSQ` | `.` | consequences from bcftools csq (all consequence types) |
131
+
132
+ **TSV columns:** `chrom pos ref alt gene transcript canonical biotype strand protein_pos
133
+ ref_aa alt_aa protein_length n_windows wt_marginal masked_marginal status`
134
+
135
+ **Status values:** `ok`, `ref_aa_mismatch` (csq and the translated protein disagree),
136
+ `multi_aa_change` (several residues change), `nonstandard_aa`, `protein_unavailable`
137
+ (e.g. internal stop codon), `mitochondrial_skipped` (see limitations). Only `ok` rows are scored.
138
+
139
+ ## Performance (RTX 3070, 8 GB)
140
+
141
+ | Step | Measured |
142
+ |---|---|
143
+ | Wild-type marginals, 650M model fp16 (ESM-2 and VESM have the same size) | ~12,400 residues/s, 1.6 GiB peak VRAM |
144
+ | Whole dog proteome (`precompute`, ESM-2) | 43,092 unique proteins, 26.7 M residues in 36 min; cache 1.4 GB |
145
+ | Masked marginals (`--masked`) | 15–28 positions/s, depending on protein length |
146
+ | Annotate 127,270 dog variants (chr38, 0–5 Mb; 1,689 missense consequences), default settings | 25 s on first run, 12 s when the proteins are cached (1.2 GB RAM) |
147
+ | Same, with `--masked` (ESM-2) | 137 s on first run, 13 s when cached |
148
+ | Proteome translation | ~10 s (after the one-off BGZF conversion of the genome, ~3 min) |
149
+
150
+ ## Validation
151
+
152
+ Scripts and details: [benchmarks/README.md](https://github.com/dsmear/omnimissense/blob/main/benchmarks/README.md). Results, one file per
153
+ model: `benchmarks/results/`. Two models are benchmarked: **ESM-2 650M** and **VESM 650M**
154
+ (an ESM-2 re-trained for variant effects; scored with the wild-type marginal, as its authors
155
+ do).
156
+
157
+ **Implementation checks**
158
+
159
+ - **Coordinates:** a hand-designed synthetic genome (`tests/synthetic.py`) with genes on both
160
+ strands and codons split by introns; every designed variant is recovered with the right
161
+ protein position and amino acids.
162
+ - **Proteome:** the dog proteome translated from FASTA + GFF3 is identical to Ensembl's
163
+ published peptides for 43,524 / 43,524 transcripts (the only exclusion is one
164
+ selenoprotein, see limitations).
165
+ - **ProteinGym** (`benchmarks/proteingym.py`): Spearman correlation between scores and
166
+ experimental fitness. Our ESM-2 masked marginals reproduce the values ProteinGym publishes
167
+ for ESM-2 650M; ProteinGym publishes no VESM values.
168
+
169
+ | DMS assay | organism | length | mutants | ESM-2 (ours) | ESM-2 (published) | VESM (ours) |
170
+ |---|---|---|---|---|---|---|
171
+ | BLAT_ECOLX_Stiffler_2015 | *E. coli* | 286 | 4,996 | 0.732 | 0.731 | **0.774** |
172
+ | KCNJ2_MOUSE_Coyote-Maestas_2022_function | mouse | 428 | 6,963 | 0.382 | 0.382 | **0.390** |
173
+ | SC6A4_HUMAN_Young_2021 | human | 630 | 11,576 | 0.543 | 0.543 | **0.562** |
174
+ | UBE4B_MOUSE_Starita_2013 | mouse | 1,173 | 899 | **0.459** | 0.459 | 0.452 |
175
+ | NPC1_HUMAN_Erwood_2022_HEK293T | human | 1,278 | 637 | 0.695 | 0.694 | **0.725** |
176
+ | BRCA1_HUMAN_Findlay_2018 | human | 1,863 | 1,837 | 0.515 | 0.515 | **0.523** |
177
+
178
+ The last three are longer than 1022 residues and use our sliding windows.
179
+
180
+ **Dog benchmark** (`benchmarks/dog_omia.py`): OMIA dog missense variants mapped to dog
181
+ proteins, against Dog10K missense variants with allele frequency ≥ 5% among 1,872 dogs
182
+ (UU_Cfam_GSD_1.0, annotated by omnimissense). AUROC with 95% bootstrap interval; BLOSUM62 is a
183
+ context-free baseline (amino-acid similarity only).
184
+
185
+ | causal set | common variants | n causal / common | ESM-2 | VESM | BLOSUM62 |
186
+ |---|---|---|---|---|---|
187
+ | pathogenic (AVCG P/LP) | all | 49 / 521 | 0.962 (0.926–0.988) | **0.977** (0.962–0.991) | 0.678 |
188
+ | pathogenic (AVCG P/LP) | same genes | 49 / 33 | 0.947 (0.890–0.987) | **0.961** (0.922–0.989) | 0.613 |
189
+ | disease (P/LP + not yet classified) | all | 118 / 521 | 0.945 (0.919–0.969) | **0.956** (0.932–0.977) | 0.650 |
190
+ | disease | same genes | 118 / 104 | 0.938 (0.904–0.966) | **0.947** (0.915–0.972) | 0.647 |
191
+ | coat/hair **traits** | all | 15 / 521 | 0.968 (0.912–0.999) | 0.946 (0.842–0.999) | 0.728 |
192
+ | pathogenic **vs OMIA traits** | — | 49 / 15 | 0.437 (0.282–0.593) | 0.550 (0.403–0.703) | 0.437 |
193
+
194
+ How to read it:
195
+
196
+ - Both models separate known dog disease variants from common dog variants far better than
197
+ amino-acid similarity alone, also within the same genes.
198
+ - **Trait variants** (coat colour, hair) look as disruptive as disease variants, and neither
199
+ model can tell the two apart (AUROC 0.44–0.55, intervals include chance). The score measures
200
+ damage to the protein, not disease. This also explains the low AUROC (0.55–0.61) reported
201
+ for human-mapped predictors on OMIA when "non-deleterious" (often trait) variants are the
202
+ negatives; our numbers are **not** directly comparable with that study.
203
+ - Common variants are an easy negative set (selection has removed damaging alleles from high
204
+ frequency); the realistic test below uses rare variants instead.
205
+ - Small sets (49 curated pathogenic variants), OMIA ascertainment bias (variants found in
206
+ candidate genes), and 133 of 176 OMIA records mappable to Ensembl proteins (gene symbol
207
+ missing or different protein numbering for the rest).
208
+
209
+ **Realistic test and comparison with the human-ortholog workaround**
210
+ (`benchmarks/dog_realistic.py`). For 50 Dog10K dogs (49 breeds), each dog's candidates are
211
+ the rare missense variants it carries (allele frequency < 1%; median 126 per dog). Each
212
+ causal OMIA variant is inserted in turn among each dog's candidates and ranked. The same
213
+ variants are also scored the way people do today without a dog tool: map the variant to the
214
+ human ortholog (same gene, aligned residue must be identical) and use a human score: the same
215
+ model on the human protein, or AlphaMissense.
216
+
217
+ | 49 pathogenic variants × 50 dogs | median rank | top-1 | top-5 | top-10 |
218
+ |---|---|---|---|---|
219
+ | **omnimissense + VESM** (dog protein) | **4** | 21% | 59% | **72%** |
220
+ | omnimissense + ESM-2 (dog protein) | 6 | 19% | 46% | 66% |
221
+ | VESM on the human ortholog | 4 | 22% | 61% | 73% |
222
+ | ESM-2 on the human ortholog | 6 | 19% | 49% | 67% |
223
+ | AlphaMissense (human) | 4 | 26% | 60% | 75% |
224
+ | BLOSUM62 | 40.5 | 0% | 1% | 13% |
225
+
226
+ | AUROC, pathogenic vs rare variants | all variants (49 / 7,581) | scored by every method (48 / 4,180) |
227
+ |---|---|---|
228
+ | **omnimissense + VESM** | **0.927** | **0.903** |
229
+ | omnimissense + ESM-2 | 0.913 | 0.882 |
230
+ | VESM on the human ortholog | 0.932 | 0.904 |
231
+ | ESM-2 on the human ortholog | 0.915 | 0.874 |
232
+ | AlphaMissense (human) | 0.936 | 0.912 |
233
+
234
+ What this says:
235
+
236
+ - **The model matters most.** VESM puts the causal variant in the top 10 of ~126 rare
237
+ missense candidates in 72% of the trials (ESM-2: 66%), close to AlphaMissense (75%); the
238
+ paired AUROC difference VESM − AlphaMissense is not significant (−0.035 to +0.019 on all
239
+ variants). VESM is MIT-licensed and works for any species; AlphaMissense covers human
240
+ proteins only and has a non-commercial license.
241
+ - **Dog protein vs human protein, same model:** a small gain for the dog protein with ESM-2
242
+ (+0.007 to +0.019 AUROC; paired interval at or above zero in three of four comparisons), no
243
+ difference with VESM (−0.008 to +0.006). Scoring the species' own protein is not, by
244
+ itself, what makes the scores better.
245
+ - **Coverage:** the human workaround can score only 56% of the dogs' rare missense variants
246
+ and 41% of the common ones (the human residue differs or there is no human entry), but 96%
247
+ of the causal variants, which sit on conserved residues. Unscorable variants are mostly
248
+ benign, so for ranking they cost the workaround little in the dog, a species close to
249
+ human. omnimissense scores 100% of them, which should matter more in species far from human.
250
+
251
+ ## Limitations
252
+
253
+ - GFF3 must follow the Ensembl layout (`ID=gene:…`, `ID=transcript:…`), as required by
254
+ bcftools csq. Other sources (e.g. NCBI RefSeq) must be converted first.
255
+ - Mitochondrial transcripts are skipped: mitochondria use a different genetic code and
256
+ bcftools csq applies a single code to the whole genome.
257
+ - Selenoproteins (a TGA codon read as selenocysteine) look like proteins with an internal
258
+ stop and are skipped (1 transcript in the dog).
259
+ - Consequences are computed one record at a time: two nearby variants on the same haplotype
260
+ that change the same codon are scored separately.
261
+ - Variants changing several residues at once (MNVs) are reported but not scored.
262
+ - Scores are raw log-likelihood ratios, not calibrated probabilities of pathogenicity.
263
+
264
+ ## Installation
265
+
266
+ Python ≥ 3.11. A CUDA GPU is strongly recommended (CPU works but is slow); bcftools is
267
+ bundled through pysam, nothing else to install.
268
+
269
+ ```bash
270
+ pip install omnimissense # or: uv tool install omnimissense
271
+ omnimissense doctor # bcftools (bundled), PyTorch, CUDA
272
+ ```
273
+
274
+ ## Installation (development)
275
+
276
+ Requires [uv](https://docs.astral.sh/uv/).
277
+
278
+ ```bash
279
+ git clone https://github.com/dsmear/omnimissense.git
280
+ cd omnimissense
281
+ uv sync
282
+ uv run omnimissense doctor # bcftools (bundled), PyTorch, CUDA
283
+ ```
284
+
285
+ ## Development
286
+
287
+ ```bash
288
+ uv run pre-commit install # ruff lint/format + guards against large files and secrets
289
+ uv run pytest # fast tests, tiny random model, no download
290
+ uv run pytest -m gpu # also runs the real ESM-2 650M (downloads ~2.6 GB once)
291
+ uv run pre-commit run --all-files
292
+ ```
293
+
294
+ Never commit genomes, VCFs, model weights or caches: they are excluded by `.gitignore`, and a
295
+ pre-commit hook rejects any file larger than 500 KB. Decisions and their rationale are logged
296
+ in [NOTES.md](https://github.com/dsmear/omnimissense/blob/main/NOTES.md).
297
+
298
+ ## Models and licenses
299
+
300
+ omnimissense is released under the [MIT License](https://github.com/dsmear/omnimissense/blob/main/LICENSE). Model weights are not
301
+ redistributed: they are downloaded from Hugging Face on first use. Select a model with
302
+ `--model`; the cache is kept separately per model.
303
+
304
+ | Model | Status | License |
305
+ |---|---|---|
306
+ | ESM-2 650M (`facebook/esm2_t33_650M_UR50D`) | supported (reference model of the benchmarks) | MIT |
307
+ | other ESM-2 sizes (e.g. `facebook/esm2_t30_150M_UR50D`) | supported, same architecture | MIT |
308
+ | ESM1b (`facebook/esm1b_t33_650M_UR50S`) | should work, untested | MIT |
309
+ | VESM 650M (`ntranoslab/vesm/VESM_650M`) | **default**; re-trained ESM-2, applied on top of the ESM-2 checkpoint (revision pinned) | MIT |
310
+ | VESM 35M / 150M / 3B (`ntranoslab/vesm/VESM_…`) | supported, not benchmarked (3B needs > 8 GB of GPU memory) | MIT |
311
+ | VESM3, ESM3 | **not supported**: non-commercial license | — |
312
+
313
+ ## Citation
314
+
315
+ If you use omnimissense, please also cite the model you scored with, e.g. ESM-2:
316
+ Lin et al., *Evolutionary-scale prediction of atomic-level protein structure with a language
317
+ model*, Science 379, 1123–1130 (2023). The long-protein windowing follows Brandes et al.,
318
+ *Genome-wide prediction of disease variant effects with a deep protein language model*,
319
+ Nat Genet 55, 1512–1522 (2023).
@@ -0,0 +1,292 @@
1
+ # omnimissense
2
+
3
+ [![CI](https://github.com/dsmear/omnimissense/actions/workflows/ci.yml/badge.svg)](https://github.com/dsmear/omnimissense/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dsmear/omnimissense/blob/main/LICENSE)
5
+
6
+ **Score missense variants in any species with protein language models, straight from a VCF.**
7
+
8
+ > **Status: alpha.** The pipeline works end to end, reproduces published ESM-2 results and
9
+ > separates known dog disease variants from common dog variants (see [Validation](#validation)).
10
+ > The scores measure how disruptive a substitution looks to the protein, **not** whether it
11
+ > causes disease: do not use them alone for breeding or clinical decisions.
12
+
13
+ ## Why
14
+
15
+ For human variants, precomputed missense effect scores are everywhere (AlphaMissense,
16
+ ESM1b from Brandes et al. 2023, VESM, …). For other species there is almost nothing:
17
+ the usual workaround is to lift variants over to the human genome and borrow human scores,
18
+ which drops variants that have no alignable human counterpart and scores the wrong protein.
19
+
20
+ omnimissense scores each variant on the **species' own protein**, using only files that
21
+ exist for any sequenced genome:
22
+
23
+ | Input | What it is |
24
+ |---|---|
25
+ | VCF | the variants (differences from the reference genome) |
26
+ | FASTA | the reference genome sequence |
27
+ | GFF3 | the gene annotation (where genes, exons and coding sequences are), Ensembl-style |
28
+
29
+ It outputs the same VCF (all records, all samples) with protein-language-model scores in the
30
+ `INFO` field, plus a TSV with one row per missense consequence.
31
+
32
+ ## How it works
33
+
34
+ 1. **REF check.** Every VCF record's REF allele is compared with the genome. Mismatching
35
+ records are flagged (`OMS_REF_MISMATCH`) and skipped; if more than 10% mismatch, the run
36
+ stops (VCF and FASTA are probably from different assemblies).
37
+ 2. **Consequences** are called with [`bcftools csq`](https://samtools.github.io/bcftools/howtos/csq-calling.html)
38
+ (bundled in pysam, nothing to install), one record at a time, for every ALT allele.
39
+ 3. **Proteins** are translated from the FASTA + GFF3. The reference amino acid reported by
40
+ csq must match the translated protein; mismatches are reported (`ref_aa_mismatch`).
41
+ 4. **Scores** come from a protein language model, by default **VESM 650M** (an ESM-2 650M
42
+ re-trained for variant effects, MIT license; fp16 on GPU), as log-likelihood ratios
43
+ `log P(alt) − log P(ref)` at the mutated position (more negative = more likely damaging):
44
+ - `wt_marginal` (default): one forward pass per protein gives all 19 substitutions at
45
+ every position; the whole proteome can be precomputed once (`omnimissense precompute`),
46
+ after which annotating a VCF takes seconds.
47
+ - `masked_marginal` (`--masked`): the position is masked and predicted from its context;
48
+ one forward pass per position, computed only for the variants in the VCF. Usually the
49
+ better mode for plain ESM-2, not for VESM (see Validation).
50
+ - Proteins longer than 1022 residues are split into 1022-residue windows overlapping by
51
+ 511; each residue's scores are a weighted average over the windows that contain it, with
52
+ weights fading near artificial window edges (scheme of Brandes et al. 2023).
53
+ 5. **Cache.** Scores are stored on disk (Parquet) keyed by the SHA-256 of the protein
54
+ sequence, so identical isoforms and repeated runs are never recomputed.
55
+
56
+ ## Quick start: dog
57
+
58
+ The dog reference used by Ensembl (release 116, checked 2026-11-25) is **ROS_Cfam_1.0**
59
+ (GenBank GCA_014441545.1, genebuild 2020-10).
60
+
61
+ ```bash
62
+ mkdir -p data/dog && cd data/dog
63
+ B=https://ftp.ensembl.org/pub/release-116
64
+ curl -O $B/fasta/canis_lupus_familiaris/dna/Canis_lupus_familiaris.ROS_Cfam_1.0.dna.toplevel.fa.gz
65
+ curl -O $B/gff3/canis_lupus_familiaris/Canis_lupus_familiaris.ROS_Cfam_1.0.116.gff3.gz
66
+ cd ../..
67
+
68
+ FASTA=data/dog/Canis_lupus_familiaris.ROS_Cfam_1.0.dna.toplevel.fa.gz
69
+ GFF3=data/dog/Canis_lupus_familiaris.ROS_Cfam_1.0.116.gff3.gz
70
+
71
+ # optional, once: score the whole proteome into the cache (default model: VESM 650M)
72
+ uv run omnimissense precompute --fasta $FASTA --gff3 $GFF3
73
+
74
+ uv run omnimissense annotate --vcf my_dogs.vcf.gz --fasta $FASTA --gff3 $GFF3 \
75
+ -o my_dogs.omnimissense.vcf.gz # also writes my_dogs.omnimissense.tsv
76
+
77
+ # optional: all scores of all coding transcripts in one Parquet file
78
+ uv run omnimissense export --fasta $FASTA --gff3 $GFF3 -o dog_scores.parquet
79
+ ```
80
+
81
+ The plain-gzip FASTA distributed by Ensembl is recompressed once to BGZF (`.fa.bgz`) next to
82
+ the original, because random access needs it.
83
+
84
+ ## Precomputed scores
85
+
86
+ | Species | Assembly / annotation | Model | Dataset |
87
+ |---|---|---|---|
88
+ | Dog | ROS_Cfam_1.0, Ensembl 116 (43,524 coding transcripts) | VESM 650M, wild-type marginal | [DavideMacchia/omnimissense-dog-ros-cfam-1.0-vesm-650m](https://huggingface.co/datasets/DavideMacchia/omnimissense-dog-ros-cfam-1.0-vesm-650m) (Parquet, 1.55 GB, CC-BY-4.0) |
89
+
90
+ Produced with `omnimissense precompute` + `omnimissense export`; the dataset card documents the
91
+ schema, provenance and limitations.
92
+
93
+ ## Output
94
+
95
+ **VCF `INFO` fields**
96
+
97
+ | Field | Number | Content |
98
+ |---|---|---|
99
+ | `OMS` | `.` | one entry per missense consequence: `Allele\|Gene\|Transcript\|Canonical\|ProteinPos\|RefAA\|AltAA\|WTMarginal\|MaskedMarginal\|Status` |
100
+ | `OMS_WT` | `A` | lowest (most damaging) wild-type-marginal score across transcripts, per ALT allele |
101
+ | `OMS_MM` | `A` | lowest masked-marginal score across transcripts, per ALT allele (only with `--masked`) |
102
+ | `OMS_REF_MISMATCH` | flag | the REF allele does not match the genome; record not annotated |
103
+ | `BCSQ` | `.` | consequences from bcftools csq (all consequence types) |
104
+
105
+ **TSV columns:** `chrom pos ref alt gene transcript canonical biotype strand protein_pos
106
+ ref_aa alt_aa protein_length n_windows wt_marginal masked_marginal status`
107
+
108
+ **Status values:** `ok`, `ref_aa_mismatch` (csq and the translated protein disagree),
109
+ `multi_aa_change` (several residues change), `nonstandard_aa`, `protein_unavailable`
110
+ (e.g. internal stop codon), `mitochondrial_skipped` (see limitations). Only `ok` rows are scored.
111
+
112
+ ## Performance (RTX 3070, 8 GB)
113
+
114
+ | Step | Measured |
115
+ |---|---|
116
+ | Wild-type marginals, 650M model fp16 (ESM-2 and VESM have the same size) | ~12,400 residues/s, 1.6 GiB peak VRAM |
117
+ | Whole dog proteome (`precompute`, ESM-2) | 43,092 unique proteins, 26.7 M residues in 36 min; cache 1.4 GB |
118
+ | Masked marginals (`--masked`) | 15–28 positions/s, depending on protein length |
119
+ | Annotate 127,270 dog variants (chr38, 0–5 Mb; 1,689 missense consequences), default settings | 25 s on first run, 12 s when the proteins are cached (1.2 GB RAM) |
120
+ | Same, with `--masked` (ESM-2) | 137 s on first run, 13 s when cached |
121
+ | Proteome translation | ~10 s (after the one-off BGZF conversion of the genome, ~3 min) |
122
+
123
+ ## Validation
124
+
125
+ Scripts and details: [benchmarks/README.md](https://github.com/dsmear/omnimissense/blob/main/benchmarks/README.md). Results, one file per
126
+ model: `benchmarks/results/`. Two models are benchmarked: **ESM-2 650M** and **VESM 650M**
127
+ (an ESM-2 re-trained for variant effects; scored with the wild-type marginal, as its authors
128
+ do).
129
+
130
+ **Implementation checks**
131
+
132
+ - **Coordinates:** a hand-designed synthetic genome (`tests/synthetic.py`) with genes on both
133
+ strands and codons split by introns; every designed variant is recovered with the right
134
+ protein position and amino acids.
135
+ - **Proteome:** the dog proteome translated from FASTA + GFF3 is identical to Ensembl's
136
+ published peptides for 43,524 / 43,524 transcripts (the only exclusion is one
137
+ selenoprotein, see limitations).
138
+ - **ProteinGym** (`benchmarks/proteingym.py`): Spearman correlation between scores and
139
+ experimental fitness. Our ESM-2 masked marginals reproduce the values ProteinGym publishes
140
+ for ESM-2 650M; ProteinGym publishes no VESM values.
141
+
142
+ | DMS assay | organism | length | mutants | ESM-2 (ours) | ESM-2 (published) | VESM (ours) |
143
+ |---|---|---|---|---|---|---|
144
+ | BLAT_ECOLX_Stiffler_2015 | *E. coli* | 286 | 4,996 | 0.732 | 0.731 | **0.774** |
145
+ | KCNJ2_MOUSE_Coyote-Maestas_2022_function | mouse | 428 | 6,963 | 0.382 | 0.382 | **0.390** |
146
+ | SC6A4_HUMAN_Young_2021 | human | 630 | 11,576 | 0.543 | 0.543 | **0.562** |
147
+ | UBE4B_MOUSE_Starita_2013 | mouse | 1,173 | 899 | **0.459** | 0.459 | 0.452 |
148
+ | NPC1_HUMAN_Erwood_2022_HEK293T | human | 1,278 | 637 | 0.695 | 0.694 | **0.725** |
149
+ | BRCA1_HUMAN_Findlay_2018 | human | 1,863 | 1,837 | 0.515 | 0.515 | **0.523** |
150
+
151
+ The last three are longer than 1022 residues and use our sliding windows.
152
+
153
+ **Dog benchmark** (`benchmarks/dog_omia.py`): OMIA dog missense variants mapped to dog
154
+ proteins, against Dog10K missense variants with allele frequency ≥ 5% among 1,872 dogs
155
+ (UU_Cfam_GSD_1.0, annotated by omnimissense). AUROC with 95% bootstrap interval; BLOSUM62 is a
156
+ context-free baseline (amino-acid similarity only).
157
+
158
+ | causal set | common variants | n causal / common | ESM-2 | VESM | BLOSUM62 |
159
+ |---|---|---|---|---|---|
160
+ | pathogenic (AVCG P/LP) | all | 49 / 521 | 0.962 (0.926–0.988) | **0.977** (0.962–0.991) | 0.678 |
161
+ | pathogenic (AVCG P/LP) | same genes | 49 / 33 | 0.947 (0.890–0.987) | **0.961** (0.922–0.989) | 0.613 |
162
+ | disease (P/LP + not yet classified) | all | 118 / 521 | 0.945 (0.919–0.969) | **0.956** (0.932–0.977) | 0.650 |
163
+ | disease | same genes | 118 / 104 | 0.938 (0.904–0.966) | **0.947** (0.915–0.972) | 0.647 |
164
+ | coat/hair **traits** | all | 15 / 521 | 0.968 (0.912–0.999) | 0.946 (0.842–0.999) | 0.728 |
165
+ | pathogenic **vs OMIA traits** | — | 49 / 15 | 0.437 (0.282–0.593) | 0.550 (0.403–0.703) | 0.437 |
166
+
167
+ How to read it:
168
+
169
+ - Both models separate known dog disease variants from common dog variants far better than
170
+ amino-acid similarity alone, also within the same genes.
171
+ - **Trait variants** (coat colour, hair) look as disruptive as disease variants, and neither
172
+ model can tell the two apart (AUROC 0.44–0.55, intervals include chance). The score measures
173
+ damage to the protein, not disease. This also explains the low AUROC (0.55–0.61) reported
174
+ for human-mapped predictors on OMIA when "non-deleterious" (often trait) variants are the
175
+ negatives; our numbers are **not** directly comparable with that study.
176
+ - Common variants are an easy negative set (selection has removed damaging alleles from high
177
+ frequency); the realistic test below uses rare variants instead.
178
+ - Small sets (49 curated pathogenic variants), OMIA ascertainment bias (variants found in
179
+ candidate genes), and 133 of 176 OMIA records mappable to Ensembl proteins (gene symbol
180
+ missing or different protein numbering for the rest).
181
+
182
+ **Realistic test and comparison with the human-ortholog workaround**
183
+ (`benchmarks/dog_realistic.py`). For 50 Dog10K dogs (49 breeds), each dog's candidates are
184
+ the rare missense variants it carries (allele frequency < 1%; median 126 per dog). Each
185
+ causal OMIA variant is inserted in turn among each dog's candidates and ranked. The same
186
+ variants are also scored the way people do today without a dog tool: map the variant to the
187
+ human ortholog (same gene, aligned residue must be identical) and use a human score: the same
188
+ model on the human protein, or AlphaMissense.
189
+
190
+ | 49 pathogenic variants × 50 dogs | median rank | top-1 | top-5 | top-10 |
191
+ |---|---|---|---|---|
192
+ | **omnimissense + VESM** (dog protein) | **4** | 21% | 59% | **72%** |
193
+ | omnimissense + ESM-2 (dog protein) | 6 | 19% | 46% | 66% |
194
+ | VESM on the human ortholog | 4 | 22% | 61% | 73% |
195
+ | ESM-2 on the human ortholog | 6 | 19% | 49% | 67% |
196
+ | AlphaMissense (human) | 4 | 26% | 60% | 75% |
197
+ | BLOSUM62 | 40.5 | 0% | 1% | 13% |
198
+
199
+ | AUROC, pathogenic vs rare variants | all variants (49 / 7,581) | scored by every method (48 / 4,180) |
200
+ |---|---|---|
201
+ | **omnimissense + VESM** | **0.927** | **0.903** |
202
+ | omnimissense + ESM-2 | 0.913 | 0.882 |
203
+ | VESM on the human ortholog | 0.932 | 0.904 |
204
+ | ESM-2 on the human ortholog | 0.915 | 0.874 |
205
+ | AlphaMissense (human) | 0.936 | 0.912 |
206
+
207
+ What this says:
208
+
209
+ - **The model matters most.** VESM puts the causal variant in the top 10 of ~126 rare
210
+ missense candidates in 72% of the trials (ESM-2: 66%), close to AlphaMissense (75%); the
211
+ paired AUROC difference VESM − AlphaMissense is not significant (−0.035 to +0.019 on all
212
+ variants). VESM is MIT-licensed and works for any species; AlphaMissense covers human
213
+ proteins only and has a non-commercial license.
214
+ - **Dog protein vs human protein, same model:** a small gain for the dog protein with ESM-2
215
+ (+0.007 to +0.019 AUROC; paired interval at or above zero in three of four comparisons), no
216
+ difference with VESM (−0.008 to +0.006). Scoring the species' own protein is not, by
217
+ itself, what makes the scores better.
218
+ - **Coverage:** the human workaround can score only 56% of the dogs' rare missense variants
219
+ and 41% of the common ones (the human residue differs or there is no human entry), but 96%
220
+ of the causal variants, which sit on conserved residues. Unscorable variants are mostly
221
+ benign, so for ranking they cost the workaround little in the dog, a species close to
222
+ human. omnimissense scores 100% of them, which should matter more in species far from human.
223
+
224
+ ## Limitations
225
+
226
+ - GFF3 must follow the Ensembl layout (`ID=gene:…`, `ID=transcript:…`), as required by
227
+ bcftools csq. Other sources (e.g. NCBI RefSeq) must be converted first.
228
+ - Mitochondrial transcripts are skipped: mitochondria use a different genetic code and
229
+ bcftools csq applies a single code to the whole genome.
230
+ - Selenoproteins (a TGA codon read as selenocysteine) look like proteins with an internal
231
+ stop and are skipped (1 transcript in the dog).
232
+ - Consequences are computed one record at a time: two nearby variants on the same haplotype
233
+ that change the same codon are scored separately.
234
+ - Variants changing several residues at once (MNVs) are reported but not scored.
235
+ - Scores are raw log-likelihood ratios, not calibrated probabilities of pathogenicity.
236
+
237
+ ## Installation
238
+
239
+ Python ≥ 3.11. A CUDA GPU is strongly recommended (CPU works but is slow); bcftools is
240
+ bundled through pysam, nothing else to install.
241
+
242
+ ```bash
243
+ pip install omnimissense # or: uv tool install omnimissense
244
+ omnimissense doctor # bcftools (bundled), PyTorch, CUDA
245
+ ```
246
+
247
+ ## Installation (development)
248
+
249
+ Requires [uv](https://docs.astral.sh/uv/).
250
+
251
+ ```bash
252
+ git clone https://github.com/dsmear/omnimissense.git
253
+ cd omnimissense
254
+ uv sync
255
+ uv run omnimissense doctor # bcftools (bundled), PyTorch, CUDA
256
+ ```
257
+
258
+ ## Development
259
+
260
+ ```bash
261
+ uv run pre-commit install # ruff lint/format + guards against large files and secrets
262
+ uv run pytest # fast tests, tiny random model, no download
263
+ uv run pytest -m gpu # also runs the real ESM-2 650M (downloads ~2.6 GB once)
264
+ uv run pre-commit run --all-files
265
+ ```
266
+
267
+ Never commit genomes, VCFs, model weights or caches: they are excluded by `.gitignore`, and a
268
+ pre-commit hook rejects any file larger than 500 KB. Decisions and their rationale are logged
269
+ in [NOTES.md](https://github.com/dsmear/omnimissense/blob/main/NOTES.md).
270
+
271
+ ## Models and licenses
272
+
273
+ omnimissense is released under the [MIT License](https://github.com/dsmear/omnimissense/blob/main/LICENSE). Model weights are not
274
+ redistributed: they are downloaded from Hugging Face on first use. Select a model with
275
+ `--model`; the cache is kept separately per model.
276
+
277
+ | Model | Status | License |
278
+ |---|---|---|
279
+ | ESM-2 650M (`facebook/esm2_t33_650M_UR50D`) | supported (reference model of the benchmarks) | MIT |
280
+ | other ESM-2 sizes (e.g. `facebook/esm2_t30_150M_UR50D`) | supported, same architecture | MIT |
281
+ | ESM1b (`facebook/esm1b_t33_650M_UR50S`) | should work, untested | MIT |
282
+ | VESM 650M (`ntranoslab/vesm/VESM_650M`) | **default**; re-trained ESM-2, applied on top of the ESM-2 checkpoint (revision pinned) | MIT |
283
+ | VESM 35M / 150M / 3B (`ntranoslab/vesm/VESM_…`) | supported, not benchmarked (3B needs > 8 GB of GPU memory) | MIT |
284
+ | VESM3, ESM3 | **not supported**: non-commercial license | — |
285
+
286
+ ## Citation
287
+
288
+ If you use omnimissense, please also cite the model you scored with, e.g. ESM-2:
289
+ Lin et al., *Evolutionary-scale prediction of atomic-level protein structure with a language
290
+ model*, Science 379, 1123–1130 (2023). The long-protein windowing follows Brandes et al.,
291
+ *Genome-wide prediction of disease variant effects with a deep protein language model*,
292
+ Nat Genet 55, 1512–1522 (2023).