openprotein-python 0.8.2__tar.gz → 0.8.4__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 (85) hide show
  1. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/PKG-INFO +1 -1
  2. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/_version.py +1 -1
  3. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/predictor.py +7 -7
  4. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/umap/api.py +3 -3
  5. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/umap/umap.py +42 -15
  6. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/.gitignore +0 -0
  7. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/LICENSE.txt +0 -0
  8. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/README.md +0 -0
  9. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/__init__.py +0 -0
  10. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/align/__init__.py +0 -0
  11. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/align/align.py +0 -0
  12. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/align/api.py +0 -0
  13. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/align/future.py +0 -0
  14. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/align/msa.py +0 -0
  15. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/align/schemas.py +0 -0
  16. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/base.py +0 -0
  17. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/chains.py +0 -0
  18. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/common/__init__.py +0 -0
  19. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/common/features.py +0 -0
  20. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/common/model_metadata.py +0 -0
  21. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/common/reduction.py +0 -0
  22. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/config.py +0 -0
  23. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/csv.py +0 -0
  24. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/data/__init__.py +0 -0
  25. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/data/api.py +0 -0
  26. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/data/assaydataset.py +0 -0
  27. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/data/data.py +0 -0
  28. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/data/schemas.py +0 -0
  29. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/design/__init__.py +0 -0
  30. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/design/api.py +0 -0
  31. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/design/design.py +0 -0
  32. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/design/future.py +0 -0
  33. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/design/schemas.py +0 -0
  34. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/__init__.py +0 -0
  35. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/api.py +0 -0
  36. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/embeddings.py +0 -0
  37. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/esm.py +0 -0
  38. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/future.py +0 -0
  39. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/models.py +0 -0
  40. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/openprotein.py +0 -0
  41. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/poet.py +0 -0
  42. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/poet2.py +0 -0
  43. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/embeddings/schemas.py +0 -0
  44. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/errors.py +0 -0
  45. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fasta.py +0 -0
  46. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/__init__.py +0 -0
  47. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/alphafold2.py +0 -0
  48. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/api.py +0 -0
  49. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/boltz.py +0 -0
  50. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/esmfold.py +0 -0
  51. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/fold.py +0 -0
  52. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/future.py +0 -0
  53. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/models.py +0 -0
  54. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/fold/schemas.py +0 -0
  55. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/jobs/__init__.py +0 -0
  56. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/jobs/api.py +0 -0
  57. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/jobs/futures.py +0 -0
  58. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/jobs/jobs.py +0 -0
  59. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/jobs/schemas.py +0 -0
  60. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/models/__init__.py +0 -0
  61. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/models/base.py +0 -0
  62. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/models/foundation/rfdiffusion.py +0 -0
  63. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/models/models.py +0 -0
  64. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/__init__.py +0 -0
  65. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/api.py +0 -0
  66. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/models.py +0 -0
  67. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/prediction.py +0 -0
  68. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/schemas.py +0 -0
  69. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/predictor/validate.py +0 -0
  70. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/prompt/__init__.py +0 -0
  71. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/prompt/api.py +0 -0
  72. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/prompt/models.py +0 -0
  73. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/prompt/prompt.py +0 -0
  74. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/prompt/schemas.py +0 -0
  75. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/protein.py +0 -0
  76. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/svd/__init__.py +0 -0
  77. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/svd/api.py +0 -0
  78. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/svd/models.py +0 -0
  79. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/svd/schemas.py +0 -0
  80. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/svd/svd.py +0 -0
  81. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/umap/__init__.py +0 -0
  82. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/umap/models.py +0 -0
  83. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/umap/schemas.py +0 -0
  84. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/openprotein/utils/uuid.py +0 -0
  85. {openprotein_python-0.8.2 → openprotein_python-0.8.4}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openprotein-python
3
- Version: 0.8.2
3
+ Version: 0.8.4
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
@@ -41,7 +41,7 @@ def _get_importlib_metadata_version():
41
41
  """
42
42
  from importlib.metadata import version
43
43
 
44
- __version__ = version(__package__) # type: ignore
44
+ __version__ = version("openprotein-python")
45
45
  return __version__
46
46
 
47
47
 
@@ -133,20 +133,20 @@ class PredictorAPI:
133
133
  ----------
134
134
  assay : AssayMetadata or AssayDataset or str
135
135
  Assay to fit GP on.
136
- properties: list[str]
136
+ properties : list of str
137
137
  Properties in the assay to fit the gp on.
138
- feature_type: str | FeatureType | None
139
- Type of features to use for encoding sequences. "SVD" or "PLM".
140
- None would require model to be EmbeddingModel or SVDMode.
141
- model : EmbeddingModel | SVDModel | str
138
+ model : EmbeddingModel or SVDModel or str
142
139
  Instance of either EmbeddingModel or SVDModel to use depending
143
140
  on feature type. Can also be a str specifying the model id,
144
141
  but then feature_type would have to be specified.
145
- reduction : str | None
142
+ feature_type : FeatureType or None
143
+ Type of features to use for encoding sequences. "SVD" or "PLM".
144
+ None would require model to be EmbeddingModel or SVDModel.
145
+ reduction : str or None, optional
146
146
  Type of embedding reduction to use for computing features.
147
147
  E.g. "MEAN" or "SUM". Used only if using EmbeddingModel, and
148
148
  must be non-nil if using an EmbeddingModel. Defaults to None.
149
- kwargs:
149
+ kwargs :
150
150
  Additional keyword arguments to be passed to foundational models, e.g. prompt_id for PoET models.
151
151
 
152
152
  Returns
@@ -156,7 +156,7 @@ def umap_delete(session: APISession, umap_id: str) -> bool:
156
156
  def umap_fit_post(
157
157
  session: APISession,
158
158
  model_id: str,
159
- feature_type: FeatureType,
159
+ feature_type: str,
160
160
  sequences: list[bytes] | list[str] | None = None,
161
161
  assay_id: str | None = None,
162
162
  n_components: int = 2,
@@ -174,7 +174,7 @@ def umap_fit_post(
174
174
  Session object for API communication.
175
175
  model_id : str
176
176
  Model to use. Can be either svd_id or id of a foundational model.
177
- feature_type: FeatureType
177
+ feature_type: str
178
178
  Type of feature to use for fitting UMAP. Either PLM or SVD.
179
179
  sequences : list[bytes] | None, optional
180
180
  Optional sequences to fit UMAP with. Either use sequences or
@@ -203,7 +203,7 @@ def umap_fit_post(
203
203
 
204
204
  body = {
205
205
  "model_id": model_id,
206
- "feature_type": feature_type.value,
206
+ "feature_type": feature_type,
207
207
  "n_components": n_components,
208
208
  "n_neighbors": n_neighbors,
209
209
  "min_dist": min_dist,
@@ -3,10 +3,10 @@
3
3
  from openprotein.base import APISession
4
4
  from openprotein.common import FeatureType, ReductionType
5
5
  from openprotein.data import AssayDataset, AssayMetadata
6
- from openprotein.embeddings import EmbeddingModel
6
+ from openprotein.embeddings import EmbeddingModel, EmbeddingsAPI
7
7
  from openprotein.errors import InvalidParameterError
8
8
  from openprotein.jobs import JobsAPI
9
- from openprotein.svd import SVDModel
9
+ from openprotein.svd import SVDAPI, SVDModel
10
10
 
11
11
  from . import api
12
12
  from .models import UMAPModel
@@ -38,8 +38,6 @@ class UMAPAPI:
38
38
 
39
39
  Parameters
40
40
  ----------
41
- model_id : str
42
- The ID of the model to fit the UMAP on.
43
41
  sequences: list of bytes or None, optional
44
42
  Optional sequences to fit UMAP with. Either use sequences or
45
43
  assay_id. sequences is preferred.
@@ -47,17 +45,24 @@ class UMAPAPI:
47
45
  Optional assay containing sequences to fit SVD with.
48
46
  Or its assay_id. Either use sequences or assay.
49
47
  Ignored if sequences are provided.
50
- n_components: int
48
+ model : EmbeddingModel or SVDModel or str
49
+ Instance of either EmbeddingModel or SVDModel to use depending
50
+ on feature type. Can also be a str specifying the model id,
51
+ but then feature_type would have to be specified.
52
+ feature_type : FeatureType or None, optional
53
+ Type of features to use for encoding sequences. "SVD" or "PLM".
54
+ None would require model to be EmbeddingModel or SVDModel.
55
+ n_components : int, optional
51
56
  Number of UMAP components to fit. Defaults to 2.
52
- n_neighbors: int
57
+ n_neighbors : int, optional
53
58
  Number of neighbors to use for fitting. Defaults to 15.
54
- min_dist: float
59
+ min_dist : float, optional
55
60
  Minimum distance in UMAP fitting. Defaults to 0.1.
56
- reduction: str or None, optional
61
+ reduction : str or None, optional
57
62
  Type of embedding reduction to use for computing features.
58
63
  E.g. "MEAN" or "SUM". Useful when dealing with variable length
59
64
  sequence. Defaults to None.
60
- kwargs:
65
+ kwargs :
61
66
  Additional keyword arguments to be passed to foundational models, e.g. prompt_id for PoET models.
62
67
 
63
68
  Returns
@@ -65,14 +70,35 @@ class UMAPAPI:
65
70
  UMAPModel
66
71
  The UMAP model being fit.
67
72
  """
68
- if isinstance(model, str):
69
- if feature_type is None:
73
+ # extract feature type
74
+ feature_type = (
75
+ FeatureType.PLM
76
+ if isinstance(model, EmbeddingModel)
77
+ else FeatureType.SVD if isinstance(model, SVDModel) else feature_type
78
+ )
79
+ if feature_type is None:
80
+ raise InvalidParameterError(
81
+ "Expected feature_type to be provided if passing str model_id as model"
82
+ )
83
+ # get model if model_id
84
+ if feature_type == FeatureType.PLM:
85
+ if reduction is None:
70
86
  raise InvalidParameterError(
71
- "Expected feature_type to be specified if using a string identifier as model"
87
+ "Expected reduction if using EmbeddingModel"
72
88
  )
73
- model_id = model
74
- else:
75
- model_id = model.id # for embeddings / svd model
89
+ if isinstance(model, str):
90
+ embeddings_api = getattr(self.session, "embedding", None)
91
+ assert isinstance(embeddings_api, EmbeddingsAPI)
92
+ model = embeddings_api.get_model(model)
93
+ assert isinstance(model, EmbeddingModel), "Expected EmbeddingModel"
94
+ model_id = model.id
95
+ elif feature_type == FeatureType.SVD:
96
+ if isinstance(model, str):
97
+ svd_api = getattr(self.session, "svd", None)
98
+ assert isinstance(svd_api, SVDAPI)
99
+ model = svd_api.get_svd(model)
100
+ assert isinstance(model, SVDModel), "Expected SVDModel"
101
+ model_id = model.id
76
102
  # get assay_id
77
103
  assay_id = (
78
104
  assay.assay_id
@@ -84,6 +110,7 @@ class UMAPAPI:
84
110
  job=api.umap_fit_post(
85
111
  session=self.session,
86
112
  model_id=model_id,
113
+ feature_type=feature_type,
87
114
  sequences=sequences,
88
115
  assay_id=assay_id,
89
116
  n_components=n_components,