Skip to content

Commit 922c573

Browse files
committed
release v0.5.1
1 parent 60d0122 commit 922c573

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2770
-529
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION ?= 0.5.0
1+
VERSION ?= 0.5.2
22
SHELL := /bin/bash
33

44
.PHONY: releasehere

anaconda_build/meta.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: openprotein-python
3-
version: "0.5.0"
3+
version: "0.5.2"
44

55
source:
66
path: ../
@@ -12,19 +12,19 @@ build:
1212

1313
requirements:
1414
build:
15-
- python >=3.10,<3.11
15+
- python >=3.10
1616
- hatchling >=1.25.0,<2
1717
host:
18-
- python >=3.10,<3.11
18+
- python >=3.10
1919
- pip
2020
- hatchling >=1.25.0,<2
2121
run:
22-
- python >=3.10,<3.11
22+
- python >=3.10
2323
- requests >=2.32.3,<3
2424
- pydantic >=2.5,<3
2525
- tqdm >=4.66.5,<5
26-
- pandas >=2.1.4,<3
27-
- numpy >=2.1.1,<3
26+
- pandas >=2.2.2,<3
27+
- numpy >=1.9,<3
2828

2929
about:
3030
home: https://www.openprotein.ai/

openprotein/__init__.py

+53-23
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
"""
2+
OpenProtein Python client.
3+
4+
A pythonic interface for interacting with our cutting-edge protein engineering platform.
5+
6+
isort:skip_file
7+
"""
8+
19
from openprotein._version import __version__
210
from openprotein.app import (
3-
SVDAPI,
4-
AlignAPI,
511
AssayDataAPI,
12+
JobsAPI,
13+
TrainingAPI,
614
DesignAPI,
15+
AlignAPI,
716
EmbeddingsAPI,
817
FoldAPI,
9-
JobsAPI,
18+
SVDAPI,
19+
UMAPAPI,
1020
PredictorAPI,
11-
TrainingAPI,
21+
DesignerAPI,
1222
)
1323
from openprotein.app.models import Future
1424
from openprotein.base import APISession
@@ -19,15 +29,17 @@ class OpenProtein(APISession):
1929
The base class for accessing OpenProtein API functionality.
2030
"""
2131

22-
_embedding = None
23-
_svd = None
24-
_fold = None
25-
_align = None
26-
_jobs = None
2732
_data = None
33+
_jobs = None
2834
_train = None
2935
_design = None
36+
_align = None
37+
_embedding = None
38+
_svd = None
39+
_umap = None
40+
_fold = None
3041
_predictor = None
42+
_designer = None
3143

3244
def wait(self, future: Future, *args, **kwargs):
3345
return future.wait(*args, **kwargs)
@@ -37,15 +49,6 @@ def wait(self, future: Future, *args, **kwargs):
3749
def load_job(self, job_id):
3850
return self.jobs.__load(job_id=job_id)
3951

40-
@property
41-
def jobs(self) -> JobsAPI:
42-
"""
43-
The jobs submodule gives access to functionality for listing jobs and checking their status.
44-
"""
45-
if self._jobs is None:
46-
self._jobs = JobsAPI(self)
47-
return self._jobs
48-
4952
@property
5053
def data(self) -> AssayDataAPI:
5154
"""
@@ -55,6 +58,15 @@ def data(self) -> AssayDataAPI:
5558
self._data = AssayDataAPI(self)
5659
return self._data
5760

61+
@property
62+
def jobs(self) -> JobsAPI:
63+
"""
64+
The jobs submodule gives access to functionality for listing jobs and checking their status.
65+
"""
66+
if self._jobs is None:
67+
self._jobs = JobsAPI(self)
68+
return self._jobs
69+
5870
@property
5971
def train(self) -> TrainingAPI:
6072
"""
@@ -64,6 +76,15 @@ def train(self) -> TrainingAPI:
6476
self._train = TrainingAPI(self)
6577
return self._train
6678

79+
@property
80+
def design(self) -> DesignAPI:
81+
"""
82+
The design submodule gives access to functionality for designing new sequences using models from train.
83+
"""
84+
if self._design is None:
85+
self._design = DesignAPI(self)
86+
return self._design
87+
6788
@property
6889
def align(self) -> AlignAPI:
6990
"""
@@ -91,6 +112,15 @@ def svd(self) -> SVDAPI:
91112
self._svd = SVDAPI(self, self.embedding)
92113
return self._svd
93114

115+
@property
116+
def umap(self) -> UMAPAPI:
117+
"""
118+
The embedding submodule gives access to protein embedding models and their inference endpoints.
119+
"""
120+
if self._umap is None:
121+
self._umap = UMAPAPI(self)
122+
return self._umap
123+
94124
@property
95125
def predictor(self) -> PredictorAPI:
96126
"""
@@ -101,13 +131,13 @@ def predictor(self) -> PredictorAPI:
101131
return self._predictor
102132

103133
@property
104-
def design(self) -> DesignAPI:
134+
def designer(self) -> DesignerAPI:
105135
"""
106-
The design submodule gives access to functionality for designing new sequences using models from train.
136+
The designer submodule gives access to functionality for designing new sequences using models from predictor train.
107137
"""
108-
if self._design is None:
109-
self._design = DesignAPI(self)
110-
return self._design
138+
if self._designer is None:
139+
self._designer = DesignerAPI(self)
140+
return self._designer
111141

112142
@property
113143
def fold(self) -> FoldAPI:

openprotein/api/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from . import align, assaydata, design, embedding, fold, predict, predictor, train
2-
from .deprecated import poet

openprotein/api/align.py

+1-23
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,15 @@
1-
import codecs
2-
import csv
31
import io
42
import random
53
from typing import BinaryIO, Iterator
64

75
import openprotein.config as config
86
import requests
97
from openprotein.base import APISession
8+
from openprotein.csv import csv_stream
109
from openprotein.errors import APIError, InvalidParameterError, MissingParameterError
1110
from openprotein.schemas import Job, MSASamplingMethod, PoetInputType
1211

1312

14-
def csv_stream(response: requests.Response) -> Iterator[list[str]]:
15-
"""
16-
Returns a CSV reader from a requests.Response object.
17-
18-
Parameters
19-
----------
20-
response : requests.Response
21-
The response object to parse.
22-
23-
Returns
24-
-------
25-
csv.reader
26-
A csv reader object for the response.
27-
"""
28-
raw_content = response.raw # the raw bytes stream
29-
content = codecs.getreader("utf-8")(
30-
raw_content
31-
) # force the response to be encoded as utf-8
32-
return csv.reader(content)
33-
34-
3513
def get_align_job_inputs(
3614
session: APISession,
3715
job_id: str,

openprotein/api/deprecated/poet.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
from openprotein import config
66
from openprotein.base import APISession
77
from openprotein.errors import APIError, InvalidParameterError, MissingParameterError
8-
from openprotein.schemas import PoetGenerateJob, PoetScoreJob, PoetSSPJob
8+
from openprotein.schemas.deprecated.poet import (
9+
PoetGenerateJob,
10+
PoetScoreJob,
11+
PoetSSPJob,
12+
)
913

1014

1115
def poet_score_post(

openprotein/api/design.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from openprotein.base import APISession
2-
from openprotein.schemas import DesignJobCreate, DesignResults, Job
2+
from openprotein.schemas import (
3+
WorkflowDesign,
4+
WorkflowDesignJob,
5+
WorkflowDesignJobCreate,
6+
)
37

48

5-
def create_design_job(session: APISession, design_job: DesignJobCreate):
9+
def create_design_job(session: APISession, design_job: WorkflowDesignJobCreate):
610
"""
711
Send a POST request for protein design job.
812
@@ -13,7 +17,7 @@ def create_design_job(session: APISession, design_job: DesignJobCreate):
1317
design_job : DesignJobCreate
1418
The details of the design job to be created, with the following parameters:
1519
- assay_id: The ID for the assay.
16-
- criteria: A list of CriterionItem lists for evaluating the design.
20+
- criteria: Criteria for evaluating the design.
1721
- num_steps: The number of steps in the genetic algo. Default is 8.
1822
- pop_size: The population size for the genetic algo. Default is None.
1923
- n_offsprings: The number of offspring for the genetic algo. Default is None.
@@ -24,13 +28,13 @@ def create_design_job(session: APISession, design_job: DesignJobCreate):
2428
2529
Returns
2630
-------
27-
Job
31+
WorkflowDesignJob
2832
The created job as a Job instance.
2933
"""
3034
params = design_job.model_dump(exclude_none=True)
3135
# print(f"sending design: {params}")
3236
response = session.post("v1/workflow/design/genetic-algorithm", json=params)
33-
return Job.model_validate(response.json())
37+
return WorkflowDesignJob.model_validate(response.json())
3438

3539

3640
def get_design_results(
@@ -39,7 +43,7 @@ def get_design_results(
3943
step: int | None = None,
4044
page_size: int | None = None,
4145
page_offset: int | None = None,
42-
) -> DesignResults:
46+
) -> WorkflowDesign:
4347
"""
4448
Retrieves the results of a Design job.
4549
@@ -60,7 +64,7 @@ def get_design_results(
6064
6165
Returns
6266
-------
63-
DesignJob
67+
WorkflowDesignJob
6468
The job object representing the Design job.
6569
6670
Raises
@@ -79,4 +83,4 @@ def get_design_results(
7983

8084
response = session.get(endpoint, params=params)
8185

82-
return DesignResults.model_validate(response.json())
86+
return WorkflowDesign.model_validate(response.json())

0 commit comments

Comments
 (0)