Skip to content

Commit

Permalink
Release v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
markgeejw committed Dec 9, 2024
1 parent c291fe9 commit 5c73952
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION ?= 0.6.0
VERSION ?= 0.6.1
SHELL := /bin/bash

.PHONY: releasehere
Expand Down
2 changes: 1 addition & 1 deletion anaconda_build/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: openprotein-python
version: "0.6.0"
version: "0.6.1"

source:
path: ../
Expand Down
31 changes: 24 additions & 7 deletions openprotein/schemas/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,46 @@ def __init__(self, sequence: str):
self.sequence = sequence
self.mutations = self.initialize(sequence)

def initialize(self, sequence: str) -> dict[int, list[str]]:
def initialize(self, sequence: str) -> dict[int, set[str]]:
"""Initialize with no changes allowed to the sequence."""
return {i: [aa] for i, aa in enumerate(sequence, start=1)}
return {i: {aa} for i, aa in enumerate(sequence, start=1)}

def allow(self, positions: int | list[int], amino_acids: list[str] | str) -> None:
def allow(
self,
amino_acids: list[str] | str | None = None,
positions: int | list[int] | None = None,
) -> None:
"""Allow specific amino acids at given positions."""
if isinstance(positions, int):
positions = [positions]
elif positions is None:
positions = [i + 1 for i in range(len(self.sequence))]
if isinstance(amino_acids, str):
amino_acids = list(amino_acids)
elif amino_acids is None:
amino_acids = list(self.sequence)

for position in positions:
if position in self.mutations:
self.mutations[position].extend(amino_acids)
for aa in amino_acids:
self.mutations[position].add(aa)
else:
self.mutations[position] = amino_acids
self.mutations[position] = set(amino_acids)

def remove(self, positions: int | list[int], amino_acids: list[str] | str) -> None:
def remove(
self,
amino_acids: list[str] | str | None = None,
positions: int | list[int] | None = None,
) -> None:
"""Remove specific amino acids from being allowed at given positions."""
if isinstance(positions, int):
positions = [positions]
elif positions is None:
positions = [i + 1 for i in range(len(self.sequence))]
if isinstance(amino_acids, str):
amino_acids = list(amino_acids)
elif amino_acids is None:
amino_acids = list(self.sequence)

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

def as_dict(self) -> dict[int, list[str]]:
"""Convert the internal mutations representation into a dictionary."""
return self.mutations
return {i: list(aa) for i, aa in self.mutations.items()}
2 changes: 1 addition & 1 deletion openprotein/schemas/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PredictorMetadata(BaseModel):
status: JobStatus
model_spec: ModelSpec
training_dataset: Dataset
traingraphs: list["TrainGraph"]
traingraphs: list["TrainGraph"] | None = None

def is_done(self):
return self.status.done()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "openprotein_python"
packages = [{ include = "openprotein" }]
version = "0.6.0"
version = "0.6.1"
description = "OpenProtein Python interface."
license = "MIT"
readme = "README.md"
Expand Down

0 comments on commit 5c73952

Please sign in to comment.