openprotein-python 0.11.1__tar.gz → 0.12.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.
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/PKG-INFO +1 -1
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/__init__.py +1 -0
- openprotein_python-0.12.0/openprotein/embeddings/ablang.py +21 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/api.py +9 -2
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/future.py +6 -2
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/poet2.py +19 -3
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/__init__.py +27 -8
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/alphafold2.py +11 -21
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/api.py +10 -102
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/boltz.py +28 -107
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/common.py +109 -5
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/esmfold.py +3 -3
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/fold.py +3 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/future.py +19 -55
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/minifold.py +8 -4
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/models.py +17 -9
- openprotein_python-0.12.0/openprotein/fold/protenix.py +97 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/rosettafold3.py +10 -20
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/jobs/futures.py +12 -12
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/__init__.py +6 -2
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/foundation/boltzgen.py +25 -46
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/foundation/proteinmpnn.py +29 -6
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/foundation/rfdiffusion.py +23 -46
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/structure_generation.py +26 -4
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/molecules/template.py +6 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/prompt/prompt.py +15 -2
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/pyproject.toml +32 -20
- openprotein_python-0.11.1/openprotein/api/__init__.py +0 -9
- openprotein_python-0.11.1/openprotein/api/align.py +0 -400
- openprotein_python-0.11.1/openprotein/api/assaydata.py +0 -216
- openprotein_python-0.11.1/openprotein/api/deprecated/__init__.py +0 -5
- openprotein_python-0.11.1/openprotein/api/deprecated/design.py +0 -86
- openprotein_python-0.11.1/openprotein/api/deprecated/poet.py +0 -308
- openprotein_python-0.11.1/openprotein/api/deprecated/predict.py +0 -276
- openprotein_python-0.11.1/openprotein/api/deprecated/train.py +0 -224
- openprotein_python-0.11.1/openprotein/api/design.py +0 -86
- openprotein_python-0.11.1/openprotein/api/designer.py +0 -267
- openprotein_python-0.11.1/openprotein/api/embedding.py +0 -446
- openprotein_python-0.11.1/openprotein/api/error.py +0 -5
- openprotein_python-0.11.1/openprotein/api/fold.py +0 -157
- openprotein_python-0.11.1/openprotein/api/job.py +0 -94
- openprotein_python-0.11.1/openprotein/api/predict.py +0 -273
- openprotein_python-0.11.1/openprotein/api/predictor.py +0 -326
- openprotein_python-0.11.1/openprotein/api/prompt.py +0 -464
- openprotein_python-0.11.1/openprotein/api/svd.py +0 -203
- openprotein_python-0.11.1/openprotein/api/train.py +0 -222
- openprotein_python-0.11.1/openprotein/api/umap.py +0 -257
- openprotein_python-0.11.1/openprotein/app/__init__.py +0 -19
- openprotein_python-0.11.1/openprotein/app/deprecated.py +0 -8
- openprotein_python-0.11.1/openprotein/app/models/__init__.py +0 -33
- openprotein_python-0.11.1/openprotein/app/models/align/__init__.py +0 -4
- openprotein_python-0.11.1/openprotein/app/models/align/base.py +0 -20
- openprotein_python-0.11.1/openprotein/app/models/align/msa.py +0 -134
- openprotein_python-0.11.1/openprotein/app/models/align/prompt.py +0 -78
- openprotein_python-0.11.1/openprotein/app/models/assaydata.py +0 -176
- openprotein_python-0.11.1/openprotein/app/models/deprecated/__init__.py +0 -10
- openprotein_python-0.11.1/openprotein/app/models/deprecated/design.py +0 -109
- openprotein_python-0.11.1/openprotein/app/models/deprecated/poet.py +0 -204
- openprotein_python-0.11.1/openprotein/app/models/deprecated/predict.py +0 -232
- openprotein_python-0.11.1/openprotein/app/models/deprecated/train.py +0 -307
- openprotein_python-0.11.1/openprotein/app/models/design.py +0 -105
- openprotein_python-0.11.1/openprotein/app/models/designer.py +0 -143
- openprotein_python-0.11.1/openprotein/app/models/embeddings/__init__.py +0 -12
- openprotein_python-0.11.1/openprotein/app/models/embeddings/base.py +0 -337
- openprotein_python-0.11.1/openprotein/app/models/embeddings/esm.py +0 -32
- openprotein_python-0.11.1/openprotein/app/models/embeddings/future.py +0 -135
- openprotein_python-0.11.1/openprotein/app/models/embeddings/openprotein.py +0 -21
- openprotein_python-0.11.1/openprotein/app/models/embeddings/poet.py +0 -366
- openprotein_python-0.11.1/openprotein/app/models/embeddings/poet2.py +0 -385
- openprotein_python-0.11.1/openprotein/app/models/embeddings/test.py +0 -38
- openprotein_python-0.11.1/openprotein/app/models/fold/__init__.py +0 -6
- openprotein_python-0.11.1/openprotein/app/models/fold/alphafold2.py +0 -54
- openprotein_python-0.11.1/openprotein/app/models/fold/base.py +0 -81
- openprotein_python-0.11.1/openprotein/app/models/fold/boltz.py +0 -57
- openprotein_python-0.11.1/openprotein/app/models/fold/esmfold.py +0 -38
- openprotein_python-0.11.1/openprotein/app/models/fold/future.py +0 -56
- openprotein_python-0.11.1/openprotein/app/models/futures.py +0 -473
- openprotein_python-0.11.1/openprotein/app/models/predict.py +0 -246
- openprotein_python-0.11.1/openprotein/app/models/predictor/__init__.py +0 -4
- openprotein_python-0.11.1/openprotein/app/models/predictor/predict.py +0 -78
- openprotein_python-0.11.1/openprotein/app/models/predictor/predictor.py +0 -362
- openprotein_python-0.11.1/openprotein/app/models/predictor/validate.py +0 -37
- openprotein_python-0.11.1/openprotein/app/models/prompt.py +0 -141
- openprotein_python-0.11.1/openprotein/app/models/svd.py +0 -260
- openprotein_python-0.11.1/openprotein/app/models/train.py +0 -303
- openprotein_python-0.11.1/openprotein/app/models/umap.py +0 -156
- openprotein_python-0.11.1/openprotein/app/services/__init__.py +0 -16
- openprotein_python-0.11.1/openprotein/app/services/align.py +0 -356
- openprotein_python-0.11.1/openprotein/app/services/assaydata.py +0 -119
- openprotein_python-0.11.1/openprotein/app/services/deprecated/__init__.py +0 -9
- openprotein_python-0.11.1/openprotein/app/services/deprecated/design.py +0 -79
- openprotein_python-0.11.1/openprotein/app/services/deprecated/predict.py +0 -152
- openprotein_python-0.11.1/openprotein/app/services/deprecated/train.py +0 -140
- openprotein_python-0.11.1/openprotein/app/services/design.py +0 -79
- openprotein_python-0.11.1/openprotein/app/services/designer.py +0 -107
- openprotein_python-0.11.1/openprotein/app/services/embeddings.py +0 -137
- openprotein_python-0.11.1/openprotein/app/services/fold.py +0 -89
- openprotein_python-0.11.1/openprotein/app/services/job.py +0 -61
- openprotein_python-0.11.1/openprotein/app/services/predict.py +0 -145
- openprotein_python-0.11.1/openprotein/app/services/predictor.py +0 -192
- openprotein_python-0.11.1/openprotein/app/services/prompt.py +0 -133
- openprotein_python-0.11.1/openprotein/app/services/svd.py +0 -102
- openprotein_python-0.11.1/openprotein/app/services/train.py +0 -135
- openprotein_python-0.11.1/openprotein/app/services/umap.py +0 -97
- openprotein_python-0.11.1/openprotein/schemas/__init__.py +0 -74
- openprotein_python-0.11.1/openprotein/schemas/align.py +0 -61
- openprotein_python-0.11.1/openprotein/schemas/assaydata.py +0 -27
- openprotein_python-0.11.1/openprotein/schemas/deprecated/__init__.py +0 -21
- openprotein_python-0.11.1/openprotein/schemas/deprecated/design.py +0 -173
- openprotein_python-0.11.1/openprotein/schemas/deprecated/poet.py +0 -70
- openprotein_python-0.11.1/openprotein/schemas/deprecated/predict.py +0 -82
- openprotein_python-0.11.1/openprotein/schemas/deprecated/train.py +0 -34
- openprotein_python-0.11.1/openprotein/schemas/design.py +0 -202
- openprotein_python-0.11.1/openprotein/schemas/designer.py +0 -38
- openprotein_python-0.11.1/openprotein/schemas/embeddings.py +0 -102
- openprotein_python-0.11.1/openprotein/schemas/features.py +0 -7
- openprotein_python-0.11.1/openprotein/schemas/fold.py +0 -10
- openprotein_python-0.11.1/openprotein/schemas/job.py +0 -134
- openprotein_python-0.11.1/openprotein/schemas/predict.py +0 -82
- openprotein_python-0.11.1/openprotein/schemas/predictor.py +0 -96
- openprotein_python-0.11.1/openprotein/schemas/prompt.py +0 -28
- openprotein_python-0.11.1/openprotein/schemas/svd.py +0 -31
- openprotein_python-0.11.1/openprotein/schemas/train.py +0 -34
- openprotein_python-0.11.1/openprotein/schemas/umap.py +0 -35
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/.gitignore +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/LICENSE.txt +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/README.md +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/_version.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/align/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/align/align.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/align/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/align/future.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/align/msa.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/align/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/base.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/chains.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/common/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/common/features.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/common/model_metadata.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/common/reduction.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/common/residue_contants.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/config.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/csv.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/data/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/data/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/data/assaydataset.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/data/data.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/data/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/design/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/design/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/design/design.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/design/future.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/design/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/embeddings.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/esm.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/models.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/openprotein.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/poet.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/embeddings/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/errors.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fasta.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/complex.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/fold/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/jobs/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/jobs/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/jobs/jobs.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/jobs/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/base.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/foundation/boltzgen_schema.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/models/models.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/molecules/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/molecules/chains.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/molecules/complex.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/molecules/protein.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/molecules/structure.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/models.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/prediction.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/predictor.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/predictor/validate.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/prompt/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/prompt/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/prompt/models.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/prompt/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/protein.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/scaffolds.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/svd/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/svd/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/svd/models.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/svd/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/svd/svd.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/umap/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/umap/api.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/umap/models.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/umap/schemas.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/umap/umap.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/utils/__init__.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/utils/chain_id.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/utils/cif.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/utils/numpy.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/utils/sequence.py +0 -0
- {openprotein_python-0.11.1 → openprotein_python-0.12.0}/openprotein/utils/uuid.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openprotein-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: OpenProtein Python interface.
|
|
5
5
|
Author-email: Mark Gee <markgee@ne47.bio>, "Timothy Truong Jr." <ttruong@ne47.bio>, Tristan Bepler <tbepler@ne47.bio>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""AbLang model."""
|
|
2
|
+
|
|
3
|
+
from .models import EmbeddingModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AbLang2Model(EmbeddingModel):
|
|
7
|
+
"""
|
|
8
|
+
Community AbLang2 model that targets antibodies.
|
|
9
|
+
|
|
10
|
+
Examples
|
|
11
|
+
--------
|
|
12
|
+
View specific model details (inc supported tokens) with the `?` operator.
|
|
13
|
+
|
|
14
|
+
.. code-block:: python
|
|
15
|
+
|
|
16
|
+
>>> import openprotein
|
|
17
|
+
>>> session = openprotein.connect(username="user", password="password")
|
|
18
|
+
>>> session.embedding.ablang2?
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
model_id = ["ablang2"]
|
|
@@ -598,9 +598,16 @@ def request_generate_post(
|
|
|
598
598
|
body["seed"] = random_seed
|
|
599
599
|
if kwargs.get("prompt_id"):
|
|
600
600
|
body["prompt_id"] = kwargs["prompt_id"]
|
|
601
|
-
if kwargs.get("
|
|
601
|
+
if kwargs.get("design_id"):
|
|
602
|
+
body["design_id"] = kwargs["design_id"]
|
|
603
|
+
query_id = kwargs.get("query_id")
|
|
604
|
+
if query_id is not None:
|
|
602
605
|
assert model_id != "poet", f"Model with id {model_id} does not support query"
|
|
603
|
-
body["query_id"] =
|
|
606
|
+
body["query_id"] = (
|
|
607
|
+
list(query_id)
|
|
608
|
+
if isinstance(query_id, list)
|
|
609
|
+
else query_id
|
|
610
|
+
)
|
|
604
611
|
if "use_query_structure_in_decoder" in kwargs:
|
|
605
612
|
body["use_query_structure_in_decoder"] = kwargs[
|
|
606
613
|
"use_query_structure_in_decoder"
|
|
@@ -165,10 +165,14 @@ class EmbeddingsGenerateFuture(BaseScoreFuture[Score]):
|
|
|
165
165
|
def stream(self) -> Iterator[Score]:
|
|
166
166
|
stream = api.request_get_generate_result(session=self.session, job_id=self.id)
|
|
167
167
|
# name, sequence, ...
|
|
168
|
-
next(stream)
|
|
168
|
+
header = next(stream)
|
|
169
|
+
has_query_id = (
|
|
170
|
+
len(header) > 2 and header[-1].strip().lower() == "query_id"
|
|
171
|
+
)
|
|
169
172
|
for line in stream:
|
|
170
173
|
# combine scores into numpy array
|
|
171
|
-
|
|
174
|
+
score_values = line[2:-1] if has_query_id else line[2:]
|
|
175
|
+
scores = np.array([float(s) for s in score_values])
|
|
172
176
|
output = Score(name=line[0], sequence=line[1], score=scores)
|
|
173
177
|
yield output
|
|
174
178
|
|
|
@@ -20,6 +20,7 @@ from .models import EmbeddingModel
|
|
|
20
20
|
from .poet import PoETModel
|
|
21
21
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
23
|
+
from openprotein.models.structure_generation import StructureGenerationFuture
|
|
23
24
|
from openprotein.predictor import PredictorModel
|
|
24
25
|
from openprotein.svd import SVDModel
|
|
25
26
|
from openprotein.umap import UMAPModel
|
|
@@ -290,7 +291,16 @@ class PoET2Model(PoETModel, EmbeddingModel):
|
|
|
290
291
|
def generate(
|
|
291
292
|
self,
|
|
292
293
|
prompt: str | Prompt | None,
|
|
293
|
-
query:
|
|
294
|
+
query: (
|
|
295
|
+
str
|
|
296
|
+
| bytes
|
|
297
|
+
| Protein
|
|
298
|
+
| Complex
|
|
299
|
+
| Query
|
|
300
|
+
| list[str | bytes | Protein | Complex | Query]
|
|
301
|
+
| None
|
|
302
|
+
) = None,
|
|
303
|
+
design: "str | StructureGenerationFuture | None" = None,
|
|
294
304
|
use_query_structure_in_decoder: bool = True,
|
|
295
305
|
num_samples: int = 100,
|
|
296
306
|
temperature: float = 1.0,
|
|
@@ -308,7 +318,7 @@ class PoET2Model(PoETModel, EmbeddingModel):
|
|
|
308
318
|
----------
|
|
309
319
|
prompt : str or Prompt or None, optional
|
|
310
320
|
Prompt from an align workflow to condition PoET model.
|
|
311
|
-
query : str or bytes or Protein or Complex or Query or None, optional
|
|
321
|
+
query : str or bytes or Protein or Complex or Query or list of these or None, optional
|
|
312
322
|
Query to use with prompt.
|
|
313
323
|
use_query_structure_in_decoder : bool, optional
|
|
314
324
|
Whether to use query structure in decoder. Default is True.
|
|
@@ -340,9 +350,14 @@ class PoET2Model(PoETModel, EmbeddingModel):
|
|
|
340
350
|
EmbeddingsGenerateFuture
|
|
341
351
|
A future object representing the status and information about the generation job.
|
|
342
352
|
"""
|
|
353
|
+
from openprotein.models.structure_generation import StructureGenerationFuture
|
|
354
|
+
|
|
343
355
|
prompt_api = getattr(self.session, "prompt", None)
|
|
344
356
|
assert isinstance(prompt_api, PromptAPI)
|
|
345
|
-
query_id = prompt_api._resolve_query(query=query)
|
|
357
|
+
query_id = prompt_api._resolve_query(query=query) if query is not None else None
|
|
358
|
+
design_id = (
|
|
359
|
+
design.job_id if isinstance(design, StructureGenerationFuture) else design
|
|
360
|
+
)
|
|
346
361
|
if ensemble_weights is not None:
|
|
347
362
|
# NB: for now, ensemble_method is None -> ensemble_method == "arithmetic"
|
|
348
363
|
if ensemble_method is None or (ensemble_method == "arithmetic"):
|
|
@@ -364,6 +379,7 @@ class PoET2Model(PoETModel, EmbeddingModel):
|
|
|
364
379
|
max_length=max_length,
|
|
365
380
|
seed=seed,
|
|
366
381
|
query_id=query_id,
|
|
382
|
+
design_id=design_id,
|
|
367
383
|
use_query_structure_in_decoder=use_query_structure_in_decoder,
|
|
368
384
|
ensemble_weights=ensemble_weights,
|
|
369
385
|
ensemble_method=ensemble_method,
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Fold module for predicting structures on OpenProtein.
|
|
3
|
-
|
|
4
|
-
isort:skip_file
|
|
5
3
|
"""
|
|
6
4
|
|
|
7
|
-
from .schemas import FoldJob, FoldMetadata
|
|
8
|
-
from .models import FoldModel
|
|
9
|
-
from .esmfold import ESMFoldModel
|
|
10
|
-
from .minifold import MiniFoldModel
|
|
11
5
|
from .alphafold2 import AlphaFold2Model
|
|
12
6
|
from .boltz import (
|
|
13
7
|
Boltz1Model,
|
|
@@ -18,6 +12,31 @@ from .boltz import (
|
|
|
18
12
|
BoltzConstraint,
|
|
19
13
|
BoltzProperty,
|
|
20
14
|
)
|
|
21
|
-
from .
|
|
22
|
-
from .future import FoldResultFuture
|
|
15
|
+
from .esmfold import ESMFoldModel
|
|
23
16
|
from .fold import FoldAPI
|
|
17
|
+
from .future import FoldResultFuture
|
|
18
|
+
from .minifold import MiniFoldModel
|
|
19
|
+
from .models import FoldModel
|
|
20
|
+
from .protenix import ProtenixModel
|
|
21
|
+
from .rosettafold3 import RosettaFold3Model
|
|
22
|
+
from .schemas import FoldJob, FoldMetadata
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"FoldJob",
|
|
26
|
+
"FoldMetadata",
|
|
27
|
+
"FoldModel",
|
|
28
|
+
"ESMFoldModel",
|
|
29
|
+
"MiniFoldModel",
|
|
30
|
+
"AlphaFold2Model",
|
|
31
|
+
"ProtenixModel",
|
|
32
|
+
"Boltz1Model",
|
|
33
|
+
"Boltz1xModel",
|
|
34
|
+
"Boltz2Model",
|
|
35
|
+
"BoltzAffinity",
|
|
36
|
+
"BoltzConfidence",
|
|
37
|
+
"BoltzConstraint",
|
|
38
|
+
"BoltzProperty",
|
|
39
|
+
"RosettaFold3Model",
|
|
40
|
+
"FoldResultFuture",
|
|
41
|
+
"FoldAPI",
|
|
42
|
+
]
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"""Community-based AlphaFold 2 model running using ColabFold."""
|
|
2
2
|
|
|
3
|
-
import io
|
|
4
3
|
import warnings
|
|
5
|
-
from typing import
|
|
4
|
+
from typing import Sequence
|
|
6
5
|
|
|
7
|
-
from openprotein.align import
|
|
6
|
+
from openprotein.align import MSAFuture
|
|
8
7
|
from openprotein.base import APISession
|
|
9
8
|
from openprotein.common import ModelMetadata
|
|
10
|
-
from openprotein.fold.common import
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
from openprotein.fold.common import (
|
|
10
|
+
msa_future_to_complex,
|
|
11
|
+
normalize_inputs,
|
|
12
|
+
serialize_input,
|
|
13
|
+
)
|
|
14
|
+
from openprotein.molecules import DNA, RNA, Complex, Ligand, Protein
|
|
13
15
|
|
|
14
16
|
from . import api
|
|
15
17
|
from .future import FoldResultFuture
|
|
@@ -33,7 +35,7 @@ class AlphaFold2Model(FoldModel):
|
|
|
33
35
|
|
|
34
36
|
def fold(
|
|
35
37
|
self,
|
|
36
|
-
sequences: Sequence[Complex | Protein | str
|
|
38
|
+
sequences: Sequence[Complex | Protein | str | bytes] | MSAFuture,
|
|
37
39
|
num_recycles: int | None = None,
|
|
38
40
|
num_models: int = 1,
|
|
39
41
|
num_relax: int = 0,
|
|
@@ -44,7 +46,7 @@ class AlphaFold2Model(FoldModel):
|
|
|
44
46
|
|
|
45
47
|
Parameters
|
|
46
48
|
----------
|
|
47
|
-
sequences :
|
|
49
|
+
sequences : Sequence[Complex | Protein | str | bytes] | MSAFuture
|
|
48
50
|
List of protein sequences to include in folded output. `Protein` objects must be tagged with an `msa`, which can be a `Protein.single_sequence_mode` for single sequence mode. Alternatively, supply an `MSAFuture` to use all query sequences as a multimer.
|
|
49
51
|
num_recycles : int
|
|
50
52
|
number of times to recycle models
|
|
@@ -57,7 +59,6 @@ class AlphaFold2Model(FoldModel):
|
|
|
57
59
|
-------
|
|
58
60
|
job : Job
|
|
59
61
|
"""
|
|
60
|
-
from openprotein.align import AlignAPI
|
|
61
62
|
|
|
62
63
|
if "msa" in kwargs:
|
|
63
64
|
warnings.warn(
|
|
@@ -71,18 +72,7 @@ class AlphaFold2Model(FoldModel):
|
|
|
71
72
|
|
|
72
73
|
# build the normalized_models from msa
|
|
73
74
|
if isinstance(sequences, MSAFuture):
|
|
74
|
-
|
|
75
|
-
align_api = getattr(self.session, "align", None)
|
|
76
|
-
assert isinstance(align_api, AlignAPI)
|
|
77
|
-
msa = sequences # rename
|
|
78
|
-
seed = align_api.get_seed(job_id=msa.job.job_id)
|
|
79
|
-
_proteins: dict[str, Protein] = {}
|
|
80
|
-
for seq in seed.split(":"):
|
|
81
|
-
protein = Protein(sequence=seq)
|
|
82
|
-
id = next(id_gen)
|
|
83
|
-
protein.msa = msa.id
|
|
84
|
-
_proteins[id] = protein
|
|
85
|
-
normalized_complexes = [Complex(chains=_proteins)]
|
|
75
|
+
normalized_complexes = [msa_future_to_complex(self.session, sequences)]
|
|
86
76
|
|
|
87
77
|
else:
|
|
88
78
|
normalized_complexes = normalize_inputs(sequences)
|
|
@@ -199,93 +199,21 @@ def fold_get_extra_result(
|
|
|
199
199
|
The result as a numpy array (for "pae", "pde", "plddt") or a list of dictionaries (for "confidence", "affinity").
|
|
200
200
|
"""
|
|
201
201
|
if key in {"pae", "pde", "plddt", "ptm"}:
|
|
202
|
-
formatter = lambda response: np.load(io.BytesIO(response.content))
|
|
203
|
-
elif key in {"confidence", "affinity"}:
|
|
204
|
-
formatter = lambda response: response.json()
|
|
205
|
-
elif key in {"score", "metrics"}:
|
|
206
|
-
import pandas as pd
|
|
207
|
-
|
|
208
|
-
formatter = lambda response: pd.read_csv(io.StringIO(response.content.decode()))
|
|
209
|
-
else:
|
|
210
|
-
raise ValueError(f"Unexpected key: {key}")
|
|
211
|
-
endpoint = PATH_PREFIX + f"/{job_id}/{sequence_or_index}/{key}"
|
|
212
|
-
try:
|
|
213
|
-
response = session.get(
|
|
214
|
-
endpoint,
|
|
215
|
-
)
|
|
216
|
-
except HTTPError as e:
|
|
217
|
-
if e.status_code == 400 and key == "affinity":
|
|
218
|
-
raise ValueError("affinity not found for request") from None
|
|
219
|
-
raise e
|
|
220
|
-
output = formatter(response)
|
|
221
|
-
return output
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
def fold_get_complex_result(
|
|
225
|
-
session: APISession, job_id: str, format: Literal["pdb", "mmcif"]
|
|
226
|
-
) -> bytes:
|
|
227
|
-
"""
|
|
228
|
-
Get encoded result for a complex from the request ID.
|
|
229
202
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
session : APISession
|
|
233
|
-
Session object for API communication.
|
|
234
|
-
job_id : str
|
|
235
|
-
Job ID to retrieve results from.
|
|
236
|
-
format : {'pdb', 'mmcif'}
|
|
237
|
-
Format of the result.
|
|
238
|
-
|
|
239
|
-
Returns
|
|
240
|
-
-------
|
|
241
|
-
bytes
|
|
242
|
-
Encoded result for the complex.
|
|
243
|
-
"""
|
|
244
|
-
endpoint = PATH_PREFIX + f"/{job_id}/complex"
|
|
245
|
-
response = session.get(
|
|
246
|
-
endpoint,
|
|
247
|
-
params={
|
|
248
|
-
"format": format,
|
|
249
|
-
},
|
|
250
|
-
)
|
|
251
|
-
return response.content
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def fold_get_complex_extra_result(
|
|
255
|
-
session: APISession,
|
|
256
|
-
job_id: str,
|
|
257
|
-
key: Literal[
|
|
258
|
-
"pae", "pde", "plddt", "ptm", "confidence", "affinity", "score", "metrics"
|
|
259
|
-
],
|
|
260
|
-
) -> "np.ndarray | list[dict] | pd.DataFrame":
|
|
261
|
-
"""
|
|
262
|
-
Get extra result for a complex from the request ID.
|
|
263
|
-
|
|
264
|
-
Parameters
|
|
265
|
-
----------
|
|
266
|
-
session : APISession
|
|
267
|
-
Session object for API communication.
|
|
268
|
-
job_id : str
|
|
269
|
-
Job ID to retrieve results from.
|
|
270
|
-
key : {'pae', 'pde', 'plddt', 'ptm', 'confidence', 'affinity', 'score', 'metrics'}
|
|
271
|
-
The type of result to retrieve.
|
|
272
|
-
|
|
273
|
-
Returns
|
|
274
|
-
-------
|
|
275
|
-
numpy.ndarray or list of dict
|
|
276
|
-
The result as a numpy array (for "pae", "pde", "plddt") or a list of dictionaries (for "confidence", "affinity").
|
|
277
|
-
"""
|
|
278
|
-
if key in {"pae", "pde", "plddt", "ptm"}:
|
|
279
|
-
formatter = lambda response: np.load(io.BytesIO(response.content))
|
|
203
|
+
def formatter(response):
|
|
204
|
+
return np.load(io.BytesIO(response.content))
|
|
280
205
|
elif key in {"confidence", "affinity"}:
|
|
281
|
-
|
|
206
|
+
|
|
207
|
+
def formatter(response):
|
|
208
|
+
return response.json()
|
|
282
209
|
elif key in {"score", "metrics"}:
|
|
283
210
|
import pandas as pd
|
|
284
211
|
|
|
285
|
-
formatter
|
|
212
|
+
def formatter(response):
|
|
213
|
+
return pd.read_csv(io.StringIO(response.content.decode()))
|
|
286
214
|
else:
|
|
287
215
|
raise ValueError(f"Unexpected key: {key}")
|
|
288
|
-
endpoint = PATH_PREFIX + f"/{job_id}/
|
|
216
|
+
endpoint = PATH_PREFIX + f"/{job_id}/{sequence_or_index}/{key}"
|
|
289
217
|
try:
|
|
290
218
|
response = session.get(
|
|
291
219
|
endpoint,
|
|
@@ -321,28 +249,8 @@ def fold_models_post(
|
|
|
321
249
|
The outer list represents the batch of requests, and the inner
|
|
322
250
|
list represents the complex, with each item in the list being
|
|
323
251
|
an entity in that complex. A monomer would thus be a single item.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
num_models : int, optional
|
|
327
|
-
Number of models to generate.
|
|
328
|
-
num_relax : int, optional
|
|
329
|
-
Number of relaxation steps.
|
|
330
|
-
use_potentials : bool, optional
|
|
331
|
-
Whether to use potentials.
|
|
332
|
-
diffusion_samples : int, optional
|
|
333
|
-
Number of diffusion samples (boltz).
|
|
334
|
-
recycling_steps : int, optional
|
|
335
|
-
Number of recycling steps (boltz).
|
|
336
|
-
sampling_steps : int, optional
|
|
337
|
-
Number of sampling steps (boltz).
|
|
338
|
-
step_scale : float, optional
|
|
339
|
-
Step scale (boltz).
|
|
340
|
-
constraints : dict, optional
|
|
341
|
-
Constraints to apply.
|
|
342
|
-
templates : list, optional
|
|
343
|
-
Templates to use.
|
|
344
|
-
properties : dict, optional
|
|
345
|
-
Additional properties.
|
|
252
|
+
**kwargs
|
|
253
|
+
Additional keyword arguments to be sent with POST body.
|
|
346
254
|
|
|
347
255
|
Returns
|
|
348
256
|
-------
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"""Community-based Boltz models for complex structure prediction with ligands/dna/rna."""
|
|
2
2
|
|
|
3
3
|
import warnings
|
|
4
|
-
from typing import Mapping, Sequence
|
|
4
|
+
from typing import Mapping, Sequence
|
|
5
5
|
|
|
6
|
-
from pydantic import BaseModel,
|
|
6
|
+
from pydantic import BaseModel, TypeAdapter, model_validator
|
|
7
7
|
|
|
8
|
-
from openprotein.align import
|
|
8
|
+
from openprotein.align import MSAFuture
|
|
9
9
|
from openprotein.base import APISession
|
|
10
10
|
from openprotein.common import ModelMetadata
|
|
11
|
-
from openprotein.fold.common import
|
|
11
|
+
from openprotein.fold.common import (
|
|
12
|
+
msa_future_to_complex,
|
|
13
|
+
normalize_inputs,
|
|
14
|
+
normalize_templates,
|
|
15
|
+
resolve_templates,
|
|
16
|
+
serialize_input,
|
|
17
|
+
)
|
|
12
18
|
from openprotein.molecules import Complex, Ligand, Protein
|
|
13
19
|
from openprotein.molecules.template import Template
|
|
14
|
-
from openprotein.prompt import PromptAPI
|
|
15
20
|
|
|
16
21
|
from . import api
|
|
17
|
-
from .complex import id_generator
|
|
18
22
|
from .future import FoldResultFuture
|
|
19
23
|
from .models import FoldModel
|
|
20
24
|
|
|
@@ -51,7 +55,7 @@ class BoltzModel(FoldModel):
|
|
|
51
55
|
Parameters
|
|
52
56
|
----------
|
|
53
57
|
sequences : Sequence[Complex | Protein | str | bytes] | MSAFuture
|
|
54
|
-
List of protein
|
|
58
|
+
List of protein complexes to include in folded output. `Protein` objects must be tagged with an `msa`, which can be a `Protein.single_sequence_mode` for single sequence mode. Alternatively, supply an `MSAFuture` to use all query sequences as a multimer.
|
|
55
59
|
diffusion_samples: int
|
|
56
60
|
Number of diffusion samples to use
|
|
57
61
|
num_recycles : int
|
|
@@ -85,9 +89,7 @@ class BoltzModel(FoldModel):
|
|
|
85
89
|
|
|
86
90
|
# build the normalized_models from msa
|
|
87
91
|
if isinstance(sequences, MSAFuture):
|
|
88
|
-
normalized_complexes = [
|
|
89
|
-
_msa_future_to_complex(session=self.session, msa=sequences)
|
|
90
|
-
]
|
|
92
|
+
normalized_complexes = [msa_future_to_complex(self.session, sequences)]
|
|
91
93
|
else:
|
|
92
94
|
normalized_complexes = normalize_inputs(sequences)
|
|
93
95
|
|
|
@@ -135,6 +137,7 @@ class Boltz2Model(BoltzModel, FoldModel):
|
|
|
135
137
|
templates: Sequence[Protein | Complex | Template] | None = None,
|
|
136
138
|
properties: Sequence[Mapping] | None = None,
|
|
137
139
|
method: str | None = None,
|
|
140
|
+
**_,
|
|
138
141
|
) -> FoldResultFuture:
|
|
139
142
|
"""
|
|
140
143
|
Request structure prediction with Boltz-2 model.
|
|
@@ -174,83 +177,14 @@ class Boltz2Model(BoltzModel, FoldModel):
|
|
|
174
177
|
FoldResultFuture
|
|
175
178
|
Future for the folding result.
|
|
176
179
|
"""
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
first_chain_id_to_template = {}
|
|
186
|
-
for batch_idx, seq in enumerate(sequences):
|
|
187
|
-
# validate templates and normalize to complex
|
|
188
|
-
if isinstance(seq, str) or isinstance(seq, bytes):
|
|
189
|
-
seq = Protein(seq)
|
|
190
|
-
seq._assert_valid_templates()
|
|
191
|
-
if isinstance(seq, Protein):
|
|
192
|
-
complex = Complex({"A": seq})
|
|
193
|
-
else:
|
|
194
|
-
complex = seq
|
|
195
|
-
# resolve chain-level templates
|
|
196
|
-
for chain_id, protein in complex.get_proteins().items():
|
|
197
|
-
# Verify same chain_id should have same templates
|
|
198
|
-
if batch_idx == 0:
|
|
199
|
-
first_chain_id_to_template[chain_id] = protein.templates
|
|
200
|
-
for template in protein.templates:
|
|
201
|
-
templates_.append(_to_template(template, chain_id=chain_id))
|
|
202
|
-
elif first_chain_id_to_template[chain_id] != protein.templates:
|
|
203
|
-
raise ValueError(
|
|
204
|
-
"Expected same chain across batches to have the same templates"
|
|
205
|
-
)
|
|
206
|
-
# resolve complex-level templates
|
|
207
|
-
if batch_idx == 0:
|
|
208
|
-
first_templates = complex.templates
|
|
209
|
-
for template in complex.templates:
|
|
210
|
-
templates_.append(_to_template(template))
|
|
211
|
-
elif first_templates != complex.templates:
|
|
212
|
-
raise ValueError(
|
|
213
|
-
"Expected templates across complexes in batch to be the same"
|
|
214
|
-
)
|
|
215
|
-
# method level argument
|
|
216
|
-
if templates is not None:
|
|
217
|
-
if isinstance(sequences, MSAFuture):
|
|
218
|
-
# need to convert to complex for template validation
|
|
219
|
-
sequences = [
|
|
220
|
-
_msa_future_to_complex(session=self.session, msa=sequences)
|
|
221
|
-
]
|
|
222
|
-
for template in templates:
|
|
223
|
-
template = _to_template(template)
|
|
224
|
-
# validate the template for all sequences before accepting it
|
|
225
|
-
for seq in sequences:
|
|
226
|
-
if isinstance(seq, str) or isinstance(seq, bytes):
|
|
227
|
-
seq = Protein(seq)
|
|
228
|
-
template.validate_for_target(seq)
|
|
229
|
-
templates_.append(template)
|
|
230
|
-
|
|
231
|
-
# resolve list of Templates into expected dict arg
|
|
232
|
-
template_dicts: list[dict] = []
|
|
233
|
-
# track resolved queries to reduce network calls - use id() for identity-based caching
|
|
234
|
-
struct_id_to_query_id = {}
|
|
235
|
-
|
|
236
|
-
for template in templates_:
|
|
237
|
-
# Use id() for caching - only resolve each unique structure once
|
|
238
|
-
struct_id = id(template.template)
|
|
239
|
-
if struct_id not in struct_id_to_query_id:
|
|
240
|
-
struct_id_to_query_id[struct_id] = prompt_api._resolve_query(
|
|
241
|
-
query=template.template
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
template_dict = {"query_id": struct_id_to_query_id[struct_id]}
|
|
245
|
-
|
|
246
|
-
if template.mapping is not None:
|
|
247
|
-
if isinstance(template.mapping, str):
|
|
248
|
-
template_dict["chain_id"] = template.mapping
|
|
249
|
-
else:
|
|
250
|
-
template_dict["chain_id"] = list(template.mapping.values())
|
|
251
|
-
template_dict["template_id"] = list(template.mapping.keys())
|
|
252
|
-
|
|
253
|
-
template_dicts.append(template_dict)
|
|
180
|
+
template_dicts = resolve_templates(
|
|
181
|
+
session=self.session,
|
|
182
|
+
templates=normalize_templates(
|
|
183
|
+
session=self.session,
|
|
184
|
+
sequences=sequences,
|
|
185
|
+
templates=templates,
|
|
186
|
+
),
|
|
187
|
+
)
|
|
254
188
|
|
|
255
189
|
# validate properties
|
|
256
190
|
if properties is not None:
|
|
@@ -302,6 +236,7 @@ class Boltz1Model(BoltzModel, FoldModel):
|
|
|
302
236
|
step_scale: float = 1.638,
|
|
303
237
|
use_potentials: bool = False,
|
|
304
238
|
constraints: Sequence[Mapping] | None = None,
|
|
239
|
+
**_,
|
|
305
240
|
) -> FoldResultFuture:
|
|
306
241
|
"""
|
|
307
242
|
Request structure prediction with Boltz-1 model.
|
|
@@ -337,12 +272,12 @@ class Boltz1Model(BoltzModel, FoldModel):
|
|
|
337
272
|
if "pocket" in constraint:
|
|
338
273
|
pocket_constraint = constraint["pocket"]
|
|
339
274
|
if len(pocket_constraints) > 0:
|
|
340
|
-
msg =
|
|
275
|
+
msg = "Only one pocket binders is supported in Boltz-1!"
|
|
341
276
|
raise ValueError(msg)
|
|
342
277
|
|
|
343
278
|
max_distance = constraint["pocket"].get("max_distance", 6.0)
|
|
344
279
|
if max_distance != 6.0:
|
|
345
|
-
msg =
|
|
280
|
+
msg = "Max distance != 6.0 is not supported in Boltz-1!"
|
|
346
281
|
raise ValueError(msg)
|
|
347
282
|
pocket_constraints.append(pocket_constraint)
|
|
348
283
|
|
|
@@ -371,7 +306,9 @@ class Boltz1xModel(Boltz1Model, BoltzModel, FoldModel):
|
|
|
371
306
|
num_recycles: int = 3,
|
|
372
307
|
num_steps: int = 200,
|
|
373
308
|
step_scale: float = 1.638,
|
|
309
|
+
use_potentials: bool = True,
|
|
374
310
|
constraints: Sequence[Mapping] | None = None,
|
|
311
|
+
**_,
|
|
375
312
|
) -> FoldResultFuture:
|
|
376
313
|
"""
|
|
377
314
|
Request structure prediction with Boltz-1x model. Uses potentials with Boltz-1 model.
|
|
@@ -396,6 +333,8 @@ class Boltz1xModel(Boltz1Model, BoltzModel, FoldModel):
|
|
|
396
333
|
FoldResultFuture
|
|
397
334
|
Future for the folding complex result.
|
|
398
335
|
"""
|
|
336
|
+
if not use_potentials:
|
|
337
|
+
raise ValueError("Boltz-1x uses potentials!")
|
|
399
338
|
|
|
400
339
|
return super().fold(
|
|
401
340
|
sequences=sequences,
|
|
@@ -582,21 +521,3 @@ class BoltzAffinity(BaseModel):
|
|
|
582
521
|
|
|
583
522
|
class Config:
|
|
584
523
|
extra = "allow" # Allow extra fields
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
def _msa_future_to_complex(session: APISession, msa: MSAFuture) -> Complex:
|
|
588
|
-
align_api = getattr(session, "align", None)
|
|
589
|
-
assert isinstance(align_api, AlignAPI)
|
|
590
|
-
seed = align_api.get_seed(job_id=msa.job.job_id)
|
|
591
|
-
proteins: dict[str, Protein] = {}
|
|
592
|
-
for chain_id, seq in zip(id_generator(), seed.split(":")):
|
|
593
|
-
protein = Protein(sequence=seq)
|
|
594
|
-
protein.msa = msa.id
|
|
595
|
-
proteins[chain_id] = protein
|
|
596
|
-
return Complex(chains=proteins)
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
def _to_template(obj, chain_id: str | None = None):
|
|
600
|
-
if not isinstance(obj, Template):
|
|
601
|
-
obj = Template(template=obj, mapping=chain_id)
|
|
602
|
-
return obj
|