openprotein-python 0.12.0__tar.gz → 0.13.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.12.0 → openprotein_python-0.13.0}/PKG-INFO +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/align/align.py +22 -3
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/align/api.py +9 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/align/msa.py +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/align/schemas.py +18 -1
- openprotein_python-0.13.0/openprotein/api/__init__.py +9 -0
- openprotein_python-0.13.0/openprotein/api/align.py +400 -0
- openprotein_python-0.13.0/openprotein/api/assaydata.py +216 -0
- openprotein_python-0.13.0/openprotein/api/deprecated/__init__.py +5 -0
- openprotein_python-0.13.0/openprotein/api/deprecated/design.py +86 -0
- openprotein_python-0.13.0/openprotein/api/deprecated/poet.py +308 -0
- openprotein_python-0.13.0/openprotein/api/deprecated/predict.py +276 -0
- openprotein_python-0.13.0/openprotein/api/deprecated/train.py +224 -0
- openprotein_python-0.13.0/openprotein/api/design.py +86 -0
- openprotein_python-0.13.0/openprotein/api/designer.py +267 -0
- openprotein_python-0.13.0/openprotein/api/embedding.py +446 -0
- openprotein_python-0.13.0/openprotein/api/error.py +5 -0
- openprotein_python-0.13.0/openprotein/api/fold.py +157 -0
- openprotein_python-0.13.0/openprotein/api/job.py +94 -0
- openprotein_python-0.13.0/openprotein/api/predict.py +273 -0
- openprotein_python-0.13.0/openprotein/api/predictor.py +326 -0
- openprotein_python-0.13.0/openprotein/api/prompt.py +464 -0
- openprotein_python-0.13.0/openprotein/api/svd.py +203 -0
- openprotein_python-0.13.0/openprotein/api/train.py +222 -0
- openprotein_python-0.13.0/openprotein/api/umap.py +257 -0
- openprotein_python-0.13.0/openprotein/app/__init__.py +19 -0
- openprotein_python-0.13.0/openprotein/app/deprecated.py +8 -0
- openprotein_python-0.13.0/openprotein/app/models/__init__.py +33 -0
- openprotein_python-0.13.0/openprotein/app/models/align/__init__.py +4 -0
- openprotein_python-0.13.0/openprotein/app/models/align/base.py +20 -0
- openprotein_python-0.13.0/openprotein/app/models/align/msa.py +134 -0
- openprotein_python-0.13.0/openprotein/app/models/align/prompt.py +78 -0
- openprotein_python-0.13.0/openprotein/app/models/assaydata.py +176 -0
- openprotein_python-0.13.0/openprotein/app/models/deprecated/__init__.py +10 -0
- openprotein_python-0.13.0/openprotein/app/models/deprecated/design.py +109 -0
- openprotein_python-0.13.0/openprotein/app/models/deprecated/poet.py +204 -0
- openprotein_python-0.13.0/openprotein/app/models/deprecated/predict.py +232 -0
- openprotein_python-0.13.0/openprotein/app/models/deprecated/train.py +307 -0
- openprotein_python-0.13.0/openprotein/app/models/design.py +105 -0
- openprotein_python-0.13.0/openprotein/app/models/designer.py +143 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/__init__.py +12 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/base.py +337 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/esm.py +32 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/future.py +135 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/openprotein.py +21 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/poet.py +366 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/poet2.py +385 -0
- openprotein_python-0.13.0/openprotein/app/models/embeddings/test.py +38 -0
- openprotein_python-0.13.0/openprotein/app/models/fold/__init__.py +6 -0
- openprotein_python-0.13.0/openprotein/app/models/fold/alphafold2.py +54 -0
- openprotein_python-0.13.0/openprotein/app/models/fold/base.py +81 -0
- openprotein_python-0.13.0/openprotein/app/models/fold/boltz.py +57 -0
- openprotein_python-0.13.0/openprotein/app/models/fold/esmfold.py +38 -0
- openprotein_python-0.13.0/openprotein/app/models/fold/future.py +56 -0
- openprotein_python-0.13.0/openprotein/app/models/futures.py +473 -0
- openprotein_python-0.13.0/openprotein/app/models/predict.py +246 -0
- openprotein_python-0.13.0/openprotein/app/models/predictor/__init__.py +4 -0
- openprotein_python-0.13.0/openprotein/app/models/predictor/predict.py +78 -0
- openprotein_python-0.13.0/openprotein/app/models/predictor/predictor.py +362 -0
- openprotein_python-0.13.0/openprotein/app/models/predictor/validate.py +37 -0
- openprotein_python-0.13.0/openprotein/app/models/prompt.py +141 -0
- openprotein_python-0.13.0/openprotein/app/models/svd.py +260 -0
- openprotein_python-0.13.0/openprotein/app/models/train.py +303 -0
- openprotein_python-0.13.0/openprotein/app/models/umap.py +156 -0
- openprotein_python-0.13.0/openprotein/app/services/__init__.py +16 -0
- openprotein_python-0.13.0/openprotein/app/services/align.py +356 -0
- openprotein_python-0.13.0/openprotein/app/services/assaydata.py +119 -0
- openprotein_python-0.13.0/openprotein/app/services/deprecated/__init__.py +9 -0
- openprotein_python-0.13.0/openprotein/app/services/deprecated/design.py +79 -0
- openprotein_python-0.13.0/openprotein/app/services/deprecated/predict.py +152 -0
- openprotein_python-0.13.0/openprotein/app/services/deprecated/train.py +140 -0
- openprotein_python-0.13.0/openprotein/app/services/design.py +79 -0
- openprotein_python-0.13.0/openprotein/app/services/designer.py +107 -0
- openprotein_python-0.13.0/openprotein/app/services/embeddings.py +137 -0
- openprotein_python-0.13.0/openprotein/app/services/fold.py +89 -0
- openprotein_python-0.13.0/openprotein/app/services/job.py +61 -0
- openprotein_python-0.13.0/openprotein/app/services/predict.py +145 -0
- openprotein_python-0.13.0/openprotein/app/services/predictor.py +192 -0
- openprotein_python-0.13.0/openprotein/app/services/prompt.py +133 -0
- openprotein_python-0.13.0/openprotein/app/services/svd.py +102 -0
- openprotein_python-0.13.0/openprotein/app/services/train.py +135 -0
- openprotein_python-0.13.0/openprotein/app/services/umap.py +97 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/base.py +17 -8
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/design/schemas.py +16 -2
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/api.py +11 -3
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/embeddings.py +5 -2
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/future.py +36 -23
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/models.py +5 -2
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/errors.py +22 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/__init__.py +2 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/api.py +91 -6
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/common.py +15 -8
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/future.py +166 -8
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/protenix.py +60 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/jobs/api.py +12 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/jobs/futures.py +15 -3
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/jobs/jobs.py +16 -3
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/jobs/schemas.py +1 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/structure_generation.py +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/molecules/complex.py +55 -5
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/molecules/template.py +15 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/models.py +2 -2
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/prediction.py +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/validate.py +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/prompt/models.py +11 -4
- openprotein_python-0.13.0/openprotein/schemas/__init__.py +74 -0
- openprotein_python-0.13.0/openprotein/schemas/align.py +61 -0
- openprotein_python-0.13.0/openprotein/schemas/assaydata.py +27 -0
- openprotein_python-0.13.0/openprotein/schemas/deprecated/__init__.py +21 -0
- openprotein_python-0.13.0/openprotein/schemas/deprecated/design.py +173 -0
- openprotein_python-0.13.0/openprotein/schemas/deprecated/poet.py +70 -0
- openprotein_python-0.13.0/openprotein/schemas/deprecated/predict.py +82 -0
- openprotein_python-0.13.0/openprotein/schemas/deprecated/train.py +34 -0
- openprotein_python-0.13.0/openprotein/schemas/design.py +202 -0
- openprotein_python-0.13.0/openprotein/schemas/designer.py +38 -0
- openprotein_python-0.13.0/openprotein/schemas/embeddings.py +102 -0
- openprotein_python-0.13.0/openprotein/schemas/features.py +7 -0
- openprotein_python-0.13.0/openprotein/schemas/fold.py +10 -0
- openprotein_python-0.13.0/openprotein/schemas/job.py +134 -0
- openprotein_python-0.13.0/openprotein/schemas/predict.py +82 -0
- openprotein_python-0.13.0/openprotein/schemas/predictor.py +96 -0
- openprotein_python-0.13.0/openprotein/schemas/prompt.py +28 -0
- openprotein_python-0.13.0/openprotein/schemas/svd.py +31 -0
- openprotein_python-0.13.0/openprotein/schemas/train.py +34 -0
- openprotein_python-0.13.0/openprotein/schemas/umap.py +35 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/svd/api.py +12 -3
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/svd/models.py +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/svd/svd.py +13 -2
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/umap/api.py +11 -2
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/umap/models.py +1 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/umap/umap.py +12 -3
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/utils/chain_id.py +3 -5
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/pyproject.toml +9 -1
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/.gitignore +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/LICENSE.txt +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/README.md +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/_version.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/align/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/align/future.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/chains.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/common/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/common/features.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/common/model_metadata.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/common/reduction.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/common/residue_contants.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/config.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/csv.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/data/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/data/api.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/data/assaydataset.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/data/data.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/data/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/design/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/design/api.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/design/design.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/design/future.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/ablang.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/esm.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/openprotein.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/poet.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/poet2.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/embeddings/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fasta.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/alphafold2.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/boltz.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/complex.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/esmfold.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/fold.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/minifold.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/models.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/rosettafold3.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/fold/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/jobs/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/base.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/foundation/boltzgen.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/foundation/boltzgen_schema.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/foundation/proteinmpnn.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/foundation/rfdiffusion.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/models/models.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/molecules/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/molecules/chains.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/molecules/protein.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/molecules/structure.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/api.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/predictor.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/predictor/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/prompt/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/prompt/api.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/prompt/prompt.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/prompt/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/protein.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/scaffolds.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/svd/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/svd/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/umap/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/umap/schemas.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/utils/__init__.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/utils/cif.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/utils/numpy.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.0}/openprotein/utils/sequence.py +0 -0
- {openprotein_python-0.12.0 → openprotein_python-0.13.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.13.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
|
|
@@ -189,6 +189,7 @@ class AlignAPI:
|
|
|
189
189
|
sequences: Sequence[bytes | str],
|
|
190
190
|
names: Sequence[str] | None = None,
|
|
191
191
|
scheme: AbNumberScheme = AbNumberScheme.CHOTHIA,
|
|
192
|
+
drop_minority_chains: bool = False,
|
|
192
193
|
) -> MSAFuture:
|
|
193
194
|
"""
|
|
194
195
|
Align antibody sequences using `AbNumber`.
|
|
@@ -205,6 +206,10 @@ class AlignAPI:
|
|
|
205
206
|
Optional list of sequence names, must be the same length as sequences if provided.
|
|
206
207
|
scheme : AbNumberScheme, default=AbNumberScheme.CHOTHIA
|
|
207
208
|
Antibody numbering scheme.
|
|
209
|
+
drop_minority_chains : bool, default=False
|
|
210
|
+
If True, drop sequences belonging to chain types that are in the
|
|
211
|
+
minority (e.g. heavy vs light) so the resulting alignment contains
|
|
212
|
+
only the dominant chain type.
|
|
208
213
|
|
|
209
214
|
Returns
|
|
210
215
|
-------
|
|
@@ -235,10 +240,15 @@ class AlignAPI:
|
|
|
235
240
|
lines.append(sequence)
|
|
236
241
|
content = b"\n".join(lines)
|
|
237
242
|
stream = BytesIO(content)
|
|
238
|
-
return self.abnumber_file(
|
|
243
|
+
return self.abnumber_file(
|
|
244
|
+
stream, scheme=scheme, drop_minority_chains=drop_minority_chains
|
|
245
|
+
)
|
|
239
246
|
|
|
240
247
|
def abnumber_file(
|
|
241
|
-
self,
|
|
248
|
+
self,
|
|
249
|
+
file,
|
|
250
|
+
scheme: AbNumberScheme = AbNumberScheme.CHOTHIA,
|
|
251
|
+
drop_minority_chains: bool = False,
|
|
242
252
|
) -> MSAFuture:
|
|
243
253
|
"""
|
|
244
254
|
Align antibody sequences using `AbNumber`.
|
|
@@ -253,13 +263,22 @@ class AlignAPI:
|
|
|
253
263
|
Sequences to align in FASTA or CSV format.
|
|
254
264
|
scheme : AbNumberScheme, default=AbNumberScheme.CHOTHIA
|
|
255
265
|
Antibody numbering scheme.
|
|
266
|
+
drop_minority_chains : bool, default=False
|
|
267
|
+
If True, drop sequences belonging to chain types that are in the
|
|
268
|
+
minority (e.g. heavy vs light) so the resulting alignment contains
|
|
269
|
+
only the dominant chain type.
|
|
256
270
|
|
|
257
271
|
Returns
|
|
258
272
|
-------
|
|
259
273
|
MSAFuture
|
|
260
274
|
Future object awaiting the contents of the MSA upload.
|
|
261
275
|
"""
|
|
262
|
-
job = api.abnumber_post(
|
|
276
|
+
job = api.abnumber_post(
|
|
277
|
+
self.session,
|
|
278
|
+
file,
|
|
279
|
+
scheme=scheme,
|
|
280
|
+
drop_minority_chains=drop_minority_chains,
|
|
281
|
+
)
|
|
263
282
|
return MSAFuture.create(session=self.session, job=job)
|
|
264
283
|
|
|
265
284
|
def upload_msa(self, msa_file: BinaryIO) -> MSAFuture:
|
|
@@ -269,6 +269,7 @@ def abnumber_post(
|
|
|
269
269
|
session: APISession,
|
|
270
270
|
sequence_file: BinaryIO,
|
|
271
271
|
scheme: AbNumberScheme | str = AbNumberScheme.IMGT,
|
|
272
|
+
drop_minority_chains: bool = False,
|
|
272
273
|
) -> Job:
|
|
273
274
|
"""
|
|
274
275
|
Align antibody sequences using AbNumber.
|
|
@@ -284,6 +285,10 @@ def abnumber_post(
|
|
|
284
285
|
Sequences to align in FASTA or CSV format.
|
|
285
286
|
scheme : AbNumberScheme, optional
|
|
286
287
|
Antibody numbering scheme. Default is IMGT.
|
|
288
|
+
drop_minority_chains : bool, optional
|
|
289
|
+
If True, drop sequences belonging to chain types that are in the
|
|
290
|
+
minority (e.g. heavy vs light) so the resulting alignment contains
|
|
291
|
+
only the dominant chain type. Default is False.
|
|
287
292
|
|
|
288
293
|
Returns
|
|
289
294
|
-------
|
|
@@ -297,7 +302,10 @@ def abnumber_post(
|
|
|
297
302
|
raise InvalidParameterError(f"Antibody numbering {scheme} not recognized")
|
|
298
303
|
|
|
299
304
|
files = {"file": sequence_file}
|
|
300
|
-
params = {
|
|
305
|
+
params = {
|
|
306
|
+
"scheme": scheme if isinstance(scheme, str) else scheme.value,
|
|
307
|
+
"drop_minority_chains": drop_minority_chains,
|
|
308
|
+
}
|
|
301
309
|
|
|
302
310
|
response = session.post(endpoint, files=files, params=params)
|
|
303
311
|
return Job.model_validate(response.json())
|
|
@@ -45,7 +45,7 @@ class MSAFuture(AlignFuture, Future):
|
|
|
45
45
|
self.page_size = page_size
|
|
46
46
|
self.msa_id = self.job.job_id
|
|
47
47
|
|
|
48
|
-
def
|
|
48
|
+
def _get(self, verbose: bool = False) -> Iterator[tuple[str, str]]:
|
|
49
49
|
"""
|
|
50
50
|
Retrieve the MSA of the job.
|
|
51
51
|
|
|
@@ -157,7 +157,24 @@ class AbNumberJob(MSAJob, Job):
|
|
|
157
157
|
|
|
158
158
|
|
|
159
159
|
class AbNumberScheme(str, Enum):
|
|
160
|
-
"""
|
|
160
|
+
"""
|
|
161
|
+
Antibody numbering scheme.
|
|
162
|
+
|
|
163
|
+
Attributes
|
|
164
|
+
----------
|
|
165
|
+
IMGT : str
|
|
166
|
+
IMGT numbering scheme, a standardized system unifying numbering across
|
|
167
|
+
all immunoglobulin and T-cell receptor variable domains.
|
|
168
|
+
CHOTHIA : str
|
|
169
|
+
Chothia numbering scheme, based on the structural location of
|
|
170
|
+
canonical loops in antibody variable domains.
|
|
171
|
+
KABAT : str
|
|
172
|
+
Kabat numbering scheme, based on sequence variability across
|
|
173
|
+
antibody variable domains.
|
|
174
|
+
AHO : str
|
|
175
|
+
AHo numbering scheme, a structure-based unified numbering scheme
|
|
176
|
+
for antibody variable domains.
|
|
177
|
+
"""
|
|
161
178
|
|
|
162
179
|
IMGT = "imgt"
|
|
163
180
|
CHOTHIA = "chothia"
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import random
|
|
3
|
+
from typing import BinaryIO, Iterator
|
|
4
|
+
|
|
5
|
+
import requests
|
|
6
|
+
|
|
7
|
+
import openprotein.config as config
|
|
8
|
+
from openprotein.base import APISession
|
|
9
|
+
from openprotein.csv import csv_stream
|
|
10
|
+
from openprotein.errors import APIError, InvalidParameterError, MissingParameterError
|
|
11
|
+
from openprotein.schemas import AlignType, Job, MSASamplingMethod
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def get_align_job_inputs(
|
|
15
|
+
session: APISession,
|
|
16
|
+
job_id: str,
|
|
17
|
+
input_type: AlignType,
|
|
18
|
+
prompt_index: int | None = None,
|
|
19
|
+
) -> requests.Response:
|
|
20
|
+
"""
|
|
21
|
+
Get MSA and related data for an align job.
|
|
22
|
+
|
|
23
|
+
Returns either the original user seed (RAW), the generated MSA or the prompt.
|
|
24
|
+
|
|
25
|
+
Specify prompt_index to retreive the specific prompt for each replicate when input_type is PROMPT.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
session : APISession
|
|
30
|
+
The API session.
|
|
31
|
+
job_id : int or str
|
|
32
|
+
The job identifier.
|
|
33
|
+
input_type : PoetInputType
|
|
34
|
+
The type of MSA data.
|
|
35
|
+
prompt_index : Optional[int]
|
|
36
|
+
The replicate number for the prompt (input_type=-PROMPT only)
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
requests.Response
|
|
41
|
+
The response from the server.
|
|
42
|
+
"""
|
|
43
|
+
endpoint = "v1/align/inputs"
|
|
44
|
+
|
|
45
|
+
params = {"job_id": job_id, "msa_type": input_type}
|
|
46
|
+
if prompt_index is not None:
|
|
47
|
+
params["replicate"] = prompt_index
|
|
48
|
+
|
|
49
|
+
response = session.get(endpoint, params=params, stream=True)
|
|
50
|
+
return response
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def get_input(
|
|
54
|
+
session: APISession,
|
|
55
|
+
job: Job,
|
|
56
|
+
input_type: AlignType,
|
|
57
|
+
prompt_index: int | None = None,
|
|
58
|
+
) -> Iterator[list[str]]:
|
|
59
|
+
"""
|
|
60
|
+
Get input data for a given job.
|
|
61
|
+
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
session : APISession
|
|
65
|
+
The API session.
|
|
66
|
+
job : Job
|
|
67
|
+
The job for which to retrieve data.
|
|
68
|
+
input_type : PoetInputType
|
|
69
|
+
The type of MSA data.
|
|
70
|
+
prompt_index : Optional[int]
|
|
71
|
+
The replicate number for the prompt (input_type=-PROMPT only)
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
csv.reader
|
|
76
|
+
A CSV reader for the response data.
|
|
77
|
+
"""
|
|
78
|
+
job_id = job.job_id
|
|
79
|
+
response = get_align_job_inputs(
|
|
80
|
+
session=session, job_id=job_id, input_type=input_type, prompt_index=prompt_index
|
|
81
|
+
)
|
|
82
|
+
return csv_stream(response)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_seed(session: APISession, job: Job) -> Iterator[list[str]]:
|
|
86
|
+
"""
|
|
87
|
+
Get the seed for a given MSA job.
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
session : APISession
|
|
92
|
+
The API session.
|
|
93
|
+
job : Job
|
|
94
|
+
The job for which to retrieve the seed.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
Iterator[list[str]]
|
|
99
|
+
A CSV reader for the seed sequence.
|
|
100
|
+
"""
|
|
101
|
+
return get_input(session=session, job=job, input_type=AlignType.INPUT)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def get_msa(session: APISession, job: Job) -> Iterator[list[str]]:
|
|
105
|
+
"""
|
|
106
|
+
Get the generated MSA (Multiple Sequence Alignment) for a given job.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
session : APISession
|
|
111
|
+
The API session.
|
|
112
|
+
job : Job
|
|
113
|
+
The job for which to retrieve the MSA.
|
|
114
|
+
|
|
115
|
+
Returns
|
|
116
|
+
-------
|
|
117
|
+
Iterator[list[str]]
|
|
118
|
+
A CSV reader for the MSA data.
|
|
119
|
+
"""
|
|
120
|
+
return get_input(session=session, job=job, input_type=AlignType.MSA)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def msa_post(
|
|
124
|
+
session: APISession,
|
|
125
|
+
msa_file: BinaryIO | None = None,
|
|
126
|
+
seed: str | bytes | None = None,
|
|
127
|
+
) -> Job:
|
|
128
|
+
"""
|
|
129
|
+
Create an MSA.
|
|
130
|
+
|
|
131
|
+
Either via a seed sequence (which will trigger MSA creation) or a ready-to-use MSA (via msa_file).
|
|
132
|
+
|
|
133
|
+
Note that seed and msa_file are mutually exclusive, and one or the other must be set.
|
|
134
|
+
|
|
135
|
+
Parameters
|
|
136
|
+
----------
|
|
137
|
+
session : APISession
|
|
138
|
+
|
|
139
|
+
msa_file : BinaryIO, Optional
|
|
140
|
+
Ready-made MSA file. Defaults to None.
|
|
141
|
+
seed : str | bytes, optional
|
|
142
|
+
Seed sequence to trigger MSA job. Defaults to None.
|
|
143
|
+
|
|
144
|
+
Raises
|
|
145
|
+
------
|
|
146
|
+
Exception
|
|
147
|
+
If msa_file and seed are both None.
|
|
148
|
+
|
|
149
|
+
Returns
|
|
150
|
+
-------
|
|
151
|
+
Job
|
|
152
|
+
Job details.
|
|
153
|
+
"""
|
|
154
|
+
if (msa_file is None and seed is None) or (
|
|
155
|
+
msa_file is not None and seed is not None
|
|
156
|
+
):
|
|
157
|
+
raise MissingParameterError("seed OR msa_file must be provided.")
|
|
158
|
+
endpoint = "v1/align/msa"
|
|
159
|
+
|
|
160
|
+
is_seed = False
|
|
161
|
+
if seed is not None:
|
|
162
|
+
seed = seed.encode() if isinstance(seed, str) else seed
|
|
163
|
+
msa_file = io.BytesIO(b"\n".join([b">seed", seed]))
|
|
164
|
+
is_seed = True
|
|
165
|
+
|
|
166
|
+
params = {"is_seed": is_seed}
|
|
167
|
+
files = {"msa_file": msa_file}
|
|
168
|
+
|
|
169
|
+
response = session.post(endpoint, files=files, params=params)
|
|
170
|
+
return Job.model_validate(response.json())
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# TODO - document the `ep` and `op` parameters
|
|
174
|
+
def mafft_post(
|
|
175
|
+
session: APISession,
|
|
176
|
+
sequence_file: BinaryIO,
|
|
177
|
+
auto: bool = True,
|
|
178
|
+
ep: float | None = None,
|
|
179
|
+
op: float | None = None,
|
|
180
|
+
) -> Job:
|
|
181
|
+
"""
|
|
182
|
+
Align sequences using the `mafft` algorithm. Sequences can be provided as `fasta` or `csv` formats. If `csv`, the file must be headerless with either a single sequence column or name, sequence columns.
|
|
183
|
+
|
|
184
|
+
Set auto to True to automatically attempt the best params. Leave a parameter as None to use system defaults.
|
|
185
|
+
|
|
186
|
+
Parameters
|
|
187
|
+
----------
|
|
188
|
+
session : APISession
|
|
189
|
+
sequence_file : BinaryIO
|
|
190
|
+
Sequences to align in fasta or csv format.
|
|
191
|
+
auto : bool = True, optional
|
|
192
|
+
Set to true to automatically set algorithm parameters.
|
|
193
|
+
ep : float, optional
|
|
194
|
+
mafft parameter
|
|
195
|
+
op : float, optional
|
|
196
|
+
mafft parameter
|
|
197
|
+
|
|
198
|
+
Returns
|
|
199
|
+
-------
|
|
200
|
+
Job
|
|
201
|
+
Job details.
|
|
202
|
+
"""
|
|
203
|
+
endpoint = "v1/align/mafft"
|
|
204
|
+
|
|
205
|
+
files = {"file": sequence_file}
|
|
206
|
+
params: dict = {"auto": auto}
|
|
207
|
+
if ep is not None:
|
|
208
|
+
params["ep"] = ep
|
|
209
|
+
if op is not None:
|
|
210
|
+
params["op"] = op
|
|
211
|
+
|
|
212
|
+
response = session.post(endpoint, files=files, params=params)
|
|
213
|
+
return Job.model_validate(response.json())
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
# TODO - document the `clustersize` and `iterations` parameters
|
|
217
|
+
def clustalo_post(
|
|
218
|
+
session: APISession,
|
|
219
|
+
sequence_file: BinaryIO,
|
|
220
|
+
clustersize: int | None = None,
|
|
221
|
+
iterations: int | None = None,
|
|
222
|
+
) -> Job:
|
|
223
|
+
"""
|
|
224
|
+
Align sequences using the `clustal omega` algorithm. Sequences can be provided as `fasta` or `csv` formats. If `csv`, the file must be headerless with either a single sequence column or name, sequence columns.
|
|
225
|
+
|
|
226
|
+
Leave a parameter as None to use system defaults.
|
|
227
|
+
|
|
228
|
+
Parameters
|
|
229
|
+
----------
|
|
230
|
+
session : APISession
|
|
231
|
+
sequence_file : BinaryIO
|
|
232
|
+
Sequences to align in fasta or csv format.
|
|
233
|
+
clustersize : int, optional
|
|
234
|
+
clustal omega parameter
|
|
235
|
+
iterations : int, optional
|
|
236
|
+
clustal omega parameter
|
|
237
|
+
|
|
238
|
+
Returns
|
|
239
|
+
-------
|
|
240
|
+
Job
|
|
241
|
+
Job details.
|
|
242
|
+
"""
|
|
243
|
+
endpoint = "v1/align/clustalo"
|
|
244
|
+
|
|
245
|
+
files = {"file": sequence_file}
|
|
246
|
+
params = {}
|
|
247
|
+
if clustersize is not None:
|
|
248
|
+
params["clustersize"] = clustersize
|
|
249
|
+
if iterations is not None:
|
|
250
|
+
params["iterations"] = iterations
|
|
251
|
+
|
|
252
|
+
response = session.post(endpoint, files=files, params=params)
|
|
253
|
+
return Job.model_validate(response.json())
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def abnumber_post(
|
|
257
|
+
session: APISession,
|
|
258
|
+
sequence_file: BinaryIO,
|
|
259
|
+
scheme: str = "imgt",
|
|
260
|
+
) -> Job:
|
|
261
|
+
"""
|
|
262
|
+
Align antibody using `AbNumber`. Sequences can be provided as `fasta` or `csv` formats. If `csv`, the file must be headerless with either a single sequence column or name, sequence columns.
|
|
263
|
+
|
|
264
|
+
The antibody numbering scheme can be specified from `imgt` (default), `chothia`, `kabat`, or `aho`.
|
|
265
|
+
|
|
266
|
+
Parameters
|
|
267
|
+
----------
|
|
268
|
+
session : APISession
|
|
269
|
+
sequence_file : BinaryIO
|
|
270
|
+
Sequences to align in fasta or csv format.
|
|
271
|
+
scheme : str = 'imgt'
|
|
272
|
+
Antibody numbering scheme. Can be one of 'imgt', 'chothia', 'kabat', or 'aho'
|
|
273
|
+
|
|
274
|
+
Returns
|
|
275
|
+
-------
|
|
276
|
+
Job
|
|
277
|
+
Job details.
|
|
278
|
+
"""
|
|
279
|
+
endpoint = "v1/align/abnumber"
|
|
280
|
+
|
|
281
|
+
valid_schemes = ["imgt", "chothia", "kabat", "aho"]
|
|
282
|
+
if scheme not in valid_schemes:
|
|
283
|
+
raise Exception(
|
|
284
|
+
f"Antibody numbering {scheme} not recognized. Must be one of {valid_schemes}."
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
files = {"file": sequence_file}
|
|
288
|
+
params = {"scheme": scheme}
|
|
289
|
+
|
|
290
|
+
response = session.post(endpoint, files=files, params=params)
|
|
291
|
+
return Job.model_validate(response.json())
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
# TODO - implement support for getting the antibody numbering from an `AbNumber` job
|
|
295
|
+
def antibody_schema_get(session: APISession, job_id: str):
|
|
296
|
+
"""
|
|
297
|
+
Return the antibody numbering for an `AbNumber` job.
|
|
298
|
+
"""
|
|
299
|
+
raise NotImplementedError()
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def prompt_post(
|
|
303
|
+
session: APISession,
|
|
304
|
+
msa_id: str,
|
|
305
|
+
num_sequences: int | None = None,
|
|
306
|
+
num_residues: int | None = None,
|
|
307
|
+
method: MSASamplingMethod = MSASamplingMethod.NEIGHBORS_NONGAP_NORM_NO_LIMIT,
|
|
308
|
+
homology_level: float = 0.8,
|
|
309
|
+
max_similarity: float = 1.0,
|
|
310
|
+
min_similarity: float = 0.0,
|
|
311
|
+
always_include_seed_sequence: bool = False,
|
|
312
|
+
num_ensemble_prompts: int = 1,
|
|
313
|
+
random_seed: int | None = None,
|
|
314
|
+
) -> Job:
|
|
315
|
+
"""
|
|
316
|
+
Create a protein sequence prompt from a linked MSA (Multiple Sequence Alignment) for PoET Jobs.
|
|
317
|
+
|
|
318
|
+
The MSA is specified by msa_id and created in msa_post.
|
|
319
|
+
|
|
320
|
+
Parameters
|
|
321
|
+
----------
|
|
322
|
+
session : APISession
|
|
323
|
+
An instance of APISession to manage interactions with the API.
|
|
324
|
+
msa_id : str
|
|
325
|
+
The ID of the Multiple Sequence Alignment to use for the prompt.
|
|
326
|
+
num_sequences : int, optional
|
|
327
|
+
Maximum number of sequences in the prompt. Must be <100.
|
|
328
|
+
num_residues : int, optional
|
|
329
|
+
Maximum number of residues (tokens) in the prompt. Must be less than 24577.
|
|
330
|
+
method : MSASamplingMethod, optional
|
|
331
|
+
Method to use for MSA sampling. Defaults to NEIGHBORS_NONGAP_NORM_NO_LIMIT.
|
|
332
|
+
homology_level : float, optional
|
|
333
|
+
Level of homology for sequences in the MSA (neighbors methods only). Must be between 0 and 1. Defaults to 0.8.
|
|
334
|
+
max_similarity : float, optional
|
|
335
|
+
Maximum similarity between sequences in the MSA and the seed. Must be between 0 and 1. Defaults to 1.0.
|
|
336
|
+
min_similarity : float, optional
|
|
337
|
+
Minimum similarity between sequences in the MSA and the seed. Must be between 0 and 1. Defaults to 0.0.
|
|
338
|
+
always_include_seed_sequence : bool, optional
|
|
339
|
+
Whether to always include the seed sequence in the MSA. Defaults to False.
|
|
340
|
+
num_ensemble_prompts : int, optional
|
|
341
|
+
Number of ensemble jobs to run. Defaults to 1.
|
|
342
|
+
random_seed : int, optional
|
|
343
|
+
Seed for random number generation. Defaults to a random number between 0 and 2**32-1.
|
|
344
|
+
|
|
345
|
+
Raises
|
|
346
|
+
------
|
|
347
|
+
InvalidParameterError
|
|
348
|
+
If provided parameter values are not in the allowed range.
|
|
349
|
+
MissingParameterError
|
|
350
|
+
If both or none of 'num_sequences', 'num_residues' is specified.
|
|
351
|
+
|
|
352
|
+
Returns
|
|
353
|
+
-------
|
|
354
|
+
Job
|
|
355
|
+
"""
|
|
356
|
+
endpoint = "v1/align/prompt"
|
|
357
|
+
|
|
358
|
+
if not (0 <= homology_level <= 1):
|
|
359
|
+
raise InvalidParameterError("The 'homology_level' must be between 0 and 1.")
|
|
360
|
+
if not (0 <= max_similarity <= 1):
|
|
361
|
+
raise InvalidParameterError("The 'max_similarity' must be between 0 and 1.")
|
|
362
|
+
if not (0 <= min_similarity <= 1):
|
|
363
|
+
raise InvalidParameterError("The 'min_similarity' must be between 0 and 1.")
|
|
364
|
+
|
|
365
|
+
if num_residues is None and num_sequences is None:
|
|
366
|
+
num_residues = 12288
|
|
367
|
+
|
|
368
|
+
if (num_sequences is None and num_residues is None) or (
|
|
369
|
+
num_sequences is not None and num_residues is not None
|
|
370
|
+
):
|
|
371
|
+
raise MissingParameterError(
|
|
372
|
+
"Either 'num_sequences' or 'num_residues' must be set, but not both."
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
if num_sequences is not None and not (0 <= num_sequences < 100):
|
|
376
|
+
raise InvalidParameterError("The 'num_sequences' must be between 0 and 100.")
|
|
377
|
+
|
|
378
|
+
if num_residues is not None and not (0 <= num_residues < 24577):
|
|
379
|
+
raise InvalidParameterError("The 'num_residues' must be between 0 and 24577.")
|
|
380
|
+
|
|
381
|
+
if random_seed is None:
|
|
382
|
+
random_seed = random.randrange(2**32)
|
|
383
|
+
|
|
384
|
+
params = {
|
|
385
|
+
"msa_id": msa_id,
|
|
386
|
+
"msa_method": method,
|
|
387
|
+
"homology_level": homology_level,
|
|
388
|
+
"max_similarity": max_similarity,
|
|
389
|
+
"min_similarity": min_similarity,
|
|
390
|
+
"force_include_first": always_include_seed_sequence,
|
|
391
|
+
"replicates": num_ensemble_prompts,
|
|
392
|
+
"seed": random_seed,
|
|
393
|
+
}
|
|
394
|
+
if num_sequences is not None:
|
|
395
|
+
params["max_msa_sequences"] = num_sequences
|
|
396
|
+
if num_residues is not None:
|
|
397
|
+
params["max_msa_tokens"] = num_residues
|
|
398
|
+
|
|
399
|
+
response = session.post(endpoint, params=params)
|
|
400
|
+
return Job.model_validate(response.json())
|