Package: openprotein-python
openprotein-pythonThe OpenProtein.AI Python Interface provides a user-friendly library to interact with the OpenProtein.AI REST API, enabling various tasks related to protein analysis and modeling.Table of ContentsWorkflowDescription0Quick startQuick start guide1InstallationInstall guide for pip and conda.2Session managementAn overview of the OpenProtein Python Client & the asynchronous jobs system.3Asssay-based Sequence LearningCovers core tasks such as data upload, model training & prediction, and sequence design.4De Novo prediction & generative models (PoET)Covers PoET, a protein LLM forde novoscoring, as well as sequence generation.5Protein Language Models & EmbeddingsCovers methods for creating sequence embeddings with proprietary & open-source models.Quick-startGet started with our quickstart README! You can peruse theofficial documentationfor more details!InstallationTo install the python interface using pip, run the following command:pip install openprotein-pythonor with conda:conda install -c openprotein openprotein-pythonRequirementsPython 3.8 or higher.pydantic version 1.0 or newer.requests version 2.0 or newer.tqdm version 4.0 or newer.pandas version 1.0 or newer.Getting startedRead on below for the quick-start guide, or see thedocsfor more information!To begin, create a session using your login credentials.import openprotein

# replace USERNAME and PASSWORD with your actual login credentials
session = openprotein.connect(USERNAME, PASSWORD)Job StatusThe interface offersAsyncJobFutureobjects for asynchronous calls, allowing tracking of job status and result retrieval when ready. Given a future, you can check its status and retrieve results.Checking Job StatusCheck the status of anAsyncJobFutureusing the following methods:future.refresh()  # call the backend to update the job status
future.done()     # returns True if the job is done, meaning the status could be SUCCESS, FAILED, or CANCELLEDRetrieving Job ResultsOnce the job has finished, retrieve the results using the following methods:result = future.wait()     # wait until done and then fetch results

#verbosity is controlled with verbose arg
result = future.get(verbose=True)  # get the result from a finished jobJobs InterfaceListing JobsTo view all jobs associated with each session, the following method is available, providing an option to filter results by date, job type, or status.session.jobs.list()Retrieving Specific JobFor detailed information about a particular job, use the following command with the corresponding job ID:session.jobs.get(JOB_ID)  # Replace JOB_ID with the ID of the specific job to be retrievedResuming JobsJobs from prior workflows can be resumed using the load_job method provided by each API.session.train.load_job(JOB_ID)  # Replace JOB_ID with the ID of the training job to resumePoET interfaceThe PoET Interface allows scoring, generating, and retrieving sequences using the PoET model.Scoring SequencesTo score sequences, use the score function. Provide a prompt and a list of queries. The results will be a list of (sequence, score) pydantic objects.prompt_seqs = b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN'

prompt = session.poet.upload_prompt(prompt_seqs)queries = [
    b'MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN',
    b'MALWMRLLPLLVLLALWGPDPASAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN',
    b'MALWTRLRPLLALLALWPPPPARAFVNQHLCGSHLVEALYLVCGERGFFYTPKARREVEGPQVGALELAGGPGAGGLEGPPQKRGIVEQCCASVCSLYQLENYCN',
    b'MALWIRSLPLLALLVFSGPGTSYAAANQHLCGSHLVEALYLVCGERGFFYSPKARRDVEQPLVSSPLRGEAGVLPFQQEEYEKVKRGIVEQCCHNTCSLYQLENYCN',
    b'MALWMRLLPLLALLALWAPAPTRAFVNQHLCGSHLVEALYLVCGERGFFYTPKARREVEDLQVRDVELAGAPGEGGLQPLALEGALQKRGIVEQCCTSICSLYQLENYCN',
]future = session.poet.score(prompt, queries)
result = future.wait()
# result is a list of (sequence, score) pydantic objectsScoring Single Site VariantsFor scoring single site variants, use thesingle_site function, providing the original sequence and settingprompt_is_seedto True if the prompt is a seed sequence.sequence = "MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN"
future = session.poet.single_site(prompt, sequence, prompt_is_seed=True) 
result = future.wait()
# result is a dictionary of {variant: score}Generating SequencesTo generate sequences from the PoET model, use thegeneratefunction with relevant parameters. The result will be a list of generated samples.future = session.poet.generate(
    prompt,
    max_seqs_from_msa=1024,
    num_samples=100,
    temperature=1.0,
    topk=15
)
samples = future.wait()Retrieving Input SequencesYou can retrieve the prompt, MSA, or seed sequences for a PoET job using theget_inputfunction or the individual functions for each type.future.get_input(INPUT_TYPE)
# or, functions for each type
future.get_prompt()
future.get_msa()
future.get_seed()See more at ourHomepage