openprotein-python 0.8.5__tar.gz → 0.8.6__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.8.5 → openprotein_python-0.8.6}/PKG-INFO +1 -1
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/common/model_metadata.py +1 -1
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/alphafold2.py +7 -4
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/future.py +57 -33
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/.gitignore +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/LICENSE.txt +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/README.md +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/_version.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/align/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/align/align.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/align/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/align/future.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/align/msa.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/align/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/base.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/chains.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/common/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/common/features.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/common/reduction.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/config.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/csv.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/data/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/data/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/data/assaydataset.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/data/data.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/data/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/design/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/design/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/design/design.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/design/future.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/design/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/embeddings.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/esm.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/future.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/openprotein.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/poet.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/poet2.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/embeddings/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/errors.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fasta.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/boltz.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/esmfold.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/fold.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/fold/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/jobs/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/jobs/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/jobs/futures.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/jobs/jobs.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/jobs/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/models/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/models/base.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/models/foundation/rfdiffusion.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/models/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/prediction.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/predictor.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/predictor/validate.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/prompt/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/prompt/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/prompt/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/prompt/prompt.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/prompt/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/protein.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/svd/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/svd/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/svd/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/svd/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/svd/svd.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/umap/__init__.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/umap/api.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/umap/models.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/umap/schemas.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/umap/umap.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/utils/uuid.py +0 -0
- {openprotein_python-0.8.5 → openprotein_python-0.8.6}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openprotein-python
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.6
|
|
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
|
|
@@ -28,6 +28,6 @@ class ModelMetadata(BaseModel):
|
|
|
28
28
|
max_sequence_length: int | None = None
|
|
29
29
|
dimension: int
|
|
30
30
|
output_types: list[str]
|
|
31
|
-
input_tokens: list[str]
|
|
31
|
+
input_tokens: list[str] | None
|
|
32
32
|
output_tokens: list[str] | None = None
|
|
33
33
|
token_descriptions: list[list[TokenInfo]]
|
|
@@ -47,10 +47,8 @@ class AlphaFold2Model(FoldModel):
|
|
|
47
47
|
number of times to recycle models
|
|
48
48
|
num_models : int
|
|
49
49
|
number of models to train - best model will be used
|
|
50
|
-
|
|
51
|
-
maximum number of
|
|
52
|
-
relax_max_iterations : int
|
|
53
|
-
maximum number of iterations
|
|
50
|
+
num_relax : int
|
|
51
|
+
maximum number of iterations for relax
|
|
54
52
|
|
|
55
53
|
Returns
|
|
56
54
|
-------
|
|
@@ -61,6 +59,7 @@ class AlphaFold2Model(FoldModel):
|
|
|
61
59
|
"Inputs to AlphaFold 2 have been updated. 'msa' should be supplied as 'proteins' argument. Support will be dropped in the future."
|
|
62
60
|
)
|
|
63
61
|
proteins = kwargs["msa"]
|
|
62
|
+
assert isinstance(proteins, MSAFuture), "Expected msa to be an MSAFuture"
|
|
64
63
|
if "ligands" in kwargs or "dnas" in kwargs or "rnas" in kwargs:
|
|
65
64
|
with warnings.catch_warnings():
|
|
66
65
|
warnings.simplefilter("always") # Force warning to always show
|
|
@@ -73,6 +72,10 @@ class AlphaFold2Model(FoldModel):
|
|
|
73
72
|
msa_to_seed: dict[str, Counter] = dict()
|
|
74
73
|
for protein in proteins:
|
|
75
74
|
if (msa := protein.msa) is not None:
|
|
75
|
+
if isinstance(msa, Protein.NullMSA):
|
|
76
|
+
raise ValueError(
|
|
77
|
+
"AlphaFold 2 expects MSA and does not support single sequence mode"
|
|
78
|
+
)
|
|
76
79
|
msa_id = msa.id if isinstance(msa, MSAFuture) else msa
|
|
77
80
|
if msa_id in msa_to_seed:
|
|
78
81
|
seeds = msa_to_seed[msa_id]
|
|
@@ -9,11 +9,11 @@ from typing_extensions import Self
|
|
|
9
9
|
from openprotein import config
|
|
10
10
|
from openprotein.base import APISession
|
|
11
11
|
from openprotein.chains import DNA, RNA, Ligand
|
|
12
|
-
from openprotein.jobs import Future, MappedFuture
|
|
12
|
+
from openprotein.jobs import Future, JobsAPI, MappedFuture
|
|
13
13
|
from openprotein.protein import Protein
|
|
14
14
|
|
|
15
15
|
from . import api
|
|
16
|
-
from .schemas import FoldJob
|
|
16
|
+
from .schemas import FoldJob, FoldMetadata
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
19
|
from .boltz import BoltzAffinity, BoltzConfidence
|
|
@@ -34,34 +34,39 @@ class FoldResultFuture(MappedFuture, Future):
|
|
|
34
34
|
def __init__(
|
|
35
35
|
self,
|
|
36
36
|
session: APISession,
|
|
37
|
-
job: FoldJob,
|
|
37
|
+
job: FoldJob | None = None,
|
|
38
|
+
metadata: FoldMetadata | None = None,
|
|
38
39
|
sequences: list[bytes] | None = None,
|
|
39
40
|
max_workers: int = config.MAX_CONCURRENT_WORKERS,
|
|
40
41
|
):
|
|
41
42
|
"""
|
|
42
43
|
Initialize a FoldResultFuture instance.
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
The API session to use for requests.
|
|
48
|
-
job : FoldJob
|
|
49
|
-
The fold job associated with this future.
|
|
50
|
-
sequences : list[bytes], optional
|
|
51
|
-
List of sequences submitted for the fold request. If None, sequences will be fetched.
|
|
52
|
-
max_workers : int, optional
|
|
53
|
-
Maximum number of concurrent workers. Default is config.MAX_CONCURRENT_WORKERS.
|
|
45
|
+
Takes in either a fold job, or the fold job metadata.
|
|
46
|
+
|
|
47
|
+
:meta private:
|
|
54
48
|
"""
|
|
55
|
-
|
|
49
|
+
# initialize the fold job metadata
|
|
50
|
+
if metadata is None:
|
|
51
|
+
if job is None or job.job_id is None:
|
|
52
|
+
raise ValueError("Expected fold metadata or job")
|
|
53
|
+
metadata = api.fold_get(session, job.job_id)
|
|
54
|
+
self._metadata = metadata
|
|
55
|
+
if job is None:
|
|
56
|
+
jobs_api = getattr(session, "jobs", None)
|
|
57
|
+
assert isinstance(jobs_api, JobsAPI)
|
|
58
|
+
job = FoldJob.create(jobs_api.get_job(job_id=metadata.job_id))
|
|
56
59
|
if sequences is None:
|
|
57
60
|
sequences = api.fold_get_sequences(self.session, job_id=job.job_id)
|
|
58
61
|
self._sequences = sequences
|
|
62
|
+
super().__init__(session, job, max_workers)
|
|
59
63
|
|
|
60
64
|
@classmethod
|
|
61
65
|
def create(
|
|
62
66
|
cls: type[Self],
|
|
63
67
|
session: APISession,
|
|
64
|
-
job: FoldJob,
|
|
68
|
+
job: FoldJob | None = None,
|
|
69
|
+
metadata: FoldMetadata | None = None,
|
|
65
70
|
**kwargs,
|
|
66
71
|
) -> "Self | FoldComplexResultFuture":
|
|
67
72
|
"""
|
|
@@ -81,7 +86,13 @@ class FoldResultFuture(MappedFuture, Future):
|
|
|
81
86
|
FoldResultFuture or FoldComplexResultFuture
|
|
82
87
|
An instance of FoldResultFuture or FoldComplexResultFuture depending on the model.
|
|
83
88
|
"""
|
|
84
|
-
|
|
89
|
+
if job is not None:
|
|
90
|
+
job_id = job.job_id
|
|
91
|
+
elif metadata is not None:
|
|
92
|
+
job_id = metadata.job_id
|
|
93
|
+
else:
|
|
94
|
+
raise ValueError("Expected fold metadata or job")
|
|
95
|
+
model_id = api.fold_get(session=session, job_id=job_id).model_id
|
|
85
96
|
if model_id.startswith("boltz") or model_id.startswith("alphafold"):
|
|
86
97
|
return FoldComplexResultFuture(session=session, job=job, **kwargs)
|
|
87
98
|
else:
|
|
@@ -101,22 +112,6 @@ class FoldResultFuture(MappedFuture, Future):
|
|
|
101
112
|
self._sequences = api.fold_get_sequences(self.session, self.job.job_id)
|
|
102
113
|
return self._sequences
|
|
103
114
|
|
|
104
|
-
@property
|
|
105
|
-
def model_id(self) -> str:
|
|
106
|
-
"""
|
|
107
|
-
Get the model ID used for the fold request.
|
|
108
|
-
|
|
109
|
-
Returns
|
|
110
|
-
-------
|
|
111
|
-
str
|
|
112
|
-
Model ID.
|
|
113
|
-
"""
|
|
114
|
-
if self._model_id is None:
|
|
115
|
-
self._model_id = api.fold_get(
|
|
116
|
-
session=self.session, job_id=self.job.job_id
|
|
117
|
-
).model_id
|
|
118
|
-
return self._model_id
|
|
119
|
-
|
|
120
115
|
@property
|
|
121
116
|
def id(self):
|
|
122
117
|
"""
|
|
@@ -129,6 +124,17 @@ class FoldResultFuture(MappedFuture, Future):
|
|
|
129
124
|
"""
|
|
130
125
|
return self.job.job_id
|
|
131
126
|
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def metadata(self) -> FoldMetadata:
|
|
130
|
+
"""The fold metadata."""
|
|
131
|
+
return self._metadata
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def model_id(self) -> str:
|
|
135
|
+
"""The fold model used."""
|
|
136
|
+
return self._metadata.model_id
|
|
137
|
+
|
|
132
138
|
def __keys__(self):
|
|
133
139
|
"""
|
|
134
140
|
Get the list of sequences submitted for the fold request.
|
|
@@ -189,7 +195,8 @@ class FoldComplexResultFuture(Future):
|
|
|
189
195
|
def __init__(
|
|
190
196
|
self,
|
|
191
197
|
session: APISession,
|
|
192
|
-
job: FoldJob,
|
|
198
|
+
job: FoldJob | None = None,
|
|
199
|
+
metadata: FoldMetadata | None = None,
|
|
193
200
|
model_id: str | None = None,
|
|
194
201
|
proteins: list[Protein] | None = None,
|
|
195
202
|
ligands: list[Ligand] | None = None,
|
|
@@ -216,6 +223,16 @@ class FoldComplexResultFuture(Future):
|
|
|
216
223
|
rnas : list[RNA], optional
|
|
217
224
|
List of RNAs submitted for fold request.
|
|
218
225
|
"""
|
|
226
|
+
# initialize the fold job metadata
|
|
227
|
+
if metadata is None:
|
|
228
|
+
if job is None or job.job_id is None:
|
|
229
|
+
raise ValueError("Expected fold metadata or job")
|
|
230
|
+
metadata = api.fold_get(session, job.job_id)
|
|
231
|
+
self._metadata = metadata
|
|
232
|
+
if job is None:
|
|
233
|
+
jobs_api = getattr(session, "jobs", None)
|
|
234
|
+
assert isinstance(jobs_api, JobsAPI)
|
|
235
|
+
job = FoldJob.create(jobs_api.get_job(job_id=metadata.job_id))
|
|
219
236
|
super().__init__(session, job)
|
|
220
237
|
self._model_id = model_id
|
|
221
238
|
self._proteins = proteins
|
|
@@ -229,6 +246,11 @@ class FoldComplexResultFuture(Future):
|
|
|
229
246
|
self._confidence: list["BoltzConfidence"] | None = None
|
|
230
247
|
self._affinity: "BoltzAffinity | None" = None
|
|
231
248
|
|
|
249
|
+
@property
|
|
250
|
+
def metadata(self) -> FoldMetadata:
|
|
251
|
+
"""The fold metadata."""
|
|
252
|
+
return self._metadata
|
|
253
|
+
|
|
232
254
|
@property
|
|
233
255
|
def model_id(self) -> str:
|
|
234
256
|
"""
|
|
@@ -433,6 +455,8 @@ class FoldComplexResultFuture(Future):
|
|
|
433
455
|
AttributeError
|
|
434
456
|
If confidence is not supported for the model.
|
|
435
457
|
"""
|
|
458
|
+
from .boltz import BoltzConfidence
|
|
459
|
+
|
|
436
460
|
if self.model_id not in {"boltz-1", "boltz-1x", "boltz-2"}:
|
|
437
461
|
raise AttributeError("confidence not supported for non-Boltz model")
|
|
438
462
|
if self._confidence is None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openprotein_python-0.8.5 → openprotein_python-0.8.6}/openprotein/models/foundation/rfdiffusion.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|