Skip to content

Commit c40231a

Browse files
author
mbarber
committed
updated docs
1 parent d9c1584 commit c40231a

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# openprotein-python
22
Python interface for the OpenProtein.AI REST API.
33

4-
Work-in-progress. Currently supports basic exampination of jobs and running predictions for query sequences and single site variants with PoET.
4+
## Installation
55

6-
Each module has a raw/low level set of functions that directly call the REST API endpoints. On top of that, a higher level interface exists for authenticating a session, then accessing the functionality via high-level APIs. Long running POST/GET paradigm calls return a Future object that can be polled to see if the result is ready, and then used to retrieve the result. It also implements an interface for synchronously waiting for the result.
6+
You can install with pip:
77

8+
```
9+
pip install openprotein-python
10+
```
811
## Getting started
912

1013
First, create a session using your login credentials.
@@ -19,18 +22,10 @@ Given a future, check its status and retrieve results
1922
```
2023
future.refresh() # call the backend to update the job status
2124
future.done() # returns True if the job is done, meaning the status could be SUCCESS, FAILED, or CANCELLED
25+
future.wait() # wait until done and then fetch results, verbosity is controlled with verbose arg.
2226
result = future.get() # get the result from a finished job
2327
```
2428

25-
To wait for a job to finish and return the result, use `future.wait()`
26-
```
27-
# this will poll the backend for the job status every 2.5 seconds
28-
# for up to 600 seconds. If it takes longer than 600 seconds for the result
29-
# to be ready, this will raise a TimeoutException
30-
# verbose=True will print the time elapsed and job status using `tqdm`
31-
result = future.wait(interval=2.5, timeout=600, verbose=True)
32-
```
33-
3429

3530
### Jobs interface
3631

@@ -40,44 +35,55 @@ session.jobs.list() # list all jobs
4035
session.jobs.get(JOB_ID) # get a specific job
4136
```
4237

38+
Resume an `AsyncJobFuture` from where you left off with each API's load_job:
39+
40+
For example for training jobs:
41+
42+
```
43+
session.train.load_job(JOB_ID)
44+
```
4345
### PoET interface
4446

4547
Score sequences using the PoET interface.
4648
```
47-
prompt = b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN'
49+
prompt_seqs = b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN'
50+
51+
prompt = session.poet.upload_prompt(prompt_seqs)
52+
```
53+
54+
```
4855
queries = [
4956
b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN',
5057
b'MALWMRLLPLLVLLALWGPDPASAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN',
5158
b'MALWTRLRPLLALLALWPPPPARAFVNQHLCGSHLVEALYLVCGERGFFYTPKARREVEGPQVGALELAGGPGAGGLEGPPQKRGIVEQCCASVCSLYQLENYCN',
5259
b'MALWIRSLPLLALLVFSGPGTSYAAANQHLCGSHLVEALYLVCGERGFFYSPKARRDVEQPLVSSPLRGEAGVLPFQQEEYEKVKRGIVEQCCHNTCSLYQLENYCN',
5360
b'MALWMRLLPLLALLALWAPAPTRAFVNQHLCGSHLVEALYLVCGERGFFYTPKARREVEDLQVRDVELAGAPGEGGLQPLALEGALQKRGIVEQCCTSICSLYQLENYCN',
5461
]
55-
future = session.poet.score(prompt, queries, prompt_is_seed=True)
62+
```
63+
64+
```
65+
future = session.poet.score(prompt, queries)
5666
result = future.wait()
5767
# result is a list of (sequence, score) pydantic objects
5868
```
5969

6070
Score single site variants using the PoET interface.
6171
```
62-
prompt = b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN'
63-
sequence = prompt
72+
sequence = "MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN"
6473
future = session.poet.single_site(prompt, sequence, prompt_is_seed=True)
6574
result = future.wait()
6675
# result is a dictionary of {variant: score}
6776
```
6877

6978
Generate sequences from the PoET model.
7079
```
71-
prompt = b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN'
80+
7281
future = session.poet.generate(
7382
prompt,
74-
prompt_is_seed=True,
7583
max_seqs_from_msa=1024,
7684
num_samples=100,
77-
# temperature=1.0,
78-
# topk=None,
79-
# topp=None,
80-
# max_length=1000,
85+
temperature=1.0,
86+
topk=15
8187
)
8288
samples = future.wait()
8389
```
@@ -91,10 +97,4 @@ future.get_msa()
9197
future.get_seed()
9298
```
9399

94-
95-
## TODOs
96-
97-
- [] Error parsing for requests
98-
- [] Better interface for creating async POST/GET requests
99-
- [] Interfaces for other REST API modules
100-
100+
See more at our [Homepage](https://docs.openprotein.ai/)

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
2-
name = "openprotein"
3-
version = "0.1.1b3"
2+
name = "openprotein-python"
3+
version = "0.1.1b4"
44
description = "OpenProtein Python interface."
55
authors = ["OpenProtein <[email protected]>"]
66

@@ -23,4 +23,4 @@ url = "https://test.pypi.org/simple"
2323

2424

2525
[project.urls]
26-
Homepage = "https://github.com/OpenProteinAI/openprotein-python"
26+
Homepage = "https://docs.openprotein.ai/"

0 commit comments

Comments
 (0)