bioemu 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. bioemu-0.1.0/LICENSE +21 -0
  2. bioemu-0.1.0/MANIFEST.in +2 -0
  3. bioemu-0.1.0/NOTICE.md +214 -0
  4. bioemu-0.1.0/PKG-INFO +26 -0
  5. bioemu-0.1.0/README.md +115 -0
  6. bioemu-0.1.0/pyproject.toml +169 -0
  7. bioemu-0.1.0/setup.cfg +4 -0
  8. bioemu-0.1.0/src/bioemu/__init__.py +0 -0
  9. bioemu-0.1.0/src/bioemu/chemgraph.py +28 -0
  10. bioemu-0.1.0/src/bioemu/colabfold_setup/__init__.py +0 -0
  11. bioemu-0.1.0/src/bioemu/colabfold_setup/batch.patch +6 -0
  12. bioemu-0.1.0/src/bioemu/colabfold_setup/modules.patch +14 -0
  13. bioemu-0.1.0/src/bioemu/colabfold_setup/setup.sh +23 -0
  14. bioemu-0.1.0/src/bioemu/config/denoiser/dpm.yaml +5 -0
  15. bioemu-0.1.0/src/bioemu/config/denoiser/heun.yaml +6 -0
  16. bioemu-0.1.0/src/bioemu/convert_chemgraph.py +370 -0
  17. bioemu-0.1.0/src/bioemu/denoiser.py +394 -0
  18. bioemu-0.1.0/src/bioemu/get_embeds.py +156 -0
  19. bioemu-0.1.0/src/bioemu/md_utils.py +139 -0
  20. bioemu-0.1.0/src/bioemu/models.py +384 -0
  21. bioemu-0.1.0/src/bioemu/openfold/np/protein.py +584 -0
  22. bioemu-0.1.0/src/bioemu/openfold/np/residue_constants.py +1261 -0
  23. bioemu-0.1.0/src/bioemu/openfold/utils/rigid_utils.py +1368 -0
  24. bioemu-0.1.0/src/bioemu/run_hpacker.py +32 -0
  25. bioemu-0.1.0/src/bioemu/sample.py +252 -0
  26. bioemu-0.1.0/src/bioemu/sde_lib.py +170 -0
  27. bioemu-0.1.0/src/bioemu/seq_io.py +51 -0
  28. bioemu-0.1.0/src/bioemu/shortcuts.py +7 -0
  29. bioemu-0.1.0/src/bioemu/sidechain_relax.py +219 -0
  30. bioemu-0.1.0/src/bioemu/so3_sde.py +1975 -0
  31. bioemu-0.1.0/src/bioemu/structure_module.py +287 -0
  32. bioemu-0.1.0/src/bioemu/utils.py +22 -0
  33. bioemu-0.1.0/src/bioemu.egg-info/PKG-INFO +26 -0
  34. bioemu-0.1.0/src/bioemu.egg-info/SOURCES.txt +46 -0
  35. bioemu-0.1.0/src/bioemu.egg-info/dependency_links.txt +1 -0
  36. bioemu-0.1.0/src/bioemu.egg-info/requires.txt +21 -0
  37. bioemu-0.1.0/src/bioemu.egg-info/top_level.txt +1 -0
  38. bioemu-0.1.0/tests/test_convert_chemgraph.py +68 -0
  39. bioemu-0.1.0/tests/test_denoiser.py +78 -0
  40. bioemu-0.1.0/tests/test_embeds.py +49 -0
  41. bioemu-0.1.0/tests/test_mdrelax.py +54 -0
  42. bioemu-0.1.0/tests/test_models.py +42 -0
  43. bioemu-0.1.0/tests/test_sample.py +52 -0
  44. bioemu-0.1.0/tests/test_sde_lib.py +44 -0
  45. bioemu-0.1.0/tests/test_seq_io.py +40 -0
  46. bioemu-0.1.0/tests/test_so3_diffusion.py +135 -0
  47. bioemu-0.1.0/tests/test_so3_utils.py +443 -0
  48. bioemu-0.1.0/tests/test_utils.py +18 -0
bioemu-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
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,2 @@
1
+ include src/bioemu/config/**/*.yaml
2
+ include src/bioemu/config/**/*.yml
bioemu-0.1.0/NOTICE.md ADDED
@@ -0,0 +1,214 @@
1
+ NOTICES
2
+
3
+ This project incorporates material as listed below or described in the code.
4
+
5
+ ---------------------------
6
+
7
+ OpenFold
8
+
9
+ Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to Licensor for inclusion in the Work by the copyright owner
60
+ or by an individual or Legal Entity authorized to submit on behalf of
61
+ the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright 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
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or
103
+ Derivative Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ APPENDIX: How to apply the Apache License to your work.
187
+
188
+ To apply the Apache License to your work, attach the following
189
+ boilerplate notice, with the fields enclosed by brackets "[]"
190
+ replaced with your own identifying information. (Don't include
191
+ the brackets!) The text should be enclosed in the appropriate
192
+ comment syntax for the file format. We also recommend that a
193
+ file or class name and description of purpose be included on the
194
+ same "printed page" as the copyright notice for easier
195
+ identification within third-party archives.
196
+
197
+ Copyright 2024 AlQuraishi Laboratory
198
+
199
+ Licensed under the Apache License, Version 2.0 (the "License");
200
+ you may not use this file except in compliance with the License.
201
+ You may obtain a copy of the License at
202
+
203
+ http://www.apache.org/licenses/LICENSE-2.0
204
+
205
+ Unless required by applicable law or agreed to in writing, software
206
+ distributed under the License is distributed on an "AS IS" BASIS,
207
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
+ See the License for the specific language governing permissions and
209
+ limitations under the License.
210
+
211
+ Copyright 2021 AlQuraishi Laboratory
212
+ Copyright 2021 DeepMind Technologies Limited
213
+ https://github.com/aqlaboratory/openfold
214
+ --------------------
bioemu-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.2
2
+ Name: bioemu
3
+ Version: 0.1.0
4
+ Summary: Biomolecular emulator
5
+ Requires-Python: >=3.10
6
+ License-File: LICENSE
7
+ License-File: NOTICE.md
8
+ Requires-Dist: mdtraj>=1.9.9
9
+ Requires-Dist: torch_geometric==2.6.1
10
+ Requires-Dist: torch==2.4.0
11
+ Requires-Dist: torchvision
12
+ Requires-Dist: modelcif==0.7
13
+ Requires-Dist: bio>=1.5.9
14
+ Requires-Dist: fire==0.7.0
15
+ Requires-Dist: huggingface-hub
16
+ Requires-Dist: hydra-core
17
+ Requires-Dist: dm-tree
18
+ Requires-Dist: stackprinter
19
+ Requires-Dist: typer
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest; extra == "dev"
22
+ Requires-Dist: pytest-cov; extra == "dev"
23
+ Requires-Dist: pre-commit; extra == "dev"
24
+ Provides-Extra: md
25
+ Requires-Dist: openmm==8.2.0; extra == "md"
26
+ Requires-Dist: pdb2pqr==3.4.1; extra == "md"
bioemu-0.1.0/README.md ADDED
@@ -0,0 +1,115 @@
1
+
2
+ <h1>
3
+ <p align="center">
4
+ <img src="assets/emu.png" alt="BioEmu logo" width="300"/>
5
+ </p>
6
+ </h1>
7
+
8
+ [![DOI:10.1101/2024.12.05.626885](https://zenodo.org/badge/DOI/10.1101/2024.12.05.626885.svg)](https://doi.org/10.1101/2024.12.05.626885)
9
+ [![Requires Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg?logo=python&logoColor=white)](https://python.org/downloads)
10
+
11
+
12
+ # Biomolecular Emulator (BioEmu)
13
+
14
+ Biomolecular Emulator (BioEmu for short) is a model that samples from the approximated equilibrium distribution of structures for a protein monomer, given its amino acid sequence.
15
+
16
+ For more information, see our [preprint](https://www.biorxiv.org/content/10.1101/2024.12.05.626885v1.abstract).
17
+
18
+ This repository contains inference code and model weights.
19
+
20
+ ## Table of Contents
21
+ - [Installation](#installation)
22
+ - [Sampling structures](#sampling-structures)
23
+ - [Citation](#citation)
24
+ - [Get in touch](#get-in-touch)
25
+
26
+ ## Installation
27
+
28
+ bioemu is provided as pip-installable package:
29
+
30
+ ```bash
31
+ pip install bioemu
32
+ ```
33
+
34
+ > [!NOTE]
35
+ > The first time `bioemu` is used to sample structures, it will also need to setup Colabfold on the side. This process can take ~5-10 mins.
36
+
37
+
38
+ ## Sampling structures
39
+ You can sample structures for a given protein sequence using the `sample` module. To run a tiny test using the default model parameters and denoising settings:
40
+ ```
41
+ python -m bioemu.sample --sequence GYDPETGTWG --num_samples 10 --output_dir ~/test-chignolin
42
+ ```
43
+
44
+ Alternatively, you can use the Python API:
45
+
46
+ ```python
47
+ from bioemu.sample import main as sample
48
+ sample(sequence='GYDPETGTWG', num_samples=10, output_dir='~/test_chignolin')
49
+ ```
50
+
51
+ The model parameters will be automatically downloaded from [huggingface](https://huggingface.co/microsoft/bioemu). See [sample.py](./src/bioemu/sample.py) for more options.
52
+
53
+ Sampling times will depend on sequence length and available infrastructure. The following table gives times for collecting 1000 samples measured on an A100 GPU with 80 GB VRAM for sequences of different lengths (using a `batch_size_100=20` setting in `sample.py`):
54
+ | sequence length | time / min |
55
+ | --------------: | ---------: |
56
+ | 100 | 4 |
57
+ | 300 | 40 |
58
+ | 600 | 150 |
59
+
60
+
61
+ ## Reproducing results from the preprint
62
+ You can use this code together with code from [bioemu-benchmarks](https://github.com/microsoft/bioemu-benchmarks) to approximately reproduce results from our [preprint](https://www.biorxiv.org/content/10.1101/2024.12.05.626885v1).
63
+
64
+ The `bioemu-v1.0` checkpoint contains the model weights used to produce the results in the preprint. Due to simplifications made in the embedding computation and a more efficient sampler, the results obtained with this code are not identical but consistent with the statistics shown in the preprint, i.e., mode coverage and free energy errors averaged over the proteins in a test set. Results for individual proteins may differ. For more details, please check the [BIOEMU_RESULTS.md](https://github.com/microsoft/bioemu-benchmarks/blob/main/bioemu_benchmarks/BIOEMU_RESULTS.md) document on the bioemu-benchmarks repository.
65
+
66
+
67
+ ## Citation
68
+ If you are using our code or model, please consider citing our work:
69
+ ```bibtex
70
+ @article {BioEmu2024,
71
+ author = {Lewis, Sarah and Hempel, Tim and Jim{\'e}nez-Luna, Jos{\'e} and Gastegger, Michael and Xie, Yu and Foong, Andrew Y. K. and Satorras, Victor Garc{\'\i}a and Abdin, Osama and Veeling, Bastiaan S. and Zaporozhets, Iryna and Chen, Yaoyi and Yang, Soojung and Schneuing, Arne and Nigam, Jigyasa and Barbero, Federico and Stimper, Vincent and Campbell, Andrew and Yim, Jason and Lienen, Marten and Shi, Yu and Zheng, Shuxin and Schulz, Hannes and Munir, Usman and Clementi, Cecilia and No{\'e}, Frank},
72
+ title = {Scalable emulation of protein equilibrium ensembles with generative deep learning},
73
+ year = {2024},
74
+ doi = {10.1101/2024.12.05.626885},
75
+ journal = {bioRxiv}
76
+ }
77
+ ```
78
+
79
+ ## Side-chain reconstruction and MD-relaxation
80
+ BioEmu outputs structures in backbone frame representation.
81
+ To reconstruct the side-chains, several tools are available.
82
+ As an example, we provide a script to conduct side-chain reconstruction with HPacker (https://github.com/gvisani/hpacker), and provide an interface for running a short molecular dynamics (MD) equilibration.
83
+ HPacker is a method for protein side-chain packing based on holographic rotationally equivariant convolutional neural networks (https://arxiv.org/abs/2311.09312).
84
+
85
+ This code is experimental and is provided for research purposes only. Further testing/development are needed before considering its application in real-world scenarios or production environments.
86
+
87
+ ### Install side-chain reconstruction tools
88
+ Clone and install the HPacker code and other dependencies with
89
+ ```bash
90
+ ./setup_sidechain_relax.sh
91
+ ```
92
+
93
+ This will install some additional dependences for running MD relaxation in the `bioemu` environment. It will also install HPacker in a separate conda environment called `hpacker`.
94
+
95
+ ### Use side-chain reconstruction tools
96
+ Inside the `bioemu` enviroment, run side-chain reconstruction with:
97
+ ```bash
98
+ python -m bioemu.sidechain_relax --pdb-path path/to/topology.pdb --xtc-path path/to/samples.xtc
99
+ ```
100
+ By default, side-chain reconstruction and local energy minimization are performed (no full MD integration for efficiency reasons).
101
+ Note that the runtime of this code scales with the size of the system.
102
+ We suggest running this code on a selection of samples rather than the full set.
103
+
104
+ There are two other options:
105
+ - To only run side-chain reconstruction without MD equilibration, add `--no-md-equil`.
106
+ - To run a short NVT equilibration (0.1 ns), add `--md-protocol nvt_equil`
107
+
108
+ To see the full list of options, call `python -m bioemu.sidechain_relax --help`.
109
+
110
+ The script saves reconstructed all-heavy-atom structures in `samples_sidechain_rec.{pdb,xtc}` and MD-equilibrated structures in `samples_md_equil.{pdb,xtc}` (filename to be altered with `--outname other_name`).
111
+
112
+ ## Third-party code
113
+ The code in the `openfold` subdirectory is copied from [openfold](https://github.com/aqlaboratory/openfold) with minor modifications. The modifications are described in the relevant source files.
114
+ ## Get in touch
115
+ If you have any questions not covered here, please create an issue or contact the BioEmu team by writing to the corresponding author on our [preprint](https://doi.org/10.1101/2024.12.05.626885).
@@ -0,0 +1,169 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "bioemu"
7
+ version = "0.1.0"
8
+ description = "Biomolecular emulator"
9
+ authors = [
10
+ ]
11
+ requires-python = ">=3.10"
12
+ dependencies = [
13
+ "mdtraj>=1.9.9",
14
+ "torch_geometric==2.6.1",
15
+ "torch==2.4.0",
16
+ "torchvision",
17
+ "modelcif==0.7",
18
+ "bio>=1.5.9",
19
+ "fire==0.7.0",
20
+ "huggingface-hub",
21
+ "hydra-core",
22
+ "dm-tree",
23
+ "stackprinter",
24
+ "typer"
25
+ ]
26
+
27
+ [project.optional-dependencies]
28
+ dev = [
29
+ "pytest", # For developers
30
+ "pytest-cov",
31
+ "pre-commit",
32
+ ]
33
+ md = [
34
+ "openmm==8.2.0",
35
+ "pdb2pqr==3.4.1"
36
+ ]
37
+
38
+ [tool.black]
39
+ line-length = 100
40
+ include = '\.pyi?$'
41
+ exclude = '''
42
+ /(
43
+ \.git
44
+ | \.hg
45
+ | \.mypy_cache
46
+ | \.tox
47
+ | \.venv
48
+ | _build
49
+ | buck-out
50
+ | build
51
+ | dist
52
+ | bioemu/openfold
53
+ )/
54
+ '''
55
+
56
+ [tool.isort]
57
+ profile = "black"
58
+ line_length = 100
59
+ known_first_party = [
60
+ "bioemu",
61
+ ]
62
+
63
+ [tool.mypy]
64
+ verbosity = 0
65
+
66
+ [[tool.mypy.overrides]]
67
+ module = [
68
+ "Bio.*",
69
+ "git.*",
70
+ "hydra.*",
71
+ "IPython.*",
72
+ "matplotlib.*",
73
+ "mdtraj.*",
74
+ "numpy.*",
75
+ "openmm.*",
76
+ "tqdm.*",
77
+ "torch.*",
78
+ "torch_geometric.*",
79
+ "torch_scatter.*",
80
+ "pandas.*",
81
+ "pdbfixer.*",
82
+ "pytest.*",
83
+ "omegaconf.*",
84
+ "scipy.*",
85
+ "sklearn.*",
86
+ ]
87
+ ignore_missing_imports = true
88
+
89
+
90
+
91
+
92
+ [tool.ruff]
93
+ line-length = 100
94
+
95
+ [tool.ruff.lint]
96
+ # Check https://beta.ruff.rs/docs/rules/ for full list of rules
97
+ select = [
98
+ "E", "W", # pycodestyle
99
+ "F", # Pyflakes
100
+ # "C90", # mccabe
101
+ # "I", # isort
102
+ # "N", # pep8-naming
103
+ # "D", # pydocstyle
104
+ "UP", # pyupgrade
105
+ # "YTT", # flake8-2020
106
+ # "ANN", # flake8-annotations
107
+ # "S", # flake8-bandit
108
+ # "BLE", # flake8-blind-except
109
+ # "FBT", # flake8-boolean-trap
110
+ # "B", # flake8-bugbear
111
+ # "A", # flake8-builtins
112
+ # "COM", # flake8-commas
113
+ # "C4", # flake8-comprehensions
114
+ # "DTZ", # flake8-datetimez
115
+ # "T10", # flake8-debugger
116
+ # "DJ", # flake8-django
117
+ # "EM", # flake8-errmsg
118
+ # "EXE", # flake8-executable
119
+ # "ISC", # flake8-implicit-str-concat
120
+ # "ICN", # flake8-import-conventions
121
+ # "G", # flake8-logging-format
122
+ # "INP", # flake8-no-pep420
123
+ # "PIE", # flake8-pie
124
+ # "T20", # flake8-print
125
+ # "PYI", # flake8-pyi
126
+ # "PT", # flake8-pytest-style
127
+ # "Q", # flake8-quotes
128
+ # "RSE", # flake8-raise
129
+ # "RET", # flake8-return
130
+ # "SLF", # flake8-self
131
+ # "SIM", # flake8-simplify
132
+ # "TID", # flake8-tidy-imports
133
+ # "TCH", # flake8-type-checking
134
+ # "ARG", # flake8-unused-arguments
135
+ # "PTH", # flake8-use-pathlib
136
+ # "ERA", # eradicate
137
+ # "PD", # pandas-vet
138
+ # "PGH", # pygrep-hooks
139
+ # "PLC", # pylint-convention
140
+ "PLE", # pylint-error
141
+ # "PLR", # pylint-refactor
142
+ # "PLW", # pylint-warning
143
+ # "TRY", # tryceratops
144
+ # "NPY", # numpy
145
+ # "RUF", # ruff
146
+ ]
147
+ ignore = [
148
+ # W605: invalid escape sequence -- triggered by pseudo-LaTeX in comments
149
+ "W605",
150
+ # E501: Line too long -- triggered by comments and such. black deals with shortening.
151
+ "E501",
152
+ # E402: Module level import not at top of file -- triggered by python path manipulations
153
+ "E402",
154
+ # E741: Do not use variables named 'l', 'o', or 'i' -- disagree with PEP8
155
+ "E741",
156
+ ]
157
+ extend-safe-fixes = [
158
+ "UP"
159
+ ]
160
+ exclude=["openfold"]
161
+
162
+ [tool.setuptools]
163
+ include-package-data = true
164
+
165
+ [tool.setuptools.packages.find]
166
+ where = ["src"]
167
+
168
+ [tool.setuptools.package-data]
169
+ "*" = ["*.patch", "*.sh", "*.md"]
bioemu-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,28 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+ from __future__ import annotations
4
+
5
+ import copy
6
+ from typing import Any
7
+
8
+ import torch
9
+ from torch_geometric.data import Data
10
+
11
+
12
+ class ChemGraph(Data):
13
+ node_orientations: torch.Tensor # [num_nodes, 3, 3] or [num_nodes, 3] when it's a score (since the scores are given as rotation vectors)
14
+ pos: torch.Tensor # [num_nodes, 3] score model expects this to be in nanometers.
15
+ edge_index: torch.Tensor # [2, num_edges]
16
+ single_embeds: torch.Tensor # [num_nodes, EVOFORMER_NODE_DIM]
17
+ pair_embeds: torch.Tensor # [num_nodes**2, EVOFORMER_EDGE_DIM]
18
+
19
+ def replace(self, **kwargs: Any) -> ChemGraph:
20
+ """Returns a shallow copy of the ChemGraph with updated fields."""
21
+ out = self.__class__.__new__(self.__class__)
22
+ for key, value in self.__dict__.items():
23
+ out.__dict__[key] = value
24
+ out.__dict__["_store"] = copy.copy(self._store)
25
+ for key, value in kwargs.items():
26
+ out._store[key] = value
27
+ out._store._parent = out
28
+ return out
File without changes
@@ -0,0 +1,6 @@
1
+ 430d429
2
+ <
3
+ 478a478
4
+ > np.save(files.get("single_repr_evo", "npy"), result["representations_evo"]["single"])
5
+ 480a481
6
+ > np.save(files.get("pair_repr_evo", "npy"), result["representations_evo"]["pair"])
@@ -0,0 +1,14 @@
1
+ 146c146
2
+ < ret = {'representations':representations}
3
+ ---
4
+ > ret = {'representations':representations, 'representations_evo': representations}
5
+ 173d172
6
+ <
7
+ 181d179
8
+ <
9
+ 216d213
10
+ <
11
+ 317d313
12
+ <
13
+ 2092d2087
14
+ <
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+
3
+ set -ex
4
+
5
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6
+
7
+ # Set COLABFOLD_DIR to ~/.localcolabfold if dir not passed as first arg
8
+ COLABFOLD_DIR="${1:-"~/.localcolabfold"}"
9
+
10
+ echo "Setting up colabfold..."
11
+ mkdir -p ${COLABFOLD_DIR}
12
+ wget "https://raw.githubusercontent.com/YoshitakaMo/localcolabfold/5fc8775114b637b5672234179c50e694ab057db4/install_colabbatch_linux.sh" -O ${COLABFOLD_DIR}/install_colabbatch_linux.sh
13
+ # Replace 'git+https://github.com/sokrypton/ColabFold' with 'git+https://github.com/sokrypton/ColabFold@e2ca9e8f992cd65c986de5b64885d5572d8b8ad9' in install_colabbatch_linux.sh
14
+ sed -i 's/git+https:\/\/github.com\/sokrypton\/ColabFold/git+https:\/\/github.com\/sokrypton\/ColabFold@e2ca9e8f992cd65c986de5b64885d5572d8b8ad9/g' ${COLABFOLD_DIR}/install_colabbatch_linux.sh
15
+ chmod +x ${COLABFOLD_DIR}/install_colabbatch_linux.sh
16
+ cd ${COLABFOLD_DIR} && bash install_colabbatch_linux.sh
17
+
18
+ # Patch colabfold install
19
+ echo "Patching colabfold installation..."
20
+ patch ${COLABFOLD_DIR}/localcolabfold/colabfold-conda/lib/python3.10/site-packages/alphafold/model/modules.py ${SCRIPT_DIR}/modules.patch
21
+ patch ${COLABFOLD_DIR}/localcolabfold/colabfold-conda/lib/python3.10/site-packages/colabfold/batch.py ${SCRIPT_DIR}/batch.patch
22
+
23
+ echo "Colabfold installation complete!"
@@ -0,0 +1,5 @@
1
+ _target_: bioemu.shortcuts.dpm_solver
2
+ _partial_: true
3
+ eps_t: 0.001
4
+ max_t: 0.99
5
+ N: 30
@@ -0,0 +1,6 @@
1
+ _target_: bioemu.shortcuts.heun_denoiser
2
+ _partial_: true
3
+ eps_t: 0.001
4
+ N: 100
5
+ max_t: 0.99
6
+ noise: 0.5