openprotein-python 0.17.0__tar.gz → 0.18.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/PKG-INFO +14 -2
  2. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/README.md +11 -1
  3. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/__init__.py +23 -6
  4. openprotein_python-0.18.0/openprotein/_deprecation.py +38 -0
  5. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/_version.py +0 -2
  6. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/align/__init__.py +2 -0
  7. openprotein_python-0.18.0/openprotein/align/_files.py +61 -0
  8. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/align/align.py +150 -120
  9. openprotein_python-0.18.0/openprotein/align/api.py +783 -0
  10. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/align/future.py +17 -1
  11. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/align/msa.py +18 -10
  12. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/align/schemas.py +42 -7
  13. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/auth_store.py +3 -2
  14. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/base.py +192 -40
  15. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/clustering/__init__.py +10 -0
  16. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/clustering/api.py +21 -12
  17. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/clustering/clustering.py +9 -14
  18. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/clustering/models.py +11 -7
  19. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/clustering/schemas.py +10 -3
  20. openprotein_python-0.18.0/openprotein/codecs/__init__.py +55 -0
  21. openprotein_python-0.18.0/openprotein/codecs/_text.py +32 -0
  22. openprotein_python-0.18.0/openprotein/codecs/codec.py +22 -0
  23. openprotein_python-0.18.0/openprotein/codecs/msa.py +193 -0
  24. openprotein_python-0.18.0/openprotein/codecs/ndarray.py +34 -0
  25. openprotein_python-0.18.0/openprotein/codecs/prompt.py +226 -0
  26. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/common/__init__.py +10 -0
  27. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/common/features.py +2 -3
  28. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/common/model_metadata.py +2 -0
  29. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/common/reduction.py +2 -2
  30. openprotein_python-0.17.0/openprotein/common/residue_contants.py → openprotein_python-0.18.0/openprotein/common/residue_constants.py +3 -0
  31. openprotein_python-0.18.0/openprotein/config.py +20 -0
  32. openprotein_python-0.18.0/openprotein/csv.py +48 -0
  33. openprotein_python-0.18.0/openprotein/data/__init__.py +24 -0
  34. openprotein_python-0.18.0/openprotein/data/_reads.py +24 -0
  35. openprotein_python-0.18.0/openprotein/data/_resource.py +307 -0
  36. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/data/api.py +40 -1
  37. openprotein_python-0.18.0/openprotein/data/assaydataset.py +314 -0
  38. openprotein_python-0.18.0/openprotein/data/data.py +170 -0
  39. openprotein_python-0.18.0/openprotein/data/msa/__init__.py +14 -0
  40. openprotein_python-0.18.0/openprotein/data/msa/_api.py +193 -0
  41. openprotein_python-0.18.0/openprotein/data/msa/msa.py +352 -0
  42. openprotein_python-0.18.0/openprotein/data/msa/schemas.py +38 -0
  43. openprotein_python-0.18.0/openprotein/data/prompts/__init__.py +10 -0
  44. openprotein_python-0.18.0/openprotein/data/prompts/_api.py +151 -0
  45. openprotein_python-0.18.0/openprotein/data/prompts/_replicates.py +28 -0
  46. openprotein_python-0.18.0/openprotein/data/prompts/prompts.py +250 -0
  47. openprotein_python-0.18.0/openprotein/data/prompts/schemas.py +43 -0
  48. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/data/schemas.py +14 -1
  49. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/design/__init__.py +11 -0
  50. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/design/api.py +30 -15
  51. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/design/design.py +3 -2
  52. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/design/future.py +4 -7
  53. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/design/schemas.py +49 -19
  54. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/__init__.py +22 -0
  55. openprotein_python-0.18.0/openprotein/embeddings/ablang.py +59 -0
  56. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/api.py +47 -26
  57. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/embeddings.py +49 -20
  58. openprotein_python-0.18.0/openprotein/embeddings/esm.py +70 -0
  59. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/future.py +23 -13
  60. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/models.py +9 -14
  61. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/openprotein.py +3 -1
  62. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/poet.py +12 -9
  63. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/poet2.py +33 -21
  64. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/embeddings/schemas.py +11 -7
  65. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/errors.py +45 -12
  66. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fasta.py +3 -1
  67. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/__init__.py +15 -6
  68. openprotein_python-0.18.0/openprotein/fold/_request.py +181 -0
  69. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/alphafold2.py +8 -7
  70. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/api.py +32 -21
  71. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/boltz.py +59 -20
  72. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/common.py +100 -69
  73. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/complex.py +4 -3
  74. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/esmfold.py +8 -11
  75. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/esmfold2.py +11 -10
  76. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/fold.py +9 -6
  77. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/future.py +57 -22
  78. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/minifold.py +6 -6
  79. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/models.py +53 -16
  80. openprotein_python-0.18.0/openprotein/fold/opendde.py +169 -0
  81. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/protenix.py +13 -5
  82. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/fold/rosettafold3.py +14 -7
  83. openprotein_python-0.18.0/openprotein/fold/schemas.py +163 -0
  84. openprotein_python-0.18.0/openprotein/jobs/__init__.py +64 -0
  85. openprotein_python-0.18.0/openprotein/jobs/_api.py +125 -0
  86. openprotein_python-0.18.0/openprotein/jobs/_decode.py +29 -0
  87. openprotein_python-0.18.0/openprotein/jobs/_dispatch.py +126 -0
  88. openprotein_python-0.18.0/openprotein/jobs/_storage.py +150 -0
  89. openprotein_python-0.18.0/openprotein/jobs/_submission.py +42 -0
  90. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/jobs/api.py +33 -8
  91. openprotein_python-0.18.0/openprotein/jobs/futures.py +2016 -0
  92. openprotein_python-0.18.0/openprotein/jobs/jobs.py +238 -0
  93. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/jobs/schemas.py +99 -18
  94. openprotein_python-0.18.0/openprotein/models/__init__.py +187 -0
  95. openprotein_python-0.18.0/openprotein/models/_api.py +131 -0
  96. openprotein_python-0.18.0/openprotein/models/_folds.py +55 -0
  97. openprotein_python-0.18.0/openprotein/models/_inputs.py +247 -0
  98. openprotein_python-0.18.0/openprotein/models/ensemble/__init__.py +16 -0
  99. openprotein_python-0.18.0/openprotein/models/ensemble/_inputs.py +163 -0
  100. openprotein_python-0.18.0/openprotein/models/ensemble/alphaflow.py +148 -0
  101. openprotein_python-0.18.0/openprotein/models/ensemble/base.py +25 -0
  102. openprotein_python-0.18.0/openprotein/models/ensemble/bioemu.py +109 -0
  103. openprotein_python-0.18.0/openprotein/models/ensemble/esmflow.py +122 -0
  104. openprotein_python-0.18.0/openprotein/models/estimators.py +400 -0
  105. openprotein_python-0.18.0/openprotein/models/folding/__init__.py +27 -0
  106. openprotein_python-0.18.0/openprotein/models/folding/alphafold2.py +14 -0
  107. openprotein_python-0.18.0/openprotein/models/folding/base.py +188 -0
  108. openprotein_python-0.18.0/openprotein/models/folding/boltz1.py +15 -0
  109. openprotein_python-0.18.0/openprotein/models/folding/boltz2.py +15 -0
  110. openprotein_python-0.18.0/openprotein/models/folding/esmfold.py +14 -0
  111. openprotein_python-0.18.0/openprotein/models/folding/esmfold2.py +15 -0
  112. openprotein_python-0.18.0/openprotein/models/folding/minifold.py +14 -0
  113. openprotein_python-0.18.0/openprotein/models/folding/opendde.py +15 -0
  114. openprotein_python-0.18.0/openprotein/models/folding/protenix.py +14 -0
  115. openprotein_python-0.18.0/openprotein/models/folding/protenix_v2.py +15 -0
  116. openprotein_python-0.18.0/openprotein/models/folding/rosettafold3.py +15 -0
  117. openprotein_python-0.18.0/openprotein/models/foundational/__init__.py +29 -0
  118. openprotein_python-0.18.0/openprotein/models/foundational/_inverse_folding.py +127 -0
  119. openprotein_python-0.18.0/openprotein/models/foundational/ablang2.py +14 -0
  120. openprotein_python-0.18.0/openprotein/models/foundational/base.py +122 -0
  121. openprotein_python-0.18.0/openprotein/models/foundational/esm1.py +16 -0
  122. openprotein_python-0.18.0/openprotein/models/foundational/esm2.py +16 -0
  123. openprotein_python-0.18.0/openprotein/models/foundational/esmc.py +15 -0
  124. openprotein_python-0.18.0/openprotein/models/foundational/esmif1.py +15 -0
  125. openprotein_python-0.18.0/openprotein/models/foundational/poet.py +196 -0
  126. openprotein_python-0.18.0/openprotein/models/foundational/poet2.py +212 -0
  127. openprotein_python-0.18.0/openprotein/models/foundational/proteinmpnn.py +44 -0
  128. openprotein_python-0.18.0/openprotein/models/foundational/protseq.py +15 -0
  129. openprotein_python-0.18.0/openprotein/models/foundational/prott5.py +14 -0
  130. openprotein_python-0.18.0/openprotein/models/foundational/rotaprot.py +15 -0
  131. openprotein_python-0.18.0/openprotein/models/generative/__init__.py +7 -0
  132. openprotein_python-0.18.0/openprotein/models/generative/base.py +48 -0
  133. openprotein_python-0.18.0/openprotein/models/generative/boltzgen.py +15 -0
  134. openprotein_python-0.18.0/openprotein/models/generative/rfdiffusion.py +15 -0
  135. openprotein_python-0.18.0/openprotein/models/gp.py +270 -0
  136. openprotein_python-0.18.0/openprotein/models/kernels.py +159 -0
  137. openprotein_python-0.18.0/openprotein/models/model.py +261 -0
  138. openprotein_python-0.18.0/openprotein/models/models.py +460 -0
  139. openprotein_python-0.18.0/openprotein/models/schemas.py +178 -0
  140. openprotein_python-0.18.0/openprotein/models/structure_generation.py +113 -0
  141. openprotein_python-0.18.0/openprotein/models/svd.py +256 -0
  142. openprotein_python-0.18.0/openprotein/models/umap.py +118 -0
  143. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/molecules/__init__.py +11 -0
  144. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/molecules/chains.py +18 -24
  145. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/molecules/complex.py +30 -55
  146. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/molecules/protein.py +64 -78
  147. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/molecules/structure.py +9 -7
  148. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/molecules/template.py +8 -6
  149. openprotein_python-0.18.0/openprotein/predictor/__init__.py +80 -0
  150. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/predictor/api.py +70 -30
  151. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/predictor/models.py +104 -4
  152. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/predictor/prediction.py +10 -6
  153. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/predictor/predictor.py +15 -10
  154. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/predictor/schemas.py +19 -2
  155. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/predictor/validate.py +14 -16
  156. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/prompt/__init__.py +10 -0
  157. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/prompt/api.py +102 -34
  158. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/prompt/models.py +27 -10
  159. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/prompt/prompt.py +19 -15
  160. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/prompt/schemas.py +10 -6
  161. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/svd/__init__.py +9 -0
  162. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/svd/api.py +21 -11
  163. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/svd/models.py +15 -15
  164. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/svd/schemas.py +2 -0
  165. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/svd/svd.py +5 -3
  166. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/umap/__init__.py +9 -0
  167. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/umap/api.py +27 -17
  168. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/umap/models.py +2 -0
  169. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/umap/schemas.py +2 -0
  170. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/umap/umap.py +8 -6
  171. openprotein_python-0.18.0/openprotein/utils/__init__.py +1 -0
  172. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/utils/chain_id.py +3 -2
  173. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/utils/cif.py +8 -2
  174. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/utils/numpy.py +3 -0
  175. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/openprotein/utils/sequence.py +14 -2
  176. openprotein_python-0.18.0/openprotein/utils/uuid.py +58 -0
  177. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/pyproject.toml +6 -2
  178. openprotein_python-0.17.0/openprotein/align/api.py +0 -449
  179. openprotein_python-0.17.0/openprotein/chains.py +0 -12
  180. openprotein_python-0.17.0/openprotein/config.py +0 -9
  181. openprotein_python-0.17.0/openprotein/csv.py +0 -31
  182. openprotein_python-0.17.0/openprotein/data/__init__.py +0 -9
  183. openprotein_python-0.17.0/openprotein/data/assaydataset.py +0 -178
  184. openprotein_python-0.17.0/openprotein/data/data.py +0 -103
  185. openprotein_python-0.17.0/openprotein/embeddings/ablang.py +0 -21
  186. openprotein_python-0.17.0/openprotein/embeddings/esm.py +0 -36
  187. openprotein_python-0.17.0/openprotein/fold/schemas.py +0 -40
  188. openprotein_python-0.17.0/openprotein/jobs/__init__.py +0 -9
  189. openprotein_python-0.17.0/openprotein/jobs/futures.py +0 -808
  190. openprotein_python-0.17.0/openprotein/jobs/jobs.py +0 -88
  191. openprotein_python-0.17.0/openprotein/models/__init__.py +0 -27
  192. openprotein_python-0.17.0/openprotein/models/base.py +0 -63
  193. openprotein_python-0.17.0/openprotein/models/foundation/boltzgen.py +0 -298
  194. openprotein_python-0.17.0/openprotein/models/foundation/boltzgen_schema.py +0 -389
  195. openprotein_python-0.17.0/openprotein/models/foundation/esmif1.py +0 -213
  196. openprotein_python-0.17.0/openprotein/models/foundation/proteinmpnn.py +0 -193
  197. openprotein_python-0.17.0/openprotein/models/foundation/rfdiffusion.py +0 -288
  198. openprotein_python-0.17.0/openprotein/models/foundation/solublempnn.py +0 -25
  199. openprotein_python-0.17.0/openprotein/models/models.py +0 -42
  200. openprotein_python-0.17.0/openprotein/models/structure_generation.py +0 -52
  201. openprotein_python-0.17.0/openprotein/predictor/__init__.py +0 -26
  202. openprotein_python-0.17.0/openprotein/protein.py +0 -12
  203. openprotein_python-0.17.0/openprotein/scaffolds.py +0 -8
  204. openprotein_python-0.17.0/openprotein/utils/__init__.py +0 -0
  205. openprotein_python-0.17.0/openprotein/utils/uuid.py +0 -29
  206. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/.gitignore +0 -0
  207. {openprotein_python-0.17.0 → openprotein_python-0.18.0}/LICENSE.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: openprotein-python
3
- Version: 0.17.0
3
+ Version: 0.18.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
@@ -16,6 +16,8 @@ Requires-Dist: pydantic>=2.5
16
16
  Requires-Dist: requests>=2.32.3
17
17
  Requires-Dist: tomli>=2.3.0
18
18
  Requires-Dist: tqdm>=4.66.4
19
+ Provides-Extra: msa
20
+ Requires-Dist: pyarrow>=14; extra == 'msa'
19
21
  Description-Content-Type: text/markdown
20
22
 
21
23
  [![PyPI version](https://badge.fury.io/py/openprotein-python.svg)](https://pypi.org/project/openprotein-python/)
@@ -95,9 +97,10 @@ result = future.get(verbose=True) # get the result from a finished job
95
97
  ## Jobs Interface
96
98
 
97
99
  ### Listing Jobs
98
- To view all jobs associated with each session, the following method is available, providing an option to filter results by date, job type, or status.
100
+ To view all jobs associated with each session, the following method is available, providing an option to filter results by date, job type, status, or name.
99
101
  ```
100
102
  session.jobs.list()
103
+ session.jobs.list(name="my-run") # filter to jobs with an exact name match
101
104
  ```
102
105
 
103
106
  ### Retrieving Specific Job
@@ -106,6 +109,15 @@ For detailed information about a particular job, use the following command with
106
109
  session.jobs.get(JOB_ID) # Replace JOB_ID with the ID of the specific job to be retrieved
107
110
  ```
108
111
 
112
+ ### Naming Jobs
113
+ A job can be given a name and description once it's created, to make it easier to find:
114
+ ```
115
+ session.jobs.update(JOB_ID, name="my-run", description="baseline model")
116
+
117
+ # equivalent, from a Future
118
+ future.rename(name="my-run", description="baseline model")
119
+ ```
120
+
109
121
  ### Resuming Jobs
110
122
  Jobs from prior workflows can be resumed using the load_job method provided by each API.
111
123
  ```
@@ -75,9 +75,10 @@ result = future.get(verbose=True) # get the result from a finished job
75
75
  ## Jobs Interface
76
76
 
77
77
  ### Listing Jobs
78
- To view all jobs associated with each session, the following method is available, providing an option to filter results by date, job type, or status.
78
+ To view all jobs associated with each session, the following method is available, providing an option to filter results by date, job type, status, or name.
79
79
  ```
80
80
  session.jobs.list()
81
+ session.jobs.list(name="my-run") # filter to jobs with an exact name match
81
82
  ```
82
83
 
83
84
  ### Retrieving Specific Job
@@ -86,6 +87,15 @@ For detailed information about a particular job, use the following command with
86
87
  session.jobs.get(JOB_ID) # Replace JOB_ID with the ID of the specific job to be retrieved
87
88
  ```
88
89
 
90
+ ### Naming Jobs
91
+ A job can be given a name and description once it's created, to make it easier to find:
92
+ ```
93
+ session.jobs.update(JOB_ID, name="my-run", description="baseline model")
94
+
95
+ # equivalent, from a Future
96
+ future.rename(name="my-run", description="baseline model")
97
+ ```
98
+
89
99
  ### Resuming Jobs
90
100
  Jobs from prior workflows can be resumed using the load_job method provided by each API.
91
101
  ```
@@ -26,6 +26,27 @@ from openprotein.design import DesignAPI
26
26
  from openprotein.jobs import Future
27
27
  from openprotein.base import APISession
28
28
 
29
+ __all__ = [
30
+ "SVDAPI",
31
+ "UMAPAPI",
32
+ "APISession",
33
+ "AlignAPI",
34
+ "ClusteringAPI",
35
+ "DataAPI",
36
+ "DeprecationError",
37
+ "DesignAPI",
38
+ "EmbeddingsAPI",
39
+ "FoldAPI",
40
+ "Future",
41
+ "JobsAPI",
42
+ "ModelsAPI",
43
+ "OpenProtein",
44
+ "PredictorAPI",
45
+ "PromptAPI",
46
+ "__version__",
47
+ "connect",
48
+ ]
49
+
29
50
 
30
51
  class OpenProtein(APISession):
31
52
  """
@@ -102,9 +123,7 @@ class OpenProtein(APISession):
102
123
 
103
124
  @property
104
125
  def svd(self) -> SVDAPI:
105
- """
106
- The embedding submodule gives access to protein embedding models and their inference endpoints.
107
- """
126
+ """Fit and apply SVD projections through the SVD API."""
108
127
  if self._svd is None:
109
128
  self._svd = SVDAPI(
110
129
  session=self,
@@ -113,9 +132,7 @@ class OpenProtein(APISession):
113
132
 
114
133
  @property
115
134
  def umap(self) -> UMAPAPI:
116
- """
117
- The embedding submodule gives access to protein embedding models and their inference endpoints.
118
- """
135
+ """Fit and apply UMAP projections through the UMAP API."""
119
136
  if self._umap is None:
120
137
  self._umap = UMAPAPI(
121
138
  session=self,
@@ -0,0 +1,38 @@
1
+ """Helper for deprecating public interfaces."""
2
+
3
+ import warnings
4
+
5
+
6
+ def warn_deprecated(
7
+ name: str,
8
+ use: str,
9
+ *,
10
+ since: str,
11
+ removed_in: str,
12
+ stacklevel: int = 3,
13
+ ) -> None:
14
+ """
15
+ Warn that a public interface is deprecated.
16
+
17
+ The default ``stacklevel`` points the warning at the caller of the
18
+ deprecated function that calls this helper.
19
+
20
+ Parameters
21
+ ----------
22
+ name : str
23
+ Name of the deprecated interface.
24
+ use : str
25
+ The replacement, already formatted for display.
26
+ since : str
27
+ Version the interface was deprecated in.
28
+ removed_in : str
29
+ Version the interface is removed in.
30
+ stacklevel : int, default=3
31
+ Stack level passed to `warnings.warn`.
32
+ """
33
+ warnings.warn(
34
+ f"`{name}` is deprecated since {since} and will be removed in {removed_in}. "
35
+ f"Use {use}.",
36
+ FutureWarning,
37
+ stacklevel=stacklevel,
38
+ )
@@ -8,8 +8,6 @@ def _get_hatch_version():
8
8
  """Compute the most up-to-date version number in a development environment.
9
9
 
10
10
  Returns `None` if Hatchling is not installed, e.g. in a production environment.
11
-
12
- For more details, see <https://github.com/maresb/hatch-vcs-footgun-example/>.
13
11
  """
14
12
  import os
15
13
 
@@ -6,3 +6,5 @@ isort:skip_file
6
6
 
7
7
  from .msa import MSAFuture
8
8
  from .align import AlignAPI
9
+
10
+ __all__ = ["AlignAPI", "MSAFuture"]
@@ -0,0 +1,61 @@
1
+ """Sequence files read by the deprecated align methods."""
2
+
3
+ import csv
4
+
5
+ from openprotein import fasta
6
+ from openprotein.errors import InvalidParameterError
7
+
8
+
9
+ def read_file_content(file) -> bytes | bytearray | str:
10
+ """Read the sequence file a deprecated align method was given.
11
+
12
+ Accepts a file-like object, ``bytes``, ``bytearray``, ``str`` or a
13
+ ``(filename, fileobj)`` / ``(filename, fileobj, content_type)`` tuple or list.
14
+ """
15
+ if isinstance(file, (tuple, list)):
16
+ file = file[1]
17
+ return file.read() if hasattr(file, "read") else file
18
+
19
+
20
+ def read_sequences(
21
+ content: bytes | bytearray | str,
22
+ ) -> tuple[list[str], list[str] | None]:
23
+ """Parse FASTA or headerless CSV text into sequences and optional names."""
24
+ if isinstance(content, (bytes, bytearray)):
25
+ content = content.decode("utf-8-sig")
26
+ text = content.removeprefix("\ufeff")
27
+ lines = text.splitlines()
28
+ if any(line.lstrip().startswith(">") for line in lines):
29
+ parsed_names, parsed_sequences = fasta.parse(lines)
30
+ names: list[str] | None = []
31
+ sequences: list[str] = []
32
+ for name, sequence in zip(parsed_names, parsed_sequences):
33
+ if sequence.strip():
34
+ names.append(str(name))
35
+ sequences.append(str(sequence))
36
+ else:
37
+ rows = []
38
+ width = 1
39
+ for row in csv.reader(text.splitlines(keepends=True)):
40
+ trimmed = row.copy()
41
+ while trimmed and not trimmed[-1].strip():
42
+ trimmed.pop()
43
+ if trimmed:
44
+ rows.append(row)
45
+ width = max(width, len(trimmed))
46
+ if width > 2:
47
+ raise InvalidParameterError(
48
+ "CSV must have one sequence column or name and sequence columns."
49
+ )
50
+ names = None if width == 1 else []
51
+ sequences = []
52
+ for row in rows:
53
+ sequence = row[1] if names is not None and len(row) > 1 else row[0]
54
+ if not sequence.strip():
55
+ continue
56
+ sequences.append(sequence.strip())
57
+ if names is not None:
58
+ names.append(row[0].strip() if len(row) > 1 else "")
59
+ if not sequences:
60
+ raise InvalidParameterError("The file contains no sequences.")
61
+ return sequences, names
@@ -1,17 +1,29 @@
1
1
  """Align API interface for creating alignments and MSAs (multiple sequence alignments) which can be used for other protein tasks."""
2
2
 
3
3
  from collections.abc import Sequence
4
- from io import BytesIO
5
4
  from typing import BinaryIO, Iterator
6
5
 
6
+ from openprotein import _deprecation
7
7
  from openprotein.base import APISession
8
8
  from openprotein.errors import DeprecationError
9
9
  from openprotein.jobs import Job
10
- from openprotein.molecules import Protein
11
10
 
12
11
  from . import api
12
+ from ._files import read_file_content, read_sequences
13
13
  from .msa import MSAFuture
14
- from .schemas import AbNumberScheme, AlignType, UnnumberedPolicy
14
+ from .schemas import AbNumberScheme, Pairing, UnnumberedPolicy
15
+
16
+ __all__ = ["AlignAPI"]
17
+
18
+
19
+ def _as_sequences(sequences: Sequence[bytes | str]) -> list[str]:
20
+ """Coerce the caller's sequences to the JSON array the align endpoints take."""
21
+ return [s.decode() if isinstance(s, bytes) else s for s in sequences]
22
+
23
+
24
+ def _as_names(names: Sequence[str] | None) -> list[str] | None:
25
+ """Coerce optional row labels to a list, leaving ``None`` alone."""
26
+ return None if names is None else list(names)
15
27
 
16
28
 
17
29
  class AlignAPI:
@@ -38,7 +50,8 @@ class AlignAPI:
38
50
  sequences : Sequence[bytes or str]
39
51
  Sequences to align.
40
52
  names : Sequence[str], optional
41
- Optional list of sequence names, must be the same length as sequences if provided.
53
+ Row labels for the aligned output, same length as sequences. Omit them
54
+ and the aligner labels the rows itself.
42
55
  auto : bool, default=True
43
56
  Set to True to automatically set algorithm parameters.
44
57
  ep : float, optional
@@ -50,44 +63,39 @@ class AlignAPI:
50
63
  -------
51
64
  MSAFuture
52
65
  Future object awaiting the contents of the MSA upload.
53
-
54
- Raises
55
- ------
56
- Exception
57
- If names and sequences are not the same length.
58
66
  """
59
- if names is not None and len(names) != len(sequences):
60
- raise Exception(
61
- f"Names and sequences must be same length, but were {len(names)} and {len(sequences)}"
62
- )
63
- lines = []
64
- if names is None:
65
- # as CSV
66
- lines = [s.encode() if isinstance(s, str) else s for s in sequences]
67
- else:
68
- # as fasta
69
- for name, sequence in zip(names, sequences):
70
- if isinstance(name, str):
71
- name = name.encode()
72
- if isinstance(sequence, str):
73
- sequence = sequence.encode()
74
- lines.append(b">" + name)
75
- lines.append(sequence)
76
- content = b"\n".join(lines)
77
- stream = BytesIO(content)
78
- return self.mafft_file(stream, auto=auto, ep=ep, op=op)
79
-
80
- def mafft_file(self, file, auto=True, ep=None, op=None) -> MSAFuture:
67
+ job = api.mafft_post(
68
+ self.session,
69
+ _as_sequences(sequences),
70
+ names=_as_names(names),
71
+ auto=auto,
72
+ ep=ep,
73
+ op=op,
74
+ )
75
+ return MSAFuture.create(session=self.session, job=job)
76
+
77
+ def mafft_file(
78
+ self,
79
+ file,
80
+ auto: bool = True,
81
+ ep: float | None = None,
82
+ op: float | None = None,
83
+ ) -> MSAFuture:
81
84
  """
82
- Align sequences using the `mafft` algorithm. Sequences can be provided as FASTA or CSV formats.
83
- If CSV, the file must be headerless with either a single sequence column or name, sequence columns.
85
+ Align sequences from a file using the `mafft` algorithm.
86
+
87
+ .. deprecated:: 0.18.0
88
+ Use `AlignAPI.mafft` with sequences and names instead.
89
+
90
+ 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.
84
91
 
85
92
  Set `auto` to True to automatically attempt the best parameters. Leave a parameter as None to use system defaults.
86
93
 
87
94
  Parameters
88
95
  ----------
89
- file : file-like object
90
- Sequences to align in FASTA or CSV format.
96
+ file : file-like object, bytes, bytearray, str, tuple or list
97
+ Sequences to align in FASTA or CSV format. A tuple or list is
98
+ ``(filename, fileobj)`` or ``(filename, fileobj, content_type)``.
91
99
  auto : bool, default=True
92
100
  Set to True to automatically set algorithm parameters.
93
101
  ep : float, optional
@@ -99,9 +107,20 @@ class AlignAPI:
99
107
  -------
100
108
  MSAFuture
101
109
  Future object awaiting the contents of the MSA upload.
110
+
111
+ Raises
112
+ ------
113
+ InvalidParameterError
114
+ If the file has no sequences or a CSV has more than two columns.
102
115
  """
103
- job = api.mafft_post(self.session, file, auto=auto, ep=ep, op=op)
104
- return MSAFuture.create(session=self.session, job=job)
116
+ _deprecation.warn_deprecated(
117
+ "AlignAPI.mafft_file",
118
+ "`AlignAPI.mafft` with sequences and names",
119
+ since="0.18.0",
120
+ removed_in="0.19.0",
121
+ )
122
+ sequences, names = read_sequences(read_file_content(file))
123
+ return self.mafft(sequences, names, auto=auto, ep=ep, op=op)
105
124
 
106
125
  def clustalo(
107
126
  self,
@@ -113,14 +132,13 @@ class AlignAPI:
113
132
  """
114
133
  Align sequences using the `clustal omega` algorithm.
115
134
 
116
- 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.
117
-
118
135
  Parameters
119
136
  ----------
120
137
  sequences : Sequence[bytes or str]
121
138
  Sequences to align.
122
139
  names : Sequence[str], optional
123
- Optional list of sequence names, must be the same length as sequences if provided.
140
+ Row labels for the aligned output, same length as sequences. Omit them
141
+ and the aligner labels the rows itself.
124
142
  clustersize : int, optional
125
143
  Maximum number of sequences per cluster during guide tree generation. If None, uses the default value.
126
144
  iterations : int, optional
@@ -130,45 +148,35 @@ class AlignAPI:
130
148
  -------
131
149
  MSAFuture
132
150
  Future object awaiting the contents of the MSA upload.
133
-
134
- Raises
135
- ------
136
- Exception
137
- If names and sequences are not the same length.
138
151
  """
139
- if names is not None and len(names) != len(sequences):
140
- raise Exception(
141
- f"Names and sequences must be same length, but were {len(names)} and {len(sequences)}"
142
- )
143
- lines = []
144
- if names is None:
145
- # as CSV
146
- lines = [s.encode() if isinstance(s, str) else s for s in sequences]
147
- else:
148
- # as fasta
149
- for name, sequence in zip(names, sequences):
150
- if isinstance(name, str):
151
- name = name.encode()
152
- if isinstance(sequence, str):
153
- sequence = sequence.encode()
154
- lines.append(b">" + name)
155
- lines.append(sequence)
156
- content = b"\n".join(lines)
157
- stream = BytesIO(content)
158
- return self.clustalo_file(
159
- stream, clustersize=clustersize, iterations=iterations
152
+ job = api.clustalo_post(
153
+ self.session,
154
+ _as_sequences(sequences),
155
+ names=_as_names(names),
156
+ clustersize=clustersize,
157
+ iterations=iterations,
160
158
  )
159
+ return MSAFuture.create(session=self.session, job=job)
161
160
 
162
- def clustalo_file(self, file, clustersize=None, iterations=None) -> MSAFuture:
161
+ def clustalo_file(
162
+ self,
163
+ file,
164
+ clustersize: int | None = None,
165
+ iterations: int | None = None,
166
+ ) -> MSAFuture:
163
167
  """
164
- Align sequences using the `clustal omega` algorithm.
168
+ Align sequences from a file using the `clustal omega` algorithm.
169
+
170
+ .. deprecated:: 0.18.0
171
+ Use `AlignAPI.clustalo` with sequences and names instead.
165
172
 
166
173
  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.
167
174
 
168
175
  Parameters
169
176
  ----------
170
- file : file-like object
171
- Sequences to align in FASTA or CSV format.
177
+ file : file-like object, bytes, bytearray, str, tuple or list
178
+ Sequences to align in FASTA or CSV format. A tuple or list is
179
+ ``(filename, fileobj)`` or ``(filename, fileobj, content_type)``.
172
180
  clustersize : int, optional
173
181
  Maximum number of sequences per cluster during guide tree generation. If None, uses the default value.
174
182
  iterations : int, optional
@@ -178,11 +186,22 @@ class AlignAPI:
178
186
  -------
179
187
  MSAFuture
180
188
  Future object awaiting the contents of the MSA upload.
189
+
190
+ Raises
191
+ ------
192
+ InvalidParameterError
193
+ If the file has no sequences or a CSV has more than two columns.
181
194
  """
182
- job = api.clustalo_post(
183
- self.session, file, clustersize=clustersize, iterations=iterations
195
+ _deprecation.warn_deprecated(
196
+ "AlignAPI.clustalo_file",
197
+ "`AlignAPI.clustalo` with sequences and names",
198
+ since="0.18.0",
199
+ removed_in="0.19.0",
200
+ )
201
+ sequences, names = read_sequences(read_file_content(file))
202
+ return self.clustalo(
203
+ sequences, names, clustersize=clustersize, iterations=iterations
184
204
  )
185
- return MSAFuture.create(session=self.session, job=job)
186
205
 
187
206
  def abnumber(
188
207
  self,
@@ -195,8 +214,6 @@ class AlignAPI:
195
214
  """
196
215
  Align antibody sequences using `AbNumber`.
197
216
 
198
- 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.
199
-
200
217
  The antibody numbering scheme can be specified.
201
218
 
202
219
  Parameters
@@ -204,7 +221,8 @@ class AlignAPI:
204
221
  sequences : Sequence[bytes or str]
205
222
  Sequences to align.
206
223
  names : Sequence[str], optional
207
- Optional list of sequence names, must be the same length as sequences if provided.
224
+ Row labels for the aligned output, same length as sequences. Omit them
225
+ and the aligner labels the rows itself.
208
226
  scheme : AbNumberScheme, default=AbNumberScheme.CHOTHIA
209
227
  Antibody numbering scheme.
210
228
  drop_minority_chains : bool, default=False
@@ -221,37 +239,16 @@ class AlignAPI:
221
239
  -------
222
240
  MSAFuture
223
241
  Future object awaiting the contents of the MSA upload.
224
-
225
- Raises
226
- ------
227
- Exception
228
- If names and sequences are not the same length.
229
242
  """
230
- if names is not None and len(names) != len(sequences):
231
- raise Exception(
232
- f"Names and sequences must be same length, but were {len(names)} and {len(sequences)}"
233
- )
234
- lines = []
235
- if names is None:
236
- # as CSV
237
- lines = [s.encode() if isinstance(s, str) else s for s in sequences]
238
- else:
239
- # as fasta
240
- for name, sequence in zip(names, sequences):
241
- if isinstance(name, str):
242
- name = name.encode()
243
- if isinstance(sequence, str):
244
- sequence = sequence.encode()
245
- lines.append(b">" + name)
246
- lines.append(sequence)
247
- content = b"\n".join(lines)
248
- stream = BytesIO(content)
249
- return self.abnumber_file(
250
- stream,
243
+ job = api.abnumber_post(
244
+ self.session,
245
+ _as_sequences(sequences),
246
+ names=_as_names(names),
251
247
  scheme=scheme,
252
248
  drop_minority_chains=drop_minority_chains,
253
249
  unnumbered_policy=unnumbered_policy,
254
250
  )
251
+ return MSAFuture.create(session=self.session, job=job)
255
252
 
256
253
  def abnumber_file(
257
254
  self,
@@ -261,16 +258,18 @@ class AlignAPI:
261
258
  unnumbered_policy: UnnumberedPolicy = UnnumberedPolicy.ERROR,
262
259
  ) -> MSAFuture:
263
260
  """
264
- Align antibody sequences using `AbNumber`.
261
+ Align antibody sequences from a file using `AbNumber`.
265
262
 
266
- 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
+ .. deprecated:: 0.18.0
264
+ Use `AlignAPI.abnumber` with sequences and names instead.
267
265
 
268
- The antibody numbering scheme can be specified.
266
+ 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.
269
267
 
270
268
  Parameters
271
269
  ----------
272
- file : file-like object
273
- Sequences to align in FASTA or CSV format.
270
+ file : file-like object, bytes, bytearray, str, tuple or list
271
+ Sequences to align in FASTA or CSV format. A tuple or list is
272
+ ``(filename, fileobj)`` or ``(filename, fileobj, content_type)``.
274
273
  scheme : AbNumberScheme, default=AbNumberScheme.CHOTHIA
275
274
  Antibody numbering scheme.
276
275
  drop_minority_chains : bool, default=False
@@ -287,40 +286,67 @@ class AlignAPI:
287
286
  -------
288
287
  MSAFuture
289
288
  Future object awaiting the contents of the MSA upload.
289
+
290
+ Raises
291
+ ------
292
+ InvalidParameterError
293
+ If the file has no sequences or a CSV has more than two columns.
290
294
  """
291
- job = api.abnumber_post(
292
- self.session,
293
- file,
295
+ _deprecation.warn_deprecated(
296
+ "AlignAPI.abnumber_file",
297
+ "`AlignAPI.abnumber` with sequences and names",
298
+ since="0.18.0",
299
+ removed_in="0.19.0",
300
+ )
301
+ sequences, names = read_sequences(read_file_content(file))
302
+ return self.abnumber(
303
+ sequences,
304
+ names,
294
305
  scheme=scheme,
295
306
  drop_minority_chains=drop_minority_chains,
296
307
  unnumbered_policy=unnumbered_policy,
297
308
  )
298
- return MSAFuture.create(session=self.session, job=job)
299
309
 
300
310
  def upload_msa(self, msa_file: BinaryIO) -> MSAFuture:
301
311
  """
302
- Upload an MSA from a file.
312
+ Upload a ready-made MSA.
313
+
314
+ .. deprecated:: 0.18.0
315
+ Use `session.data.MSA.create` and `MSA.sample_prompt`
316
+ instead.
317
+
318
+ The returned future samples prompts with ``sample_prompt``. For a
319
+ complex, join the chains of each row with ``:``, or use the a3m
320
+ ``#<lengths>\t<cardinalities>`` header.
303
321
 
304
322
  Parameters
305
323
  ----------
306
- msa_file : str
307
- Path to a ready-made MSA file.
324
+ msa_file : BinaryIO
325
+ The MSA as FASTA, a3m or a headerless CSV of names and sequences.
308
326
 
309
327
  Returns
310
328
  -------
311
329
  MSAFuture
312
- Future object awaiting the contents of the MSA upload.
330
+ Future for the upload.
313
331
 
314
332
  Raises
315
333
  ------
316
334
  APIError
317
335
  If there is an issue with the API request.
318
336
  """
337
+ _deprecation.warn_deprecated(
338
+ "AlignAPI.upload_msa",
339
+ "`session.data.MSA.create` and `MSA.sample_prompt`",
340
+ since="0.18.0",
341
+ removed_in="0.19.0",
342
+ )
319
343
  return MSAFuture.create(
320
- session=self.session, job=api.msa_post(self.session, msa_file=msa_file)
344
+ session=self.session, job=api._msa_post(self.session, msa_file=msa_file)
321
345
  )
322
346
 
323
- def create_msa(self, seed: bytes | str) -> MSAFuture:
347
+ def create_msa(
348
+ self, seed: bytes | str, pairing: Pairing = Pairing.BOTH
349
+ ) -> MSAFuture:
324
350
  """
325
351
  Construct an MSA via homology search with the seed sequence.
326
352
 
@@ -328,6 +354,9 @@ class AlignAPI:
328
354
  ----------
329
355
  seed : bytes
330
356
  Seed sequence for the MSA construction.
357
+ pairing : Pairing, optional
358
+ Cross-chain pairing strategy for a complex (`:`-separated) seed;
359
+ has no effect on a single-chain seed. Defaults to `both`.
331
360
 
332
361
  Returns
333
362
  -------
@@ -340,7 +369,8 @@ class AlignAPI:
340
369
  If there is an issue with the API request.
341
370
  """
342
371
  return MSAFuture.create(
343
- session=self.session, job=api.msa_post(self.session, seed=seed)
372
+ session=self.session,
373
+ job=api._msa_mmseqs_search_post(self.session, seed=seed, pairing=pairing),
344
374
  )
345
375
 
346
376
  def upload_prompt(self, prompt_file: BinaryIO):
@@ -362,7 +392,7 @@ class AlignAPI:
362
392
  Raises
363
393
  ------
364
394
  DeprecationError
365
- This method is no longer supported.
395
+ Always. Use `create_prompt` on the `prompt` module instead.
366
396
  """
367
397
  raise DeprecationError(
368
398
  "This method is no longer supported! Use `create_prompt` on the `prompt` module instead."
@@ -391,7 +421,7 @@ class AlignAPI:
391
421
  Raises
392
422
  ------
393
423
  DeprecationError
394
- This method is no longer supported.
424
+ Always. Use `get_prompt` on the `prompt` module instead.
395
425
  """
396
426
  raise DeprecationError(
397
427
  "This method is no longer supported! Use `get_prompt` on the `prompt` module instead."