vipsania 1.0.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.
- vipsania-1.0.0/.gitignore +178 -0
- vipsania-1.0.0/LICENSE +21 -0
- vipsania-1.0.0/PKG-INFO +206 -0
- vipsania-1.0.0/README.md +182 -0
- vipsania-1.0.0/configs/base_10M.json +107 -0
- vipsania-1.0.0/configs/base_25M.json +101 -0
- vipsania-1.0.0/configs/base_2M.json +107 -0
- vipsania-1.0.0/configs/resume.json +21 -0
- vipsania-1.0.0/configs/train.json +16 -0
- vipsania-1.0.0/configs/versions.json +57 -0
- vipsania-1.0.0/docs/README.md +55 -0
- vipsania-1.0.0/docs/annotate.md +59 -0
- vipsania-1.0.0/docs/download.md +48 -0
- vipsania-1.0.0/docs/example/aspergillus_fumigatus_chr7.fa +25731 -0
- vipsania-1.0.0/docs/example/vipsania_fh1kg88z.gff +5719 -0
- vipsania-1.0.0/docs/test_species.tsv +267 -0
- vipsania-1.0.0/docs/training.md +206 -0
- vipsania-1.0.0/docs/training_species.tsv +1693 -0
- vipsania-1.0.0/docs/troubleshooting.md +15 -0
- vipsania-1.0.0/pyproject.toml +51 -0
- vipsania-1.0.0/scripts/annotate.py +15 -0
- vipsania-1.0.0/scripts/download.py +15 -0
- vipsania-1.0.0/scripts/train.py +15 -0
- vipsania-1.0.0/vipsania/__init__.py +50 -0
- vipsania-1.0.0/vipsania/__main__.py +3 -0
- vipsania-1.0.0/vipsania/annotate.py +133 -0
- vipsania-1.0.0/vipsania/cli/__init__.py +1 -0
- vipsania-1.0.0/vipsania/cli/annotate.py +546 -0
- vipsania-1.0.0/vipsania/cli/device.py +33 -0
- vipsania-1.0.0/vipsania/cli/download.py +65 -0
- vipsania-1.0.0/vipsania/cli/main.py +36 -0
- vipsania-1.0.0/vipsania/cli/train.py +193 -0
- vipsania-1.0.0/vipsania/data/__init__.py +5 -0
- vipsania-1.0.0/vipsania/data/dataset.py +383 -0
- vipsania-1.0.0/vipsania/data/mask.py +296 -0
- vipsania-1.0.0/vipsania/data/util.py +190 -0
- vipsania-1.0.0/vipsania/data/watch.py +124 -0
- vipsania-1.0.0/vipsania/hooks.py +35 -0
- vipsania-1.0.0/vipsania/hub.py +298 -0
- vipsania-1.0.0/vipsania/model/__init__.py +1 -0
- vipsania-1.0.0/vipsania/model/base.py +358 -0
- vipsania-1.0.0/vipsania/model/ffn.py +111 -0
- vipsania-1.0.0/vipsania/model/hmm.py +193 -0
- vipsania-1.0.0/vipsania/model/layer.py +147 -0
- vipsania-1.0.0/vipsania/model/loss.py +172 -0
- vipsania-1.0.0/vipsania/model/lru.py +336 -0
- vipsania-1.0.0/vipsania/model/scan.py +324 -0
- vipsania-1.0.0/vipsania/train/__init__.py +5 -0
- vipsania-1.0.0/vipsania/train/callback.py +534 -0
- vipsania-1.0.0/vipsania/train/metrics.py +105 -0
- vipsania-1.0.0/vipsania/train/schedule.py +164 -0
- vipsania-1.0.0/vipsania/train/trainer.py +343 -0
- vipsania-1.0.0/vipsania/train/util.py +205 -0
- vipsania-1.0.0/vipsania/util.py +298 -0
- vipsania-1.0.0/vipsania/xai/__init__.py +1 -0
- vipsania-1.0.0/vipsania/xai/evaluate.py +371 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# poetry
|
|
7
|
+
poetry.lock
|
|
8
|
+
|
|
9
|
+
# checkpoints
|
|
10
|
+
wandb/
|
|
11
|
+
checkpoints/
|
|
12
|
+
|
|
13
|
+
# C extensions
|
|
14
|
+
*.so
|
|
15
|
+
|
|
16
|
+
# Distribution / packaging
|
|
17
|
+
.Python
|
|
18
|
+
build/
|
|
19
|
+
develop-eggs/
|
|
20
|
+
dist/
|
|
21
|
+
downloads/
|
|
22
|
+
eggs/
|
|
23
|
+
.eggs/
|
|
24
|
+
lib/
|
|
25
|
+
lib64/
|
|
26
|
+
parts/
|
|
27
|
+
sdist/
|
|
28
|
+
var/
|
|
29
|
+
wheels/
|
|
30
|
+
share/python-wheels/
|
|
31
|
+
*.egg-info/
|
|
32
|
+
.installed.cfg
|
|
33
|
+
*.egg
|
|
34
|
+
MANIFEST
|
|
35
|
+
|
|
36
|
+
# PyInstaller
|
|
37
|
+
# Usually these files are written by a python script from a template
|
|
38
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
39
|
+
*.manifest
|
|
40
|
+
*.spec
|
|
41
|
+
|
|
42
|
+
# Installer logs
|
|
43
|
+
pip-log.txt
|
|
44
|
+
pip-delete-this-directory.txt
|
|
45
|
+
|
|
46
|
+
# Unit test / coverage reports
|
|
47
|
+
htmlcov/
|
|
48
|
+
.tox/
|
|
49
|
+
.nox/
|
|
50
|
+
.coverage
|
|
51
|
+
.coverage.*
|
|
52
|
+
.cache
|
|
53
|
+
nosetests.xml
|
|
54
|
+
coverage.xml
|
|
55
|
+
*.cover
|
|
56
|
+
*.py,cover
|
|
57
|
+
.hypothesis/
|
|
58
|
+
.pytest_cache/
|
|
59
|
+
cover/
|
|
60
|
+
|
|
61
|
+
# Translations
|
|
62
|
+
*.mo
|
|
63
|
+
*.pot
|
|
64
|
+
|
|
65
|
+
# Django stuff:
|
|
66
|
+
*.log
|
|
67
|
+
local_settings.py
|
|
68
|
+
db.sqlite3
|
|
69
|
+
db.sqlite3-journal
|
|
70
|
+
|
|
71
|
+
# Flask stuff:
|
|
72
|
+
instance/
|
|
73
|
+
.webassets-cache
|
|
74
|
+
|
|
75
|
+
# Scrapy stuff:
|
|
76
|
+
.scrapy
|
|
77
|
+
|
|
78
|
+
# Sphinx documentation
|
|
79
|
+
docs/_build/
|
|
80
|
+
|
|
81
|
+
# PyBuilder
|
|
82
|
+
.pybuilder/
|
|
83
|
+
target/
|
|
84
|
+
|
|
85
|
+
# Jupyter Notebook
|
|
86
|
+
.ipynb_checkpoints
|
|
87
|
+
|
|
88
|
+
# IPython
|
|
89
|
+
profile_default/
|
|
90
|
+
ipython_config.py
|
|
91
|
+
|
|
92
|
+
# pyenv
|
|
93
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
94
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
95
|
+
# .python-version
|
|
96
|
+
|
|
97
|
+
# pipenv
|
|
98
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
99
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
100
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
101
|
+
# install all needed dependencies.
|
|
102
|
+
#Pipfile.lock
|
|
103
|
+
|
|
104
|
+
# UV
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
#uv.lock
|
|
109
|
+
|
|
110
|
+
# poetry
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
112
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
113
|
+
# commonly ignored for libraries.
|
|
114
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
115
|
+
#poetry.lock
|
|
116
|
+
|
|
117
|
+
# pdm
|
|
118
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
119
|
+
#pdm.lock
|
|
120
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
121
|
+
# in version control.
|
|
122
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
123
|
+
.pdm.toml
|
|
124
|
+
.pdm-python
|
|
125
|
+
.pdm-build/
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.venv
|
|
140
|
+
env/
|
|
141
|
+
venv/
|
|
142
|
+
ENV/
|
|
143
|
+
env.bak/
|
|
144
|
+
venv.bak/
|
|
145
|
+
|
|
146
|
+
# Spyder project settings
|
|
147
|
+
.spyderproject
|
|
148
|
+
.spyproject
|
|
149
|
+
|
|
150
|
+
# Rope project settings
|
|
151
|
+
.ropeproject
|
|
152
|
+
|
|
153
|
+
# mkdocs documentation
|
|
154
|
+
/site
|
|
155
|
+
|
|
156
|
+
# mypy
|
|
157
|
+
.mypy_cache/
|
|
158
|
+
.dmypy.json
|
|
159
|
+
dmypy.json
|
|
160
|
+
|
|
161
|
+
# Pyre type checker
|
|
162
|
+
.pyre/
|
|
163
|
+
|
|
164
|
+
# pytype static type analyzer
|
|
165
|
+
.pytype/
|
|
166
|
+
|
|
167
|
+
# Cython debug symbols
|
|
168
|
+
cython_debug/
|
|
169
|
+
|
|
170
|
+
# PyCharm
|
|
171
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
172
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
173
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
174
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
175
|
+
#.idea/
|
|
176
|
+
|
|
177
|
+
# PyPI configuration file
|
|
178
|
+
.pypirc
|
vipsania-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Richard Krieg
|
|
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.
|
vipsania-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: vipsania
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An unsupervised deep learning ab-initio gene finder.
|
|
5
|
+
Project-URL: Homepage, https://github.com/gaius-augustus/vipsania
|
|
6
|
+
Project-URL: Issues, https://github.com/gaius-augustus/vipsania/issues
|
|
7
|
+
Author-email: Richard Krieg <irkri@irkri.net>, Mario Stanke <mario.stanke@uni-greifswald.de>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: bioinformatics,deep learning,gene finding,genome annotation,genome foundation model,hidden Markov model,masked language modelling,unsupervised learning
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Requires-Dist: bricks2marble[tf]
|
|
21
|
+
Requires-Dist: tensorflow<2.20
|
|
22
|
+
Requires-Dist: wandb
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# Vipsania
|
|
26
|
+
|
|
27
|
+
**Vipsania is an unsupervised deep learning *ab-initio* gene finder.**
|
|
28
|
+
|
|
29
|
+
Unlike other deep learning gene finders, Vipsania is never shown a reference annotation. It is
|
|
30
|
+
trained purely on raw genomic sequences with a masked language modelling objective: nucleotides are
|
|
31
|
+
hidden and the model learns to predict them from their context. Gene structure emerges as the
|
|
32
|
+
representation a hidden Markov model inside the network needs in order to explain the sequence, so
|
|
33
|
+
no curated gene set, no related-species annotation and no protein evidence are required at any
|
|
34
|
+
point.
|
|
35
|
+
|
|
36
|
+
For you, this means:
|
|
37
|
+
|
|
38
|
+
- **Annotate any eukaryotic genome from a FASTA file alone.** No extrinsic evidence, no reference
|
|
39
|
+
annotation, no gene-structure training data of any kind.
|
|
40
|
+
- **Adapt the model to your species on the fly.** Because training needs nothing but sequence, the
|
|
41
|
+
genome you want to annotate is itself valid training data. A short finetuning run on your target
|
|
42
|
+
genome directly before annotating gives the best results — see
|
|
43
|
+
[Finetuning](#finetuning-recommended).
|
|
44
|
+
- **Get standard output.** Annotations are written as GenePred, GFF3 or GTF.
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
Vipsania requires `python>=3.12`. It is recommended to install into a clean virtual environment
|
|
49
|
+
(e.g. using `conda`, `pyenv` or `uv`).
|
|
50
|
+
|
|
51
|
+
$ python -m pip install vipsania
|
|
52
|
+
|
|
53
|
+
This installs the `vipsania` command, which is everything you need to annotate a genome. For
|
|
54
|
+
training, use the [config files](/configs) provided and follow the instructions [here](#training).
|
|
55
|
+
|
|
56
|
+
Alternatively, you can clone the repository, install Vipsania from source and use the
|
|
57
|
+
[scripts](/scripts) for annotation and training.
|
|
58
|
+
|
|
59
|
+
$ git clone https://github.com/gaius-augustus/vipsania
|
|
60
|
+
$ python -m pip install -e vipsania/
|
|
61
|
+
|
|
62
|
+
Installing Vipsania pulls in [bricks2marble](https://github.com/gaius-augustus/bricks2marble) and
|
|
63
|
+
[hidten](https://github.com/gaius-augustus/hidten), which in turn install TensorFlow with CUDA
|
|
64
|
+
support. A GPU is strongly recommended; annotating a large genome on CPU only is possible, but
|
|
65
|
+
slow.
|
|
66
|
+
|
|
67
|
+
## Annotating a genome
|
|
68
|
+
|
|
69
|
+
Annotation is done with `vipsania annotate`. It needs a trained model and a FASTA file of the
|
|
70
|
+
genome you want to annotate.
|
|
71
|
+
|
|
72
|
+
$ vipsania annotate <model_id> genome.fa -o annotation.gff3 --finetune
|
|
73
|
+
|
|
74
|
+
The same command is available as `python -m vipsania annotate ...`, and from a cloned repository as
|
|
75
|
+
`python scripts/annotate.py ...`.
|
|
76
|
+
|
|
77
|
+
The first argument names the model to use, either by the **clade** it was trained for or by its
|
|
78
|
+
**model ID**, both listed below. The first time a model is used, Vipsania downloads it (about 100
|
|
79
|
+
MB) and keeps it, so every later annotation with it starts immediately.
|
|
80
|
+
|
|
81
|
+
$ vipsania annotate Insecta genome.fa -o annotation.gff3 --finetune
|
|
82
|
+
|
|
83
|
+
A clade name gives you the model we recommend for that clade at the moment. Should a clade get a
|
|
84
|
+
better model later, `vipsania download <clade>` picks it up; annotating on its own keeps using the
|
|
85
|
+
model it already has. A model ID always refers to that one model.
|
|
86
|
+
|
|
87
|
+
A model you trained yourself is given in the same way: its ID is the name of its run folder, which
|
|
88
|
+
Vipsania looks for in the directories around the working directory. Set `--model_dir` to use a
|
|
89
|
+
different directory that holds the model folder directly.
|
|
90
|
+
|
|
91
|
+
Progress is printed to the terminal while the genome is annotated, together with a log file next to
|
|
92
|
+
the output.
|
|
93
|
+
|
|
94
|
+
### Choosing a model
|
|
95
|
+
|
|
96
|
+
Vipsania is trained per clade. Use the model of the clade your species belongs to, choosing the
|
|
97
|
+
most specific one available.
|
|
98
|
+
|
|
99
|
+
| Clade | Model ID | Training species | Test species | Average locus F1 | Average locus F1 (pretrained) |
|
|
100
|
+
| --- | --- | ---: | ---: | ---: | ---: |
|
|
101
|
+
| Alveolata | sd2zcj7u | 30 | 6 | 0.613 | 0.582 |
|
|
102
|
+
| Amoebozoa | ezhpj2qm | 15 | 7 | 0.437 | 0.416 |
|
|
103
|
+
| Arthropoda | ihe1jk30 | 200 | 6 | 0.207 | 0.217 |
|
|
104
|
+
| Chlorophyta | faeijtmk | 26 | 6 | 0.579 | 0.558 |
|
|
105
|
+
| Cnidaria | b5vtieo0 | 82 | 10 | 0.453 | 0.406 |
|
|
106
|
+
| Discoba | gcra9d9y | 20 | 4 | 0.696 | 0.696 |
|
|
107
|
+
| Echinodermata | sx9zjl7p | 52 | 8 | 0.444 | 0.440 |
|
|
108
|
+
| Fungi | fh1kg88z | 200 | 7 | 0.660 | 0.645 |
|
|
109
|
+
| Insecta | 58hsuobw | 200 | 9 | 0.537 | 0.474 |
|
|
110
|
+
| Nematoda | zspca2rb | 73 | 8 | 0.539 | 0.517 |
|
|
111
|
+
| Porifera | 7bjiexcu | 75 | 6 | 0.480 | 0.416 |
|
|
112
|
+
| Rhodophyta | 6kmw3wme | 20 | 5 | 0.405 | 0.301 |
|
|
113
|
+
| Spiralia | v5ej8oyt | 200 | 6 | 0.374 | 0.262 |
|
|
114
|
+
| Stramenopiles | r6p9z9jw | 32 | 6 | 0.426 | 0.413 |
|
|
115
|
+
| Streptophyta | j9m0cdmk | 200 | 13 | 0.602 | 0.579 |
|
|
116
|
+
| Tunicata | hcehc7ff | 34 | 6 | 0.523 | 0.494 |
|
|
117
|
+
| Vertebrata | etb1go6q | 200 | 13 | 0.406 | 0.327 |
|
|
118
|
+
| | | | | | |
|
|
119
|
+
| *none of the above* | cg6grhms | 33 | 7 | 0.436 | 0.416 |
|
|
120
|
+
|
|
121
|
+
Use the last entry for eukaryotes that belong to none of the clades above — it was trained on
|
|
122
|
+
exactly such species. It has no clade name of its own; pass `Other` or its model ID.
|
|
123
|
+
|
|
124
|
+
The two F1 columns are the average locus F1 over the test species of that clade, measured against
|
|
125
|
+
their reference annotations: the first with `--finetune`, the second with the pretrained model
|
|
126
|
+
alone. Finetuning helps in almost every clade, which is why we recommend it.
|
|
127
|
+
|
|
128
|
+
Whichever model you pick, finetuning it on your genome adapts it to your species — see
|
|
129
|
+
[Finetuning](#finetuning-recommended).
|
|
130
|
+
|
|
131
|
+
The species every model was trained on are listed in
|
|
132
|
+
[docs/training_species.tsv](/docs/training_species.tsv), one row per species with its NCBI
|
|
133
|
+
assembly accession. Since Vipsania never learns from annotations, the quality of a species'
|
|
134
|
+
reference annotation, or whether it has one at all, leaves no trace in the model, and unlike for a
|
|
135
|
+
supervised gene finder, finding your species or a close relative in the list is not an argument
|
|
136
|
+
against that model.
|
|
137
|
+
|
|
138
|
+
The test species behind the two F1 columns are in
|
|
139
|
+
[docs/test_species.tsv](/docs/test_species.tsv), with precision, sensitivity and F1 at base,
|
|
140
|
+
exon and locus level for each of them, once with and once without finetuning.
|
|
141
|
+
|
|
142
|
+
### Where models are stored
|
|
143
|
+
|
|
144
|
+
The first time a model ID is used it is downloaded into `~/.cache/vipsania/models` and read from
|
|
145
|
+
there ever after. See [docs/download.md](/docs/download.md) for changing that location, and for
|
|
146
|
+
fetching models in advance on machines that have no internet access when they annotate.
|
|
147
|
+
|
|
148
|
+
### Output formats
|
|
149
|
+
|
|
150
|
+
The output format is chosen by the file suffix of `-o/--output`:
|
|
151
|
+
|
|
152
|
+
| suffix | format |
|
|
153
|
+
| ---------------- | ------------------------------------------- |
|
|
154
|
+
| `.gp` | GenePred |
|
|
155
|
+
| `.gff3` / `.gff` | GFF3 |
|
|
156
|
+
| `.gtf` | GTF |
|
|
157
|
+
|
|
158
|
+
If `-o` is omitted, the annotation is written next to the input FASTA as `vipsania_[model_id].gff`,
|
|
159
|
+
named after the model that produced it even when you asked for it by clade. The protein and coding
|
|
160
|
+
sequences of the predicted genes can be written out at the same time with `--protein proteins.fa`
|
|
161
|
+
and `--coding coding.fa`.
|
|
162
|
+
|
|
163
|
+
### Finetuning (recommended)
|
|
164
|
+
|
|
165
|
+
$ vipsania annotate <model_id> genome.fa -o annotation.gff3 --finetune
|
|
166
|
+
|
|
167
|
+
`--finetune` trains the model on the genome you are about to annotate before predicting anything.
|
|
168
|
+
Since Vipsania is unsupervised, this needs nothing except the FASTA file that you already have. The
|
|
169
|
+
model adapts to the codon usage, repeat landscape and intron statistics of your species, which
|
|
170
|
+
consistently improves the annotation.
|
|
171
|
+
|
|
172
|
+
The finetuned checkpoint is saved next to the output file, so you can reuse it for further
|
|
173
|
+
annotations of the same genome or closely related species without finetuning again. Use the
|
|
174
|
+
`--model_dir` argument in these cases.
|
|
175
|
+
|
|
176
|
+
All options of the annotation are listed in [docs/annotate.md](/docs/annotate.md), or with
|
|
177
|
+
`vipsania annotate --help`.
|
|
178
|
+
|
|
179
|
+
## Training
|
|
180
|
+
|
|
181
|
+
Vipsania models are trained with `vipsania train` on a set of local FASTA files. Ready-to-use
|
|
182
|
+
configurations for the three model sizes are in [configs](/configs); rather than editing one, you
|
|
183
|
+
list the FASTA files you want to train on in [configs/train.json](/configs/train.json) and pass it
|
|
184
|
+
as an override:
|
|
185
|
+
|
|
186
|
+
$ vipsania train configs/base_10M.json -oc configs/train.json
|
|
187
|
+
|
|
188
|
+
Training runs can be logged to [Weights & Biases](https://wandb.ai) with `--online entity/project`.
|
|
189
|
+
Everything a run produces — configuration, checkpoints and metrics — is written to a folder below
|
|
190
|
+
`./checkpoints`, named after the run. That name is exactly the model ID that `vipsania annotate`
|
|
191
|
+
expects.
|
|
192
|
+
|
|
193
|
+
A published model can also be trained further on species of your choice, which extends the
|
|
194
|
+
`--finetune` option of `vipsania annotate` to a set of genomes. See
|
|
195
|
+
[docs/training.md](/docs/training.md) for that, for the configuration format, and for what to
|
|
196
|
+
change when a run does not fit into GPU memory.
|
|
197
|
+
|
|
198
|
+
## Built on
|
|
199
|
+
|
|
200
|
+
Vipsania is built on two libraries developed in our group:
|
|
201
|
+
|
|
202
|
+
- [bricks2marble](https://github.com/gaius-augustus/bricks2marble) — efficient handling of
|
|
203
|
+
nucleotide sequences and genome annotations, plus the pre- and postprocessing around genome
|
|
204
|
+
annotation.
|
|
205
|
+
- [hidten](https://github.com/gaius-augustus/hidten-docs) — hidden Markov models as differentiable,
|
|
206
|
+
highly parallel layers inside deep learning models.
|
vipsania-1.0.0/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Vipsania
|
|
2
|
+
|
|
3
|
+
**Vipsania is an unsupervised deep learning *ab-initio* gene finder.**
|
|
4
|
+
|
|
5
|
+
Unlike other deep learning gene finders, Vipsania is never shown a reference annotation. It is
|
|
6
|
+
trained purely on raw genomic sequences with a masked language modelling objective: nucleotides are
|
|
7
|
+
hidden and the model learns to predict them from their context. Gene structure emerges as the
|
|
8
|
+
representation a hidden Markov model inside the network needs in order to explain the sequence, so
|
|
9
|
+
no curated gene set, no related-species annotation and no protein evidence are required at any
|
|
10
|
+
point.
|
|
11
|
+
|
|
12
|
+
For you, this means:
|
|
13
|
+
|
|
14
|
+
- **Annotate any eukaryotic genome from a FASTA file alone.** No extrinsic evidence, no reference
|
|
15
|
+
annotation, no gene-structure training data of any kind.
|
|
16
|
+
- **Adapt the model to your species on the fly.** Because training needs nothing but sequence, the
|
|
17
|
+
genome you want to annotate is itself valid training data. A short finetuning run on your target
|
|
18
|
+
genome directly before annotating gives the best results — see
|
|
19
|
+
[Finetuning](#finetuning-recommended).
|
|
20
|
+
- **Get standard output.** Annotations are written as GenePred, GFF3 or GTF.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Vipsania requires `python>=3.12`. It is recommended to install into a clean virtual environment
|
|
25
|
+
(e.g. using `conda`, `pyenv` or `uv`).
|
|
26
|
+
|
|
27
|
+
$ python -m pip install vipsania
|
|
28
|
+
|
|
29
|
+
This installs the `vipsania` command, which is everything you need to annotate a genome. For
|
|
30
|
+
training, use the [config files](/configs) provided and follow the instructions [here](#training).
|
|
31
|
+
|
|
32
|
+
Alternatively, you can clone the repository, install Vipsania from source and use the
|
|
33
|
+
[scripts](/scripts) for annotation and training.
|
|
34
|
+
|
|
35
|
+
$ git clone https://github.com/gaius-augustus/vipsania
|
|
36
|
+
$ python -m pip install -e vipsania/
|
|
37
|
+
|
|
38
|
+
Installing Vipsania pulls in [bricks2marble](https://github.com/gaius-augustus/bricks2marble) and
|
|
39
|
+
[hidten](https://github.com/gaius-augustus/hidten), which in turn install TensorFlow with CUDA
|
|
40
|
+
support. A GPU is strongly recommended; annotating a large genome on CPU only is possible, but
|
|
41
|
+
slow.
|
|
42
|
+
|
|
43
|
+
## Annotating a genome
|
|
44
|
+
|
|
45
|
+
Annotation is done with `vipsania annotate`. It needs a trained model and a FASTA file of the
|
|
46
|
+
genome you want to annotate.
|
|
47
|
+
|
|
48
|
+
$ vipsania annotate <model_id> genome.fa -o annotation.gff3 --finetune
|
|
49
|
+
|
|
50
|
+
The same command is available as `python -m vipsania annotate ...`, and from a cloned repository as
|
|
51
|
+
`python scripts/annotate.py ...`.
|
|
52
|
+
|
|
53
|
+
The first argument names the model to use, either by the **clade** it was trained for or by its
|
|
54
|
+
**model ID**, both listed below. The first time a model is used, Vipsania downloads it (about 100
|
|
55
|
+
MB) and keeps it, so every later annotation with it starts immediately.
|
|
56
|
+
|
|
57
|
+
$ vipsania annotate Insecta genome.fa -o annotation.gff3 --finetune
|
|
58
|
+
|
|
59
|
+
A clade name gives you the model we recommend for that clade at the moment. Should a clade get a
|
|
60
|
+
better model later, `vipsania download <clade>` picks it up; annotating on its own keeps using the
|
|
61
|
+
model it already has. A model ID always refers to that one model.
|
|
62
|
+
|
|
63
|
+
A model you trained yourself is given in the same way: its ID is the name of its run folder, which
|
|
64
|
+
Vipsania looks for in the directories around the working directory. Set `--model_dir` to use a
|
|
65
|
+
different directory that holds the model folder directly.
|
|
66
|
+
|
|
67
|
+
Progress is printed to the terminal while the genome is annotated, together with a log file next to
|
|
68
|
+
the output.
|
|
69
|
+
|
|
70
|
+
### Choosing a model
|
|
71
|
+
|
|
72
|
+
Vipsania is trained per clade. Use the model of the clade your species belongs to, choosing the
|
|
73
|
+
most specific one available.
|
|
74
|
+
|
|
75
|
+
| Clade | Model ID | Training species | Test species | Average locus F1 | Average locus F1 (pretrained) |
|
|
76
|
+
| --- | --- | ---: | ---: | ---: | ---: |
|
|
77
|
+
| Alveolata | sd2zcj7u | 30 | 6 | 0.613 | 0.582 |
|
|
78
|
+
| Amoebozoa | ezhpj2qm | 15 | 7 | 0.437 | 0.416 |
|
|
79
|
+
| Arthropoda | ihe1jk30 | 200 | 6 | 0.207 | 0.217 |
|
|
80
|
+
| Chlorophyta | faeijtmk | 26 | 6 | 0.579 | 0.558 |
|
|
81
|
+
| Cnidaria | b5vtieo0 | 82 | 10 | 0.453 | 0.406 |
|
|
82
|
+
| Discoba | gcra9d9y | 20 | 4 | 0.696 | 0.696 |
|
|
83
|
+
| Echinodermata | sx9zjl7p | 52 | 8 | 0.444 | 0.440 |
|
|
84
|
+
| Fungi | fh1kg88z | 200 | 7 | 0.660 | 0.645 |
|
|
85
|
+
| Insecta | 58hsuobw | 200 | 9 | 0.537 | 0.474 |
|
|
86
|
+
| Nematoda | zspca2rb | 73 | 8 | 0.539 | 0.517 |
|
|
87
|
+
| Porifera | 7bjiexcu | 75 | 6 | 0.480 | 0.416 |
|
|
88
|
+
| Rhodophyta | 6kmw3wme | 20 | 5 | 0.405 | 0.301 |
|
|
89
|
+
| Spiralia | v5ej8oyt | 200 | 6 | 0.374 | 0.262 |
|
|
90
|
+
| Stramenopiles | r6p9z9jw | 32 | 6 | 0.426 | 0.413 |
|
|
91
|
+
| Streptophyta | j9m0cdmk | 200 | 13 | 0.602 | 0.579 |
|
|
92
|
+
| Tunicata | hcehc7ff | 34 | 6 | 0.523 | 0.494 |
|
|
93
|
+
| Vertebrata | etb1go6q | 200 | 13 | 0.406 | 0.327 |
|
|
94
|
+
| | | | | | |
|
|
95
|
+
| *none of the above* | cg6grhms | 33 | 7 | 0.436 | 0.416 |
|
|
96
|
+
|
|
97
|
+
Use the last entry for eukaryotes that belong to none of the clades above — it was trained on
|
|
98
|
+
exactly such species. It has no clade name of its own; pass `Other` or its model ID.
|
|
99
|
+
|
|
100
|
+
The two F1 columns are the average locus F1 over the test species of that clade, measured against
|
|
101
|
+
their reference annotations: the first with `--finetune`, the second with the pretrained model
|
|
102
|
+
alone. Finetuning helps in almost every clade, which is why we recommend it.
|
|
103
|
+
|
|
104
|
+
Whichever model you pick, finetuning it on your genome adapts it to your species — see
|
|
105
|
+
[Finetuning](#finetuning-recommended).
|
|
106
|
+
|
|
107
|
+
The species every model was trained on are listed in
|
|
108
|
+
[docs/training_species.tsv](/docs/training_species.tsv), one row per species with its NCBI
|
|
109
|
+
assembly accession. Since Vipsania never learns from annotations, the quality of a species'
|
|
110
|
+
reference annotation, or whether it has one at all, leaves no trace in the model, and unlike for a
|
|
111
|
+
supervised gene finder, finding your species or a close relative in the list is not an argument
|
|
112
|
+
against that model.
|
|
113
|
+
|
|
114
|
+
The test species behind the two F1 columns are in
|
|
115
|
+
[docs/test_species.tsv](/docs/test_species.tsv), with precision, sensitivity and F1 at base,
|
|
116
|
+
exon and locus level for each of them, once with and once without finetuning.
|
|
117
|
+
|
|
118
|
+
### Where models are stored
|
|
119
|
+
|
|
120
|
+
The first time a model ID is used it is downloaded into `~/.cache/vipsania/models` and read from
|
|
121
|
+
there ever after. See [docs/download.md](/docs/download.md) for changing that location, and for
|
|
122
|
+
fetching models in advance on machines that have no internet access when they annotate.
|
|
123
|
+
|
|
124
|
+
### Output formats
|
|
125
|
+
|
|
126
|
+
The output format is chosen by the file suffix of `-o/--output`:
|
|
127
|
+
|
|
128
|
+
| suffix | format |
|
|
129
|
+
| ---------------- | ------------------------------------------- |
|
|
130
|
+
| `.gp` | GenePred |
|
|
131
|
+
| `.gff3` / `.gff` | GFF3 |
|
|
132
|
+
| `.gtf` | GTF |
|
|
133
|
+
|
|
134
|
+
If `-o` is omitted, the annotation is written next to the input FASTA as `vipsania_[model_id].gff`,
|
|
135
|
+
named after the model that produced it even when you asked for it by clade. The protein and coding
|
|
136
|
+
sequences of the predicted genes can be written out at the same time with `--protein proteins.fa`
|
|
137
|
+
and `--coding coding.fa`.
|
|
138
|
+
|
|
139
|
+
### Finetuning (recommended)
|
|
140
|
+
|
|
141
|
+
$ vipsania annotate <model_id> genome.fa -o annotation.gff3 --finetune
|
|
142
|
+
|
|
143
|
+
`--finetune` trains the model on the genome you are about to annotate before predicting anything.
|
|
144
|
+
Since Vipsania is unsupervised, this needs nothing except the FASTA file that you already have. The
|
|
145
|
+
model adapts to the codon usage, repeat landscape and intron statistics of your species, which
|
|
146
|
+
consistently improves the annotation.
|
|
147
|
+
|
|
148
|
+
The finetuned checkpoint is saved next to the output file, so you can reuse it for further
|
|
149
|
+
annotations of the same genome or closely related species without finetuning again. Use the
|
|
150
|
+
`--model_dir` argument in these cases.
|
|
151
|
+
|
|
152
|
+
All options of the annotation are listed in [docs/annotate.md](/docs/annotate.md), or with
|
|
153
|
+
`vipsania annotate --help`.
|
|
154
|
+
|
|
155
|
+
## Training
|
|
156
|
+
|
|
157
|
+
Vipsania models are trained with `vipsania train` on a set of local FASTA files. Ready-to-use
|
|
158
|
+
configurations for the three model sizes are in [configs](/configs); rather than editing one, you
|
|
159
|
+
list the FASTA files you want to train on in [configs/train.json](/configs/train.json) and pass it
|
|
160
|
+
as an override:
|
|
161
|
+
|
|
162
|
+
$ vipsania train configs/base_10M.json -oc configs/train.json
|
|
163
|
+
|
|
164
|
+
Training runs can be logged to [Weights & Biases](https://wandb.ai) with `--online entity/project`.
|
|
165
|
+
Everything a run produces — configuration, checkpoints and metrics — is written to a folder below
|
|
166
|
+
`./checkpoints`, named after the run. That name is exactly the model ID that `vipsania annotate`
|
|
167
|
+
expects.
|
|
168
|
+
|
|
169
|
+
A published model can also be trained further on species of your choice, which extends the
|
|
170
|
+
`--finetune` option of `vipsania annotate` to a set of genomes. See
|
|
171
|
+
[docs/training.md](/docs/training.md) for that, for the configuration format, and for what to
|
|
172
|
+
change when a run does not fit into GPU memory.
|
|
173
|
+
|
|
174
|
+
## Built on
|
|
175
|
+
|
|
176
|
+
Vipsania is built on two libraries developed in our group:
|
|
177
|
+
|
|
178
|
+
- [bricks2marble](https://github.com/gaius-augustus/bricks2marble) — efficient handling of
|
|
179
|
+
nucleotide sequences and genome annotations, plus the pre- and postprocessing around genome
|
|
180
|
+
annotation.
|
|
181
|
+
- [hidten](https://github.com/gaius-augustus/hidten-docs) — hidden Markov models as differentiable,
|
|
182
|
+
highly parallel layers inside deep learning models.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"model": {
|
|
3
|
+
"n_layers": 10,
|
|
4
|
+
"d_hidden": 256,
|
|
5
|
+
"stripes": [["lru"], ["ffn"], ["hmm"]],
|
|
6
|
+
"restrict_stripes": {"2": [4]},
|
|
7
|
+
|
|
8
|
+
"spliced_loss": {
|
|
9
|
+
"source": ["site", "site", "outer", "inner"],
|
|
10
|
+
"weight": [0.05, 0.0, 0.0, 0.0],
|
|
11
|
+
"adaptk": [[0.01, 100], null, null, null],
|
|
12
|
+
"target": ["position", "position", "position", "position"]
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"input_repeat_masked": true,
|
|
16
|
+
|
|
17
|
+
"lru": {
|
|
18
|
+
"embed_norm": "layer",
|
|
19
|
+
"readout": true,
|
|
20
|
+
"readout_norm": "layer",
|
|
21
|
+
"pre_readout_activation": "swish",
|
|
22
|
+
|
|
23
|
+
"d_latent": 256,
|
|
24
|
+
"init_radius": [[0.0, 1.0], [0.0, 1.0], [0.0, 1.0]],
|
|
25
|
+
"init_phase": [[1.047, 2.094], [3.142, 4.189], [5.236, 6.283]],
|
|
26
|
+
"init_mixing_ratio": [0.34, 0.33, 0.33],
|
|
27
|
+
"initial_state_memory": 0.99,
|
|
28
|
+
"max_tree_depth": 18
|
|
29
|
+
},
|
|
30
|
+
"hmm": {
|
|
31
|
+
"embed": 128,
|
|
32
|
+
"embed_norm": "layer",
|
|
33
|
+
"embed_activation": "softmax",
|
|
34
|
+
"readout": true,
|
|
35
|
+
"readout_type": "conv",
|
|
36
|
+
"readout_conv_kernel": 9,
|
|
37
|
+
|
|
38
|
+
"intron_state_chain": 2,
|
|
39
|
+
"intron_chain_starts": true,
|
|
40
|
+
"intron_chain_skips": true,
|
|
41
|
+
"intron_chain_loop": false,
|
|
42
|
+
"intron_chain_transitions": false,
|
|
43
|
+
|
|
44
|
+
"parallel_factor": 125,
|
|
45
|
+
"use_reverse_strand": true,
|
|
46
|
+
"emitter_share_noncoding": true,
|
|
47
|
+
"emitter_share_frames": true,
|
|
48
|
+
"train_emitter": true,
|
|
49
|
+
"initial_exon_len": 1000,
|
|
50
|
+
"initial_intron_len": [100, 10000],
|
|
51
|
+
"initial_ir_len": 10000,
|
|
52
|
+
"transitioner_share_noncoding": false,
|
|
53
|
+
"transitioner_share_frames": true,
|
|
54
|
+
"train_transitions": true,
|
|
55
|
+
"train_start_dist": true
|
|
56
|
+
},
|
|
57
|
+
"ffn": {
|
|
58
|
+
"embed_norm": "layer",
|
|
59
|
+
|
|
60
|
+
"type": "glu",
|
|
61
|
+
"units": 512,
|
|
62
|
+
"activation_hidden": "swish"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
"dataset": {
|
|
67
|
+
"T": 20000,
|
|
68
|
+
"B": 8,
|
|
69
|
+
|
|
70
|
+
"masking": 0.05,
|
|
71
|
+
"token": 1.0,
|
|
72
|
+
"same": 0,
|
|
73
|
+
"false": 0,
|
|
74
|
+
|
|
75
|
+
"repeats_loss_weight": 1e-4,
|
|
76
|
+
"drop_N_threshold": 0.001,
|
|
77
|
+
"drop_repeats_threshold": 0,
|
|
78
|
+
|
|
79
|
+
"train_paths": []
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
"trainer": {
|
|
83
|
+
"epochs": 1000,
|
|
84
|
+
"train_steps": 800,
|
|
85
|
+
|
|
86
|
+
"start_lr": 1e-7,
|
|
87
|
+
"warmup_final_lr": 1e-3,
|
|
88
|
+
"lr": 5e-4,
|
|
89
|
+
"warmup_steps": 10,
|
|
90
|
+
"decay_steps": 90,
|
|
91
|
+
|
|
92
|
+
"no_weight_decay": [
|
|
93
|
+
"bias", "beta", "gamma", "annotation", "nu_log", "theta_log", "B_re", "B_im"
|
|
94
|
+
],
|
|
95
|
+
"gradient_clip_norm": 1.0,
|
|
96
|
+
"gradient_accumulation_steps": 8,
|
|
97
|
+
|
|
98
|
+
"hyperparameter_schedule": [{
|
|
99
|
+
"parameter": "spliced_loss_adapter.loss_weights",
|
|
100
|
+
"list_index": 0,
|
|
101
|
+
"start": 0.0,
|
|
102
|
+
"idle": 100,
|
|
103
|
+
"target": 0.05,
|
|
104
|
+
"warmup": 5
|
|
105
|
+
}]
|
|
106
|
+
}
|
|
107
|
+
}
|