sanntis 1.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.
Files changed (126) hide show
  1. sanntis-1.1.0/.gitignore +13 -0
  2. sanntis-1.1.0/CITATION.cff +33 -0
  3. sanntis-1.1.0/LICENSE +202 -0
  4. sanntis-1.1.0/PKG-INFO +354 -0
  5. sanntis-1.1.0/README.md +310 -0
  6. sanntis-1.1.0/docs/assets/sanntis_logo.svg +24 -0
  7. sanntis-1.1.0/docs/bundle.md +33 -0
  8. sanntis-1.1.0/docs/index.md +16 -0
  9. sanntis-1.1.0/docs/infrastructure.md +38 -0
  10. sanntis-1.1.0/docs/install.md +71 -0
  11. sanntis-1.1.0/docs/model-card.md +36 -0
  12. sanntis-1.1.0/docs/negatives.md +62 -0
  13. sanntis-1.1.0/docs/predict.md +165 -0
  14. sanntis-1.1.0/docs/setup.md +20 -0
  15. sanntis-1.1.0/docs/train.md +160 -0
  16. sanntis-1.1.0/pyproject.toml +79 -0
  17. sanntis-1.1.0/src/sanntis/__init__.py +32 -0
  18. sanntis-1.1.0/src/sanntis/__main__.py +18 -0
  19. sanntis-1.1.0/src/sanntis/_version.py +16 -0
  20. sanntis-1.1.0/src/sanntis/annotate/__init__.py +1 -0
  21. sanntis-1.1.0/src/sanntis/annotate/cache.py +113 -0
  22. sanntis-1.1.0/src/sanntis/annotate/genecall.py +59 -0
  23. sanntis-1.1.0/src/sanntis/annotate/ips6.py +264 -0
  24. sanntis-1.1.0/src/sanntis/cli.py +179 -0
  25. sanntis-1.1.0/src/sanntis/config.py +260 -0
  26. sanntis-1.1.0/src/sanntis/data/__init__.py +21 -0
  27. sanntis-1.1.0/src/sanntis/data/example/ERZ29794225_slice.faa +113 -0
  28. sanntis-1.1.0/src/sanntis/data/example/ERZ29794225_slice.gff +25 -0
  29. sanntis-1.1.0/src/sanntis/data/example/ERZ29794225_slice.ips.tsv +134 -0
  30. sanntis-1.1.0/src/sanntis/data/npc/np_term_edges.tsv +787 -0
  31. sanntis-1.1.0/src/sanntis/data/npc/np_terms.tsv +772 -0
  32. sanntis-1.1.0/src/sanntis/data/setup.faa +8 -0
  33. sanntis-1.1.0/src/sanntis/features/__init__.py +1 -0
  34. sanntis-1.1.0/src/sanntis/features/tokens.py +84 -0
  35. sanntis-1.1.0/src/sanntis/features/vocab.py +108 -0
  36. sanntis-1.1.0/src/sanntis/frontend.py +289 -0
  37. sanntis-1.1.0/src/sanntis/io/__init__.py +1 -0
  38. sanntis-1.1.0/src/sanntis/io/antismash.py +55 -0
  39. sanntis-1.1.0/src/sanntis/io/fasta.py +157 -0
  40. sanntis-1.1.0/src/sanntis/io/genbank.py +176 -0
  41. sanntis-1.1.0/src/sanntis/io/gff.py +72 -0
  42. sanntis-1.1.0/src/sanntis/io/gff_cds.py +98 -0
  43. sanntis-1.1.0/src/sanntis/io/ips_tsv.py +285 -0
  44. sanntis-1.1.0/src/sanntis/io/tables.py +30 -0
  45. sanntis-1.1.0/src/sanntis/model/__init__.py +1 -0
  46. sanntis-1.1.0/src/sanntis/model/_skops.py +44 -0
  47. sanntis-1.1.0/src/sanntis/model/bundle.py +389 -0
  48. sanntis-1.1.0/src/sanntis/model/decode.py +74 -0
  49. sanntis-1.1.0/src/sanntis/model/detector.py +92 -0
  50. sanntis-1.1.0/src/sanntis/model/key_domains.py +83 -0
  51. sanntis-1.1.0/src/sanntis/model/npc.py +255 -0
  52. sanntis-1.1.0/src/sanntis/model/postfilter.py +78 -0
  53. sanntis-1.1.0/src/sanntis/negpool/__init__.py +1 -0
  54. sanntis-1.1.0/src/sanntis/negpool/build.py +342 -0
  55. sanntis-1.1.0/src/sanntis/negpool/download.py +68 -0
  56. sanntis-1.1.0/src/sanntis/negpool/pool.py +184 -0
  57. sanntis-1.1.0/src/sanntis/negpool/sample.py +148 -0
  58. sanntis-1.1.0/src/sanntis/negpool/strip.py +77 -0
  59. sanntis-1.1.0/src/sanntis/nf/tasks.config +66 -0
  60. sanntis-1.1.0/src/sanntis/nf/tasks.nf +117 -0
  61. sanntis-1.1.0/src/sanntis/predict.py +111 -0
  62. sanntis-1.1.0/src/sanntis/qc.py +69 -0
  63. sanntis-1.1.0/src/sanntis/recipe.yaml +122 -0
  64. sanntis-1.1.0/src/sanntis/runner/__init__.py +1 -0
  65. sanntis-1.1.0/src/sanntis/runner/inline.py +81 -0
  66. sanntis-1.1.0/src/sanntis/runner/nextflow.py +130 -0
  67. sanntis-1.1.0/src/sanntis/runner/tasks.py +224 -0
  68. sanntis-1.1.0/src/sanntis/train/__init__.py +1 -0
  69. sanntis-1.1.0/src/sanntis/train/collect.py +259 -0
  70. sanntis-1.1.0/src/sanntis/train/compose.py +57 -0
  71. sanntis-1.1.0/src/sanntis/train/cv.py +142 -0
  72. sanntis-1.1.0/src/sanntis/train/dedup.py +76 -0
  73. sanntis-1.1.0/src/sanntis/train/entities.py +190 -0
  74. sanntis-1.1.0/src/sanntis/train/finalize.py +130 -0
  75. sanntis-1.1.0/src/sanntis/train/key_domains.py +266 -0
  76. sanntis-1.1.0/src/sanntis/train/labels.py +285 -0
  77. sanntis-1.1.0/src/sanntis/train/losses.py +39 -0
  78. sanntis-1.1.0/src/sanntis/train/metrics.py +205 -0
  79. sanntis-1.1.0/src/sanntis/train/mibig.py +173 -0
  80. sanntis-1.1.0/src/sanntis/train/ncbi.py +110 -0
  81. sanntis-1.1.0/src/sanntis/train/npc_train.py +226 -0
  82. sanntis-1.1.0/src/sanntis/train/orchestrate.py +173 -0
  83. sanntis-1.1.0/src/sanntis/train/report.py +495 -0
  84. sanntis-1.1.0/src/sanntis/train/splits.py +39 -0
  85. sanntis-1.1.0/src/sanntis/train/steps.py +360 -0
  86. sanntis-1.1.0/src/sanntis/train/trainer.py +173 -0
  87. sanntis-1.1.0/src/sanntis/train/tune.py +222 -0
  88. sanntis-1.1.0/src/sanntis/utils.py +109 -0
  89. sanntis-1.1.0/tests/__init__.py +0 -0
  90. sanntis-1.1.0/tests/conftest.py +89 -0
  91. sanntis-1.1.0/tests/fake_nextflow.py +76 -0
  92. sanntis-1.1.0/tests/fixtures/BGC0002866.fna +214 -0
  93. sanntis-1.1.0/tests/fixtures/BGC0003066.gbk +867 -0
  94. sanntis-1.1.0/tests/fixtures/ips576.tsv +199 -0
  95. sanntis-1.1.0/tests/fixtures/ips6.tsv +199 -0
  96. sanntis-1.1.0/tests/fixtures/ips6_databases.json +1 -0
  97. sanntis-1.1.0/tests/fixtures/mibig/BGC0002020.gbk +281 -0
  98. sanntis-1.1.0/tests/fixtures/mibig/BGC0002020.json +1 -0
  99. sanntis-1.1.0/tests/fixtures/mibig/BGC0002195.gbk +224 -0
  100. sanntis-1.1.0/tests/fixtures/mibig/BGC0002195.json +1 -0
  101. sanntis-1.1.0/tests/fixtures/mibig/BGC0002899.gbk +246 -0
  102. sanntis-1.1.0/tests/fixtures/mibig/BGC0002899.json +1 -0
  103. sanntis-1.1.0/tests/fixtures/negpool/tiny_genome.fna.gz +0 -0
  104. sanntis-1.1.0/tests/test_annotate.py +85 -0
  105. sanntis-1.1.0/tests/test_antismash.py +54 -0
  106. sanntis-1.1.0/tests/test_bundle.py +184 -0
  107. sanntis-1.1.0/tests/test_cli.py +38 -0
  108. sanntis-1.1.0/tests/test_collect.py +420 -0
  109. sanntis-1.1.0/tests/test_decode_tokens.py +55 -0
  110. sanntis-1.1.0/tests/test_dedup_splits.py +47 -0
  111. sanntis-1.1.0/tests/test_entities.py +56 -0
  112. sanntis-1.1.0/tests/test_inputs.py +157 -0
  113. sanntis-1.1.0/tests/test_ips6_chunks.py +62 -0
  114. sanntis-1.1.0/tests/test_ips_tsv.py +122 -0
  115. sanntis-1.1.0/tests/test_key_domains.py +154 -0
  116. sanntis-1.1.0/tests/test_metrics.py +83 -0
  117. sanntis-1.1.0/tests/test_negpool.py +200 -0
  118. sanntis-1.1.0/tests/test_predict_e2e.py +300 -0
  119. sanntis-1.1.0/tests/test_runner_nextflow.py +44 -0
  120. sanntis-1.1.0/tests/test_runner_tasks.py +96 -0
  121. sanntis-1.1.0/tests/test_sampling.py +67 -0
  122. sanntis-1.1.0/tests/test_train_e2e.py +75 -0
  123. sanntis-1.1.0/tests/test_train_pipeline.py +107 -0
  124. sanntis-1.1.0/tests/test_utils.py +25 -0
  125. sanntis-1.1.0/tests/train_fixture.py +140 -0
  126. sanntis-1.1.0/tests/unit_fns.py +24 -0
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .coverage
7
+ dist/
8
+ build/
9
+ work/
10
+ .nextflow*
11
+ site/
12
+ *.log
13
+ .claude/
@@ -0,0 +1,33 @@
1
+ cff-version: 1.2.0
2
+ message: If you use SanntiS, please cite the publication below.
3
+ title: SanntiS
4
+ abstract: SMBGC Annotation using Neural Networks Trained on Interpro Signatures
5
+ type: software
6
+ license: Apache-2.0
7
+ repository-code: https://github.com/Finn-Lab/SanntiS
8
+ authors:
9
+ - family-names: Sanchez
10
+ given-names: Santiago
11
+ preferred-citation:
12
+ type: article
13
+ title: Expansion of novel biosynthetic gene clusters from diverse environments using SanntiS
14
+ authors:
15
+ - family-names: Sanchez
16
+ given-names: Santiago
17
+ - family-names: Rogers
18
+ given-names: Joel D.
19
+ - family-names: Rogers
20
+ given-names: Alexander B.
21
+ - family-names: Nassar
22
+ given-names: Maaly
23
+ - family-names: McEntyre
24
+ given-names: Johanna
25
+ - family-names: Welch
26
+ given-names: Martin
27
+ - family-names: Hollfelder
28
+ given-names: Florian
29
+ - family-names: Finn
30
+ given-names: Robert D.
31
+ journal: bioRxiv
32
+ year: 2023
33
+ doi: 10.1101/2023.05.23.540769
sanntis-1.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2021-2026 EMBL-EBI
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
sanntis-1.1.0/PKG-INFO ADDED
@@ -0,0 +1,354 @@
1
+ Metadata-Version: 2.5
2
+ Name: sanntis
3
+ Version: 1.1.0
4
+ Summary: SMBGC Annotation using Neural Networks Trained on Interpro Signatures
5
+ Project-URL: Homepage, https://github.com/Finn-Lab/SanntiS
6
+ Project-URL: Documentation, https://github.com/Finn-Lab/SanntiS/tree/master/docs
7
+ Project-URL: Repository, https://github.com/Finn-Lab/SanntiS
8
+ Project-URL: Issues, https://github.com/Finn-Lab/SanntiS/issues
9
+ Project-URL: Model, https://huggingface.co/microbiome-informatics/sanntis
10
+ Author-email: Santiago Sanchez Fragoso <fragoso@ebi.ac.uk>, MGnify team <metagenomics-help@ebi.ac.uk>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: biopython>=1.84
20
+ Requires-Dist: click<9,>=8.1
21
+ Requires-Dist: huggingface-hub>=0.30
22
+ Requires-Dist: numpy<3,>=2.0
23
+ Requires-Dist: pandas<3,>=2.2
24
+ Requires-Dist: pyarrow>=17
25
+ Requires-Dist: pydantic<3,>=2.7
26
+ Requires-Dist: pyrodigal<4,>=3.5
27
+ Requires-Dist: pyyaml>=6
28
+ Requires-Dist: safetensors>=0.4
29
+ Requires-Dist: scikit-learn<1.10,>=1.9
30
+ Requires-Dist: scipy>=1.13
31
+ Requires-Dist: skops>=0.11
32
+ Requires-Dist: torch>=2.4
33
+ Provides-Extra: dev
34
+ Requires-Dist: pre-commit; extra == 'dev'
35
+ Requires-Dist: pytest-cov; extra == 'dev'
36
+ Requires-Dist: pytest>=8; extra == 'dev'
37
+ Requires-Dist: ruff>=0.6; extra == 'dev'
38
+ Provides-Extra: docs
39
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
40
+ Provides-Extra: train
41
+ Requires-Dist: matplotlib>=3.8; extra == 'train'
42
+ Requires-Dist: rdkit>=2024.3; extra == 'train'
43
+ Description-Content-Type: text/markdown
44
+
45
+ <p align="center">
46
+ <img src="docs/assets/sanntis_logo.svg" alt="SanntiS logo" width="320">
47
+ </p>
48
+
49
+ [![CI](https://github.com/Finn-Lab/SanntiS/actions/workflows/ci.yml/badge.svg)](https://github.com/Finn-Lab/SanntiS/actions/workflows/ci.yml)
50
+ [![Bioconda](https://img.shields.io/conda/vn/bioconda/sanntis.svg)](https://anaconda.org/bioconda/sanntis)
51
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
52
+ [![DOI](https://img.shields.io/badge/DOI-10.1101%2F2023.05.23.540769-blue.svg)](https://doi.org/10.1101/2023.05.23.540769)
53
+
54
+ # SanntiS
55
+
56
+ > SMBGC Annotation using Neural Networks Trained on Interpro Signatures
57
+
58
+ Tool for identifying biosynthetic gene clusters (BGCs) in genomic & metagenomic data.
59
+
60
+ SanntiS takes the InterProScan domain annotations of the proteins of a sequence and reports BGC regions. Each
61
+ region carries a biosynthetic class (NRPS, PKS, ribosomal, terpene, saccharide, other) and the NPClassifier
62
+ pathway and superclass predicted for its product. Results are written as GFF3, as antiSMASH sideloader JSON and as
63
+ per-ORF and per-region tables.
64
+
65
+ ## How to use SanntiS?
66
+
67
+ SanntiS runs in one of two modes:
68
+
69
+ 1. [With precomputed InterProScan annotations](#1-with-your-own-interproscan-annotations). The input is an
70
+ InterProScan TSV together with the sequence or gene calls. Only the Python package is required.
71
+ 2. [Running InterProScan through SanntiS](#2-letting-sanntis-run-interproscan). SanntiS runs InterProScan 6 with
72
+ Nextflow and a container engine.
73
+
74
+ ### Installation
75
+
76
+ #### Conda
77
+
78
+ > [!WARNING]
79
+ > The Bioconda package is currently out of date and installs **v0.9.x**, which predates the latest major release.
80
+ > To get the current version, see **pip** below. This section will be updated once the new release is available on Bioconda.
81
+ ```bash
82
+ # conda create -n sanntis -c conda-forge -c bioconda sanntis
83
+ # conda activate sanntis
84
+ ```
85
+
86
+ The conda package includes Nextflow and Java, which the second mode requires.
87
+
88
+ #### pip
89
+
90
+ ```bash
91
+ pip install "git+https://github.com/Finn-Lab/SanntiS@v1.1.0" # Python >= 3.11
92
+ ```
93
+
94
+ Or the release image, with the model bundle baked in (precomputed-InterProScan mode only):
95
+
96
+ ```bash
97
+ docker run --rm -v "$PWD:/data" quay.io/microbiome-informatics/sanntis:1.1.0 predict /data/genome.gbk --ips-tsv /data/genome.ips.tsv -o /data/out
98
+ ```
99
+
100
+ On a machine without a GPU, install the CPU build of PyTorch first:
101
+
102
+ ```bash
103
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
104
+ ```
105
+
106
+ The model is downloaded from [Hugging Face Hub](https://huggingface.co/microbiome-informatics/sanntis) the first
107
+ time `sanntis predict` runs. It is about 85 MB and is cached in `$HF_HOME`.
108
+
109
+ #### Installation test
110
+
111
+ `sanntis example` copies an example input to a directory: a protein FASTA, its GFF3 and its InterProScan TSV.
112
+
113
+ ```bash
114
+ sanntis example -o sanntis_example/
115
+ sanntis predict sanntis_example/ERZ29794225_slice.faa --gff sanntis_example/ERZ29794225_slice.gff \
116
+ --ips-tsv sanntis_example/ERZ29794225_slice.ips.tsv -o sanntis_example/out/
117
+ ```
118
+
119
+ The run downloads the model on first use and writes `sanntis_example/out/ERZ29794225_slice.sanntis.gff3`.
120
+
121
+ ### 1. With your own InterProScan annotations
122
+
123
+ Pass the InterProScan TSV with `--ips-tsv` together with the sequence the proteins come from. Nextflow and a
124
+ container engine are not used in this mode.
125
+
126
+ **GenBank with CDS translations**, prokaryotic or eukaryotic:
127
+
128
+ ```bash
129
+ sanntis predict assembly.gbk --ips-tsv assembly.ips.tsv --ips-release 107.0 -o out/
130
+ ```
131
+
132
+ **Protein FASTA with the GFF3 of its CDS**, such as the output of a gene caller or an annotation pipeline:
133
+
134
+ ```bash
135
+ sanntis predict proteins.faa --gff genes.gff --ips-tsv proteins.ips.tsv --ips-release 107.0 -o out/
136
+ ```
137
+
138
+ The `ID` of each `CDS` row in the GFF3 must equal the protein id, which is the first word of the FASTA header.
139
+ Rows and proteins may come in any order. Genes are ordered by their coordinates.
140
+
141
+ Requirements on the TSV:
142
+
143
+ - InterProScan **5.76 or later, or 6.x**. The version is detected from the file. The TSV must come from a run with
144
+ the 14 member databases used by the model: Pfam, NCBIfam, SFLD, SUPERFAMILY, CATH-Gene3D, HAMAP, Coils, CDD,
145
+ PRINTS, PIRSF, PROSITE profiles, PROSITE patterns, MobiDB-lite and SMART. Hits of other analyses, such as
146
+ PANTHER, are ignored.
147
+ - The model was trained on **InterPro 107.0** annotations. `--ips-release` declares the release of the TSV. Hits
148
+ from other releases are mapped to the InterPro 107.0 entries, and signatures that 107.0 does not have are dropped
149
+ and counted in `run.json`. A warning is logged when more than 5 % of the hits are dropped. Signatures whose
150
+ models changed between releases can still shift predictions.
151
+ - Hits are joined to the CDS by protein id, or by the md5 of the sequence when the ids differ. A TSV computed from
152
+ the same proteins under other ids is therefore accepted.
153
+
154
+ Any input may be gzip-compressed.
155
+
156
+ ### 2. Letting SanntiS run InterProScan
157
+
158
+ This mode requires **Nextflow >= 26.x** with Java 17 and a container engine: Docker, Singularity, Apptainer or
159
+ Podman. SanntiS runs InterProScan 6.0.3.0 with InterPro 107.0 data, the versions the model was trained on. Linux
160
+ is the tested platform. The containers are Linux images, so other systems need an engine that runs them, such as
161
+ Docker Desktop.
162
+
163
+ #### Get the InterProScan data
164
+
165
+ ```bash
166
+ sanntis setup --container-engine docker
167
+ ```
168
+
169
+ `setup` downloads the InterProScan 6 pipeline and the InterPro 107.0 data of the 14 member databases into
170
+ `$SANNTIS_CACHE/ips6`, by default `~/.cache/sanntis/ips6`. The data take tens of GB and are downloaded once.
171
+ `sanntis predict` runs the same setup when the data are missing, so this step is optional.
172
+
173
+ #### Run
174
+
175
+ ```bash
176
+ sanntis predict genome.fna --container-engine docker -o out/ # prokaryotic nucleotide FASTA
177
+ sanntis predict assembly.gbk --container-engine docker -o out/ # GenBank with CDS translations
178
+ sanntis predict proteins.faa --gff genes.gff --container-engine docker -o out/
179
+ sanntis predict a.fna b.fna c.gbk --container-engine docker -o out/ # batch: one InterProScan run for all
180
+ ```
181
+
182
+ | Input | Genes |
183
+ |---|---|
184
+ | `.fna` `.fa` `.fasta` | called with pyrodigal, `meta` mode by default and `--genecall single` for isolates; prokaryotes only |
185
+ | `.gbk` `.gb` `.gbff` | the CDS of the file, which need a `/translation`; any kingdom, with `--kingdom euk` for eukaryotes |
186
+ | `.faa` + `--gff` | the `CDS` rows of the GFF3; any kingdom |
187
+
188
+ Proteins are deduplicated and looked up in the annotation cache in `$SANNTIS_CACHE/annotations` before
189
+ InterProScan runs. Proteins seen in an earlier run are not annotated again.
190
+
191
+ On a cluster, pass a Nextflow configuration with `--nf-config` or `--nf-profile` and run `sanntis` itself as a
192
+ small batch job. See [Running on other infrastructure](docs/infrastructure.md).
193
+
194
+ ### Options
195
+
196
+ ```
197
+ sanntis predict INPUT... [-o OUTDIR] [--model HUB_ID@REV | DIR] [options]
198
+ ```
199
+
200
+ | Option | Default | Description |
201
+ |---|---|---|
202
+ | `--ips-tsv FILE`, `--ips-release REL` | | precomputed InterProScan TSV and its InterPro release |
203
+ | `--gff FILE` | | GFF3 with the CDS of a `.faa` input |
204
+ | `--kingdom proka\|euk` | `proka` | kingdom of the input, used by the NPClassifier head |
205
+ | `--genecall meta\|single` | `meta` | pyrodigal mode for `.fna` inputs |
206
+ | `--npc-precision 0.9\|0.8` | `0.9` | NPClassifier abstention tier |
207
+ | `--model` | the Hub release matching the installed version | Hub id `repo@revision` or a local bundle directory |
208
+ | `--threads N` | 1 | CPU threads |
209
+ | `--write-faa` | off | also write the CDS proteins and their GFF3 |
210
+ | `--container-engine`, `--nf-config`, `--nf-profile`, `--nf-args` | | Nextflow options of mode 2 |
211
+
212
+ `sanntis predict --help` lists every option, and `sanntis -v predict ...` logs progress. The options are described
213
+ in [docs/predict.md](docs/predict.md).
214
+
215
+ ## Output
216
+
217
+ Output files are named after the input file. `<prefix>` is the file name without extensions.
218
+
219
+ | File | Content |
220
+ |---|---|
221
+ | `<prefix>.sanntis.gff3` | one `CLUSTER` feature per BGC |
222
+ | `<prefix>.sanntis.antismash.json` | the same regions as antiSMASH sideloader JSON |
223
+ | `<prefix>.regions.tsv` | one row per region with every attribute |
224
+ | `<prefix>.orf_scores.tsv` | the detector score of every CDS |
225
+ | `<prefix>.run.json` | run metadata: input, model, InterProScan version, annotation QC flags, timings |
226
+
227
+ ### GFF3
228
+
229
+ ```
230
+ seqname: record id of the contig, as in the input
231
+ source: SanntiS
232
+ feature: CLUSTER
233
+ start, end: 1-based, inclusive (first and last CDS of the region)
234
+ score: mean detector score of the CDS of the region
235
+ strand, frame: empty
236
+ attributes:
237
+ ID <record>_sanntis_<n>, n starting at 1 per record
238
+ bgc_class biosynthetic class: NRPS, PKS, ribosomal, terpene, saccharide or other
239
+ nearest_MiBIG_class same value as bgc_class
240
+ p_non_bgc post-filter probability that the region is not a BGC
241
+ n_orfs number of CDS in the region
242
+ npc_pathway, npc_pathway_score, npc_pathway_confident
243
+ NPClassifier pathway(s) of the product, score and whether it passes the
244
+ --npc-precision tier
245
+ npc_superclass, npc_superclass_top, npc_superclass_score
246
+ NPClassifier superclass(es)
247
+ npc_pathway_key_domains_support, npc_pathway_key_domains_unsupported
248
+ whether the region carries a key domain of each called pathway
249
+ ```
250
+
251
+ Example line, with illustrative values:
252
+
253
+ ```
254
+ ##gff-version 3
255
+ ##sanntis-version 1.1.0
256
+ BGC0002981 SanntiS CLUSTER 118 27635 0.8118 . . ID=BGC0002981_sanntis_1;nearest_MiBIG_class=ribosomal;bgc_class=ribosomal;p_non_bgc=0.0312;n_orfs=22;npc_pathway=Amino acids and Peptides;npc_pathway_score=0.9134;npc_pathway_confident=true;npc_superclass=Oligopeptides;npc_superclass_top=Oligopeptides;npc_superclass_score=0.8710;npc_pathway_key_domains_support=Amino acids and Peptides:IPR003776;npc_pathway_key_domains_unsupported=false
257
+ ```
258
+
259
+ The `##` header lines record the model, the InterProScan version and the annotation coverage QC of the run.
260
+ `qc-flags` lists warnings such as few CDS with domains or a missing member database. The attributes and the QC
261
+ flags are documented in [docs/predict.md](docs/predict.md).
262
+
263
+ ### antiSMASH compatibility
264
+
265
+ Every run writes `<prefix>.sanntis.antismash.json` in the format of the
266
+ [antiSMASH sideloading specification](https://docs.antismash.secondarymetabolites.org/sideloading/). The file can
267
+ be uploaded to the [antiSMASH web server](https://antismash.secondarymetabolites.org) under 'Data input' >
268
+ 'Upload extra annotations', or passed to the command line together with the nucleotide records SanntiS was run on:
269
+
270
+ ```bash
271
+ antismash --sideload genome.sanntis.antismash.json genome.gbk
272
+ ```
273
+
274
+ SanntiS regions appear as subregions next to the antiSMASH detections.
275
+
276
+ ## Models
277
+
278
+ The default model is the Hugging Face Hub release whose tag matches the installed SanntiS version, currently
279
+ `microbiome-informatics/sanntis@v1.1.0`. `--model` selects another Hub revision or a local model directory,
280
+ for example one produced by `sanntis train`.
281
+
282
+ ```bash
283
+ sanntis predict genome.fna --model microbiome-informatics/sanntis@v1.1.0 # explicit Hub revision
284
+ sanntis predict genome.fna --model runs/my_run/bundle # a retrained local model
285
+ HF_HUB_OFFLINE=1 sanntis predict ... # offline, once cached
286
+ ```
287
+
288
+ The model directory layout is described in [Model bundle format](docs/bundle.md). SanntiS can retrain a model
289
+ from a MIBiG release or from other BGC collections; see [Training a model](docs/train.md) and
290
+ [Negative genome pool](docs/negatives.md).
291
+
292
+ ### Training data
293
+
294
+ The released model was trained on the data published as the Hub dataset
295
+ [`microbiome-informatics/sanntis-training-data`](https://huggingface.co/datasets/microbiome-informatics/sanntis-training-data):
296
+
297
+ | Path (tag) | Content |
298
+ |---|---|
299
+ | `mibig/5.0rc1-train/` (`mibig-5.0rc1-train`) | **Positives**: the 2,797 `active` and `pending` entries of MIBiG 5.0rc1 as a MIBiG-format archive pair. The JSON entries are the 5.0rc1 files; the GenBank record of each BGC comes from the MIBiG 4.0 archive when its locus is unchanged (2,621) and otherwise from the NCBI nuccore record of the first 5.0rc1 locus (174). `manifest.tsv` describes every record, `excluded.tsv` the 2 entries without a usable record and `provenance.json` the sha256 of the source archives. Training drops the 18 loci longer than 200 kb, leaving 2,777 BGCs |
300
+ | `negatives/v1/` (`negatives-v1`) | **Negative genome pool**: 205 GTDB r226 bacterial and archaeal species representatives balanced over phyla and 23 RefSeq fungal and protist genomes, with the regions detected by antiSMASH 8.0.1 removed. 55 prokaryotic and 15 eukaryotic BGC-free runs are held out as test backbones |
301
+ | `npclassifier/v1/` (`npclassifier-v1`) | **NPClassifier answers** for the compound structures of the positives, from which the NPC labels are derived |
302
+
303
+ Positives and negatives are annotated with InterProScan 6.0.3.0 and InterPro 107.0, the 14 member databases listed
304
+ above. With the archive pair downloaded from the dataset, the model is reproduced by:
305
+
306
+ ```bash
307
+ sanntis train --run runs/release --mibig none \
308
+ --external-gbk mibig_5.0rc1-train_gbk.tar.gz --external-json mibig_5.0rc1-train_json.tar.gz \
309
+ --negatives v1 --npc-cache v1 --container-engine docker
310
+ ```
311
+
312
+ `--negatives v1` and `--npc-cache v1` fetch the pool and the NPClassifier answers from the dataset, so no API
313
+ request is made. The bundle's `manifest.json` and model card record the sha256 of these inputs. The runbook that
314
+ builds the archives and the validation report of the run are in the [`sanntisv1-data-and-analysis`](https://github.com/Finn-Lab/sanntisv1-data-and-analysis) repository.
315
+
316
+ ## Documentation
317
+
318
+ - [Install](docs/install.md), caches and environment variables
319
+ - [InterProScan setup](docs/setup.md)
320
+ - [Predict](docs/predict.md): inputs, options, outputs, QC
321
+ - [Running on other infrastructure](docs/infrastructure.md): SLURM and other executors
322
+ - [Model bundle format](docs/bundle.md), [Training](docs/train.md), [Negative genome pool](docs/negatives.md)
323
+
324
+ The pages build into a site with `pip install "sanntis[docs]"` and `mkdocs serve`.
325
+
326
+ ## Development
327
+
328
+ ```bash
329
+ git clone https://github.com/Finn-Lab/SanntiS.git && cd SanntiS
330
+ pip install -e ".[dev,train]"
331
+ ruff check src tests && pytest -q -m "not nextflow"
332
+ ```
333
+
334
+ Tests marked `nextflow` need Nextflow on `PATH`.
335
+
336
+ ## Acknowledgements
337
+
338
+ This work is part of EUREMAP (European Research Infrastructure for Marine Bioprospecting, https://euremap.eu),
339
+ funded by the European Union's Horizon Europe research and innovation programme under grant agreement No 101131663
340
+ ([doi:10.3030/101131663](https://doi.org/10.3030/101131663)). Views and opinions expressed are however those of the
341
+ author(s) only and do not necessarily reflect those of the European Union. Neither the European Union nor the granting
342
+ authority can be held responsible for them.
343
+
344
+ ## Citations
345
+
346
+ If you use SanntiS, please cite:
347
+
348
+ [Expansion of novel biosynthetic gene clusters from diverse environments using SanntiS](https://www.biorxiv.org/content/10.1101/2023.05.23.540769v1)
349
+
350
+ ```
351
+ Expansion of novel biosynthetic gene clusters from diverse environments using SanntiS
352
+ Santiago Sanchez, Joel D. Rogers, Alexander B. Rogers, Maaly Nassar, Johanna McEntyre, Martin Welch, Florian Hollfelder, Robert D. Finn
353
+ bioRxiv 2023.05.23.540769; doi: https://doi.org/10.1101/2023.05.23.540769
354
+ ```