openprotein-python 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl

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.
@@ -134,7 +134,7 @@ def design_delete(session: APISession, design_id: str):
134
134
  def designer_get_design_results(
135
135
  session: APISession,
136
136
  design_id: str,
137
- step: int | None = -1,
137
+ step: int | None = None,
138
138
  ) -> Iterator[list[str]]:
139
139
  """
140
140
  Get csv encoded results for a design ID.
@@ -154,6 +154,8 @@ def designer_get_design_results(
154
154
  """
155
155
  params = {}
156
156
  if step is not None:
157
+ if step != -1:
158
+ step -= 1
157
159
  params["step"] = step
158
160
  endpoint = PATH_PREFIX + f"/{design_id}/results"
159
161
  response = session.get(endpoint, params=params, stream=True)
@@ -195,8 +197,8 @@ def decode_design_result(
195
197
  )
196
198
  preds = np.array([float(pred) for pred in row[pred_start_index:]])
197
199
  result = DesignResult(
198
- step=int(row[0]),
199
- sample_index=int(row[1]),
200
+ step=int(row[0]) + 1,
201
+ sample_index=int(row[1]) + 1,
200
202
  sequence=row[2],
201
203
  scores=scores,
202
204
  subscores=subscores,
@@ -120,9 +120,9 @@ class DesignFuture(StreamingFuture, Future):
120
120
  """
121
121
  return designer.design_delete(session=self.session, design_id=self.id)
122
122
 
123
- def stream(self) -> Generator:
123
+ def stream(self, step: int | None = None) -> Generator:
124
124
  stream = designer.designer_get_design_results(
125
- session=self.session, design_id=self.id
125
+ session=self.session, design_id=self.id, step=step
126
126
  )
127
127
  return designer.decode_design_results_stream(data=stream)
128
128
 
@@ -160,7 +160,7 @@ class Future(ABC):
160
160
  self.job = self._refresh_job()
161
161
 
162
162
  @abstractmethod
163
- def get(self, verbose: bool = False):
163
+ def get(self, verbose: bool = False, **kwargs):
164
164
  """Return the results from this job."""
165
165
  raise NotImplementedError()
166
166
 
@@ -267,13 +267,13 @@ class Future(ABC):
267
267
 
268
268
  class StreamingFuture(ABC):
269
269
  @abstractmethod
270
- def stream(self) -> Generator:
270
+ def stream(self, **kwargs) -> Generator:
271
271
  """Return the results from this job as a generator."""
272
272
  raise NotImplementedError()
273
273
 
274
- def get(self, verbose: bool = False) -> list:
274
+ def get(self, verbose: bool = False, **kwargs) -> list:
275
275
  """Return the results from this job."""
276
- generator = self.stream()
276
+ generator = self.stream(**kwargs)
277
277
  if verbose:
278
278
  total = None
279
279
  if hasattr(self, "__len__"):
@@ -150,29 +150,46 @@ class DesignConstraint:
150
150
  self.sequence = sequence
151
151
  self.mutations = self.initialize(sequence)
152
152
 
153
- def initialize(self, sequence: str) -> dict[int, list[str]]:
153
+ def initialize(self, sequence: str) -> dict[int, set[str]]:
154
154
  """Initialize with no changes allowed to the sequence."""
155
- return {i: [aa] for i, aa in enumerate(sequence, start=1)}
155
+ return {i: {aa} for i, aa in enumerate(sequence, start=1)}
156
156
 
157
- def allow(self, positions: int | list[int], amino_acids: list[str] | str) -> None:
157
+ def allow(
158
+ self,
159
+ amino_acids: list[str] | str | None = None,
160
+ positions: int | list[int] | None = None,
161
+ ) -> None:
158
162
  """Allow specific amino acids at given positions."""
159
163
  if isinstance(positions, int):
160
164
  positions = [positions]
165
+ elif positions is None:
166
+ positions = [i + 1 for i in range(len(self.sequence))]
161
167
  if isinstance(amino_acids, str):
162
168
  amino_acids = list(amino_acids)
169
+ elif amino_acids is None:
170
+ amino_acids = list(self.sequence)
163
171
 
164
172
  for position in positions:
165
173
  if position in self.mutations:
166
- self.mutations[position].extend(amino_acids)
174
+ for aa in amino_acids:
175
+ self.mutations[position].add(aa)
167
176
  else:
168
- self.mutations[position] = amino_acids
177
+ self.mutations[position] = set(amino_acids)
169
178
 
170
- def remove(self, positions: int | list[int], amino_acids: list[str] | str) -> None:
179
+ def remove(
180
+ self,
181
+ amino_acids: list[str] | str | None = None,
182
+ positions: int | list[int] | None = None,
183
+ ) -> None:
171
184
  """Remove specific amino acids from being allowed at given positions."""
172
185
  if isinstance(positions, int):
173
186
  positions = [positions]
187
+ elif positions is None:
188
+ positions = [i + 1 for i in range(len(self.sequence))]
174
189
  if isinstance(amino_acids, str):
175
190
  amino_acids = list(amino_acids)
191
+ elif amino_acids is None:
192
+ amino_acids = list(self.sequence)
176
193
 
177
194
  for position in positions:
178
195
  if position in self.mutations:
@@ -182,4 +199,4 @@ class DesignConstraint:
182
199
 
183
200
  def as_dict(self) -> dict[int, list[str]]:
184
201
  """Convert the internal mutations representation into a dictionary."""
185
- return self.mutations
202
+ return {i: list(aa) for i, aa in self.mutations.items()}
@@ -44,7 +44,7 @@ class PredictorMetadata(BaseModel):
44
44
  status: JobStatus
45
45
  model_spec: ModelSpec
46
46
  training_dataset: Dataset
47
- traingraphs: list["TrainGraph"]
47
+ traingraphs: list["TrainGraph"] | None = None
48
48
 
49
49
  def is_done(self):
50
50
  return self.status.done()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openprotein_python
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: OpenProtein Python interface.
5
5
  Author-email: Mark Gee <markgee@ne47.bio>
6
6
  License: MIT
@@ -9,7 +9,7 @@ openprotein/align/__init__.py,sha256=_FC_ThFzqGXTVI8f3AKeAoOSV3l_5vuNDEykdNezhao
9
9
  openprotein/api/__init__.py,sha256=wTmRFytIvlTDh7Wt-YhLHjSj0bxXhDIyA0r4pPdwWck,150
10
10
  openprotein/api/align.py,sha256=W6M_xAKYLprICYR47BUaqzD1PrLpkCUZfbewKKkwrgM,12593
11
11
  openprotein/api/assaydata.py,sha256=yQpNPWw1HjKx0VkEucfx7_BLgCn7ItY68EoDEidnEMo,5717
12
- openprotein/api/designer.py,sha256=q5YKdoBRUZ_dYkWKR4qqWu09DzVo6VBJItmSvkLil5g,8212
12
+ openprotein/api/designer.py,sha256=pGAAKn7J30mYV5SEzTco9Q2gpnAQ4Pcbd6aRGZqp_a4,8267
13
13
  openprotein/api/embedding.py,sha256=_tPRrmb_54tRWhDq6jPsw5xOOLmGRSbzAv4rbK9fI9Q,10926
14
14
  openprotein/api/fold.py,sha256=WP2VFuHzD5XZDAYFWzx2HFdjKvwp_rJZD1nG2PdeeNg,4308
15
15
  openprotein/api/job.py,sha256=aE-S5Q2ZI3BAt6XpezWKC3f4Dw2FWYWm8INfGWblw4w,2710
@@ -25,8 +25,8 @@ openprotein/app/__init__.py,sha256=JM6W5BA5UgyoN5g24UUfU15MVGEGTxx4x2inAXJiuv8,2
25
25
  openprotein/app/deprecated.py,sha256=WPfICnE_AFOpzxuhvKj5TDBfiokmsIWK5zyEGoXVtxQ,217
26
26
  openprotein/app/models/__init__.py,sha256=xGvNRgNeeehm7QSS9T6RugJ3kiORN1mdVyFSvzR7xsI,757
27
27
  openprotein/app/models/assaydata.py,sha256=QdX2Y4FI2QZ6Qnz2zT5X_0kPua1qlM0waNU0S3Jcs4g,4808
28
- openprotein/app/models/designer.py,sha256=OBsG1IOm38hPzRmEGW4XAbt7PjFZRfiQyREOAGMKmRg,4244
29
- openprotein/app/models/futures.py,sha256=rRDeL8qfSyZrUlrCa8_Veh2vkO6Cm9n4XxhwQ8TjDt0,15405
28
+ openprotein/app/models/designer.py,sha256=mVhv3AeYQzfVaYXj4575T72SeApZ1FUFnNV1XdVWIRk,4280
29
+ openprotein/app/models/futures.py,sha256=p4noFpfOYxWyqfBfvYrJ-bylatYBg-fRX3IZcd7KpU8,15443
30
30
  openprotein/app/models/svd.py,sha256=ZSOIur-oDYtZm3SAtZD5Igi-FxHmzNNqOl78tJoZNwI,8063
31
31
  openprotein/app/models/umap.py,sha256=KJzfD1GXOgPP_fkeKw_TDo_FKTavBNLsRaDTaG6qXCA,4421
32
32
  openprotein/app/models/align/__init__.py,sha256=3G7GYvtnDciJQIzFKa2OHPmsp0TcobUozwzMJmzMuv8,125
@@ -76,13 +76,13 @@ openprotein/predictor/__init__.py,sha256=4jX69K1KVZIraxZmOq_A6Sces5E51nnInGxnP3R
76
76
  openprotein/schemas/__init__.py,sha256=G8gTT5eKeVj12AiQp6HNZrHTbuneS_iNufEpz_qc2_o,1224
77
77
  openprotein/schemas/align.py,sha256=LoAb_L_XavgYUmzzS-v31nN4wMGBFqOktvqcXl9jnfo,1222
78
78
  openprotein/schemas/assaydata.py,sha256=ryoprmbRA_cPQHYTbUa0XGN1gDlWPhLJGgUtdZ5Tt4s,565
79
- openprotein/schemas/design.py,sha256=J_kcgSZQWymeUkbXUJG3zeLfB51fkK-GewylNROYFAk,6122
79
+ openprotein/schemas/design.py,sha256=koTLJvQiteYIQ1TEOtJMVQxDc0wpqjqq0LEJ4x4Cpc4,6668
80
80
  openprotein/schemas/designer.py,sha256=rxhaXiAQTWF9zASoN-puY2gWUnOs2wduCuJjw1yZqBA,835
81
81
  openprotein/schemas/embeddings.py,sha256=YpHJ46Qx0xox46LyyEdMc6iBfk4OP-_DtHJtNGOV-Bw,2176
82
82
  openprotein/schemas/features.py,sha256=RpRBEwJ4oB18jGeJFjyXyvphcCa4SyXnduXk1D57Tbc,87
83
83
  openprotein/schemas/fold.py,sha256=izLG-qTKWLsTeT4XlloFuWnRjdINZb44r6mcCKpJJJ0,185
84
84
  openprotein/schemas/job.py,sha256=koqGBfVqyd8-HlEZrJoAKMhGM91yQgO63jCrm5HJlMU,3904
85
- openprotein/schemas/predictor.py,sha256=IytkNfg4w_aa-Kt0NI2Bu_Bnk8zG3xL_5JLWE5c8u5c,1657
85
+ openprotein/schemas/predictor.py,sha256=7LcldH4affV5_lqYCrVHsgz3UAmHcBjluHMxvjqvSAw,1671
86
86
  openprotein/schemas/svd.py,sha256=yIj14WyZusjy_ZYwKRBvfwN574fuaMdG5nn6iSNWsjA,668
87
87
  openprotein/schemas/umap.py,sha256=Hfg_NwVTRv5uZHEWFYEx73IuZLMUJ50KBsbdsxMH8L4,792
88
88
  openprotein/schemas/deprecated/__init__.py,sha256=TSWiWtx3eeNmWplOSHNuiDz349ptiv_3pBmXsILro78,468
@@ -90,7 +90,7 @@ openprotein/schemas/deprecated/design.py,sha256=L6sKI8Z4JPwr6YIahE_n7A4HEgyVYVoJ
90
90
  openprotein/schemas/deprecated/poet.py,sha256=bWprjLIC7cSCNSMMTco0BGJ3lMCTH9R2X_bSr8BQLZY,1918
91
91
  openprotein/schemas/deprecated/predict.py,sha256=c-ui9HqQMslmjPag9tEUUPqo_qJgAGn1xQYcpZwSFLs,1932
92
92
  openprotein/schemas/deprecated/train.py,sha256=Nfd0iU7ZFW_Dn-YP4Cmii79CzLwh0Xfc96JrfrpxpRQ,643
93
- openprotein_python-0.6.0.dist-info/METADATA,sha256=meTh-NV3vwWQUsZe5K2IN-AiChyUCOysEhsO5joZAbw,7452
94
- openprotein_python-0.6.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
95
- openprotein_python-0.6.0.dist-info/licenses/LICENSE.txt,sha256=amMkJEL2uNWuwaaj25UfyZ37g-KwGF7E3ingj7_Xu4A,1543
96
- openprotein_python-0.6.0.dist-info/RECORD,,
93
+ openprotein_python-0.6.2.dist-info/METADATA,sha256=cKekVCkNL58uVOAU5RJT9iFmR8LjuUxL-MA_iv07vLs,7452
94
+ openprotein_python-0.6.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
95
+ openprotein_python-0.6.2.dist-info/licenses/LICENSE.txt,sha256=amMkJEL2uNWuwaaj25UfyZ37g-KwGF7E3ingj7_Xu4A,1543
96
+ openprotein_python-0.6.2.dist-info/RECORD,,