Skip to content

Commit 5c73952

Browse files
committed
Release v0.6.1
1 parent c291fe9 commit 5c73952

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION ?= 0.6.0
1+
VERSION ?= 0.6.1
22
SHELL := /bin/bash
33

44
.PHONY: releasehere

anaconda_build/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: openprotein-python
3-
version: "0.6.0"
3+
version: "0.6.1"
44

55
source:
66
path: ../

openprotein/schemas/design.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,29 +150,46 @@ def __init__(self, sequence: str):
150150
self.sequence = sequence
151151
self.mutations = self.initialize(sequence)
152152

153-
def initialize(self, sequence: str) -> dict[int, list[str]]:
153+
def initialize(self, sequence: str) -> dict[int, set[str]]:
154154
"""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)}
156156

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:
158162
"""Allow specific amino acids at given positions."""
159163
if isinstance(positions, int):
160164
positions = [positions]
165+
elif positions is None:
166+
positions = [i + 1 for i in range(len(self.sequence))]
161167
if isinstance(amino_acids, str):
162168
amino_acids = list(amino_acids)
169+
elif amino_acids is None:
170+
amino_acids = list(self.sequence)
163171

164172
for position in positions:
165173
if position in self.mutations:
166-
self.mutations[position].extend(amino_acids)
174+
for aa in amino_acids:
175+
self.mutations[position].add(aa)
167176
else:
168-
self.mutations[position] = amino_acids
177+
self.mutations[position] = set(amino_acids)
169178

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:
171184
"""Remove specific amino acids from being allowed at given positions."""
172185
if isinstance(positions, int):
173186
positions = [positions]
187+
elif positions is None:
188+
positions = [i + 1 for i in range(len(self.sequence))]
174189
if isinstance(amino_acids, str):
175190
amino_acids = list(amino_acids)
191+
elif amino_acids is None:
192+
amino_acids = list(self.sequence)
176193

177194
for position in positions:
178195
if position in self.mutations:
@@ -182,4 +199,4 @@ def remove(self, positions: int | list[int], amino_acids: list[str] | str) -> No
182199

183200
def as_dict(self) -> dict[int, list[str]]:
184201
"""Convert the internal mutations representation into a dictionary."""
185-
return self.mutations
202+
return {i: list(aa) for i, aa in self.mutations.items()}

openprotein/schemas/predictor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class PredictorMetadata(BaseModel):
4444
status: JobStatus
4545
model_spec: ModelSpec
4646
training_dataset: Dataset
47-
traingraphs: list["TrainGraph"]
47+
traingraphs: list["TrainGraph"] | None = None
4848

4949
def is_done(self):
5050
return self.status.done()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "openprotein_python"
33
packages = [{ include = "openprotein" }]
4-
version = "0.6.0"
4+
version = "0.6.1"
55
description = "OpenProtein Python interface."
66
license = "MIT"
77
readme = "README.md"

0 commit comments

Comments
 (0)