openprotein.data
SDK release/v0.18.0Upload your dataset to OpenProtein.AI's engineering platform for train, predict and design tasks. session.data.create takes a pandas DataFrame with a sequence column. Measurement columns hold properties for training; identify free-text columns separately as metadata.
This example uses an authenticated session.
import pandas as pd
table = pd.DataFrame({
"sequence": ["ACDE", "ACDF"],
"activity": [1.2, 0.8],
"notes": ["first", "second"],
})
assay = session.data.create(table, name="Example", metadata_columns=["notes"])See the assay upload guide for more detail.
5source
API interface for calling AssayData endpoints
sessionAPISessionpropertymsa:MSADataAPIsource
Access stored MSAs: upload, fetch and manage them.
propertyprompts:PromptsAPIsource
Access stored prompts: sampled replicates and uploads.
methodlist(limit=None, offset=None)→builtins.list[AssayDataset]source
List all assay datasets.
limit : int, optional Limit the number of assays to return. offset : int, optional Offset of assays to retrieve. Useful with limit.
List of all assay datasets.
limitint | None= Noneoffsetint | None= Nonemethodcreate(table, name, description=None, metadata_columns=None)→AssayDatasetsource
Create a new assay dataset.
tablepd.DataFrameDataFrame containing the assay data.
namestrName of the assay dataset.
descriptionstr= NoneDescription of the assay dataset, by default None.
metadata_columnsSequence[str]= NoneColumns of free text, such as notes, kept per row as metadata. They are not measurements and cannot be used to train models.
Created assay dataset.
methodget(assay_id, verbose=False)→AssayDatasetsource
Get an assay dataset by its ID.
assay_idstrID of the assay dataset.
verbosebool= FalseAssay dataset with the specified ID.
If no assay dataset with the given ID is found.
6source
Assay dataset which contains your sequences and measurements which can be used for training predictors.
sessionAPISessionmetadataAssayMetadatapropertystatus:JobStatussource
SUCCESS once the dataset is ready, else the status of the job producing it.
propertyjob_id:str | Nonesource
The job that produces the dataset, such as an alignment; None for an upload.
methodlist_models()source
List models assoicated with assay.
List of models
methodupdate(assay_name=None, assay_description=None)→Nonesource
Update the assay metadata.
assay_namestr= NoneNew name of the assay, by default None.
assay_descriptionstr= NoneNew description of the assay, by default None.
methodget_first()→pd.DataFramesource
Get head slice of assay data.
Dataframe containing the slice of assay data.
methodget_slice(start, end, include_metadata=False)→pd.DataFramesource
Get a slice of assay data.
startintStart index of the slice.
endintEnd index of the slice.
include_metadatabool= FalseAppend the metadata columns after the measurements, by default False.
Dataframe containing the slice of assay data.
source
Bases: BaseModel
Types referenced by the interfaces above.
MSADataAPI and PromptsAPI are available as session.data.msa and session.data.prompts.
6source
Access the MSA data - upload, list, fetch and manage stored MSAs.
sessionAPISessionmethodcreate(file, format, name=None, description=None, filename=None)→MSAsource
Upload an MSA, declaring its format (e.g. "a3m", "fasta").
filebytes | strThe MSA contents; a str is encoded as UTF-8 (read a file first,
e.g. open(path, "rb").read()).
formatstrThe upload's format, naming the codec used to parse it.
namestr= NoneHuman-readable metadata to store alongside the MSA.
descriptionstr= NoneHuman-readable metadata to store alongside the MSA.
filenamestr= NoneOriginal filename to record; defaults to a name derived from format.
The stored MSA.
methodget(msa_id)→MSAsource
Fetch one MSA (metadata only) by its msa_id.
An MSA whose job hasn't finished comes back with that job's status.
msa_idstrmethodlist(limit=None)→builtins.list[MSA]source
The caller's stored MSAs (metadata only), at most limit.
limitint | None= Nonemethoddownload(msa_id, format=None)→bytessource
Download a live MSA by id as format (default: the stored format).
msa_idstrformatMSADownloadFormat | None= Nonemethodupdate(msa_id, name=None, description=None, tags=None)→MSAsource
Update mutable metadata of an MSA.
msa_idstrnamestr | None= Nonedescriptionstr | None= Nonetagsbuiltins.list[str] | None= Nonemethoddelete(msa_id)→Nonesource
Delete an MSA by id.
msa_idstr6source
Access stored prompts: sample, list, fetch, upload, rename and delete.
sessionAPISessionmethodlist(limit=None)→list[Prompt]source
The caller's live prompts, newest first, at most limit.
limitint | None= Nonemethodsample_msa(msa, replicates=1, seed=None, method=None, homology_level=None, max_similarity=None, min_similarity=None, max_msa_sequences=None, max_msa_tokens=None, force_include_first=None)→PromptFuturesource
Sample an alignment into prompt replicates.
Every option but msa and replicates is omitted when unset so
the sampling task's own default applies. Sampling stops at whichever of
max_msa_sequences and max_msa_tokens is set; leave both unset
to take the default budget.
msastr or MSAStored alignment (session.data.msa handle or its id) to sample,
passed by id without downloading the alignment.
replicatesint= 1Number of prompts to sample, one per unit. Defaults to 1.
seedint= NoneSeed for the sampling. Each replicate draws its own from it. A missing seed is drawn client-side.
Sampling method.
homology_levelfloat= NoneLevel of homology for sequences in the MSA, between 0 and 1 (neighbors methods only).
max_similarityfloat= NoneMaximum similarity between sequences in the MSA and the seed, between 0 and 1.
min_similarityfloat= NoneMinimum similarity between sequences in the MSA and the seed, between 0 and 1.
max_msa_sequencesint= NoneCap on the number of sequences sampled. Named
num_sequences in MSAFuture.sample_prompt.
max_msa_tokensint= NoneCap on the number of residues sampled. Named
num_residues in MSAFuture.sample_prompt.
force_include_firstbool= NoneWhether to always include the seed sequence.
Handle on the submitted sampling job, whose id is the prompt id.
future.get() returns every replicate's complex sequences once
ready.
If both max_msa_sequences and max_msa_tokens are given.
If there is an issue with the API request.
methodupload(replicates, name=None, description=None)→Promptsource
Upload a prompt, one FASTA file per replicate, in position order.
replicateslist of bytes or strOne FASTA file per replicate; a str is encoded as UTF-8.
namestr= NoneHuman-readable metadata to store alongside the row.
descriptionstr= NoneHuman-readable metadata to store alongside the row.
The stored row.
methodupdate(prompt_id, name=None, description=None)→Promptsource
Update the mutable metadata (name / description) of a row.
prompt_idstrnamestr | None= Nonedescriptionstr | None= Nonemethoddelete(prompt_id)→Nonesource
Delete a prompt by id.
prompt_idstrAn MSA can be downloaded, updated or deleted. To sample a prompt from an alignment you already stored, replace your-msa-id with its ID:
msa = session.data.msa.get("your-msa-id")
prompt_job = session.data.prompts.sample_msa(
msa, replicates=2, max_msa_sequences=10,
)
groups = prompt_job.wait(timeout=600)
for group in groups:
print(len(group), group[:3])This samples up to 10 sequences per replicate. The PromptFuture returns list[list[str]], with one sequence group per replicate. Pass prompt_job as prompt= when embedding with PoET.
session.data.prompts.get(...) retrieves a stored Prompt handle. Reloaded sampling jobs use the compatibility Prompt reader.
18source
A live MSA and the operations on it (download, update, delete).
sessionAPISessionmetadataMSAMetadatapropertymetadata:MSAMetadatasource
propertyid:strsource
The MSA's id.
propertydigest:str | Nonesource
The row's content digest.
propertyname:str | Nonesource
propertydescription:str | Nonesource
propertystatus:JobStatussource
SUCCESS once the MSA is ready, else the status of the job producing it.
propertyjob_id:str | Nonesource
The job that produces the MSA; None for an upload.
propertysource_format:MSAFormat | Nonesource
propertynum_sequences:int | Nonesource
propertynum_match_columns:int | Nonesource
propertyhas_insertions:bool | Nonesource
propertytags:list[str]source
propertyoriginal_filename:str | Nonesource
propertycreated_at:datetimesource
propertyupdated_at:datetimesource
methoddownload(format=None)→bytessource
Download the alignment as format (default: the stored format).
"parquet" returns the stored msa-parquet-v1 bytes.
formatMSADownloadFormat | None= Nonemethodupdate(name=None, description=None, tags=None)→MSAsource
Update mutable metadata; refreshes in place.
namestr | None= Nonedescriptionstr | None= Nonetagslist[str] | None= Nonemethoddelete()→Nonesource
Delete this MSA.
16source
Bases: BaseModel
Metadata for one stored MSA (never carries the sequence body).
A search row has no uploaded original, so its msa_hash and
original_filename are None. Until its job produces it, a row has a
status other than SUCCESS and no stats.
attributemsa_id:strsource
attributejob_id:str | None= Nonesource
attributemsa_hash:str | None= Nonesource
attributename:str | None= Nonesource
attributedescription:str | None= Nonesource
attributetags:list[str]source
attributeproject_uuid:str | None= Nonesource
attributesource_format:MSAFormat | None= Nonesource
attributenum_sequences:int | None= Nonesource
attributenum_match_columns:int | None= Nonesource
attributehas_insertions:bool | None= Nonesource
attributeoriginal_filename:str | None= Nonesource
attributedigest:str | None= Nonesource
attributecreated_at:datetimesource
attributeupdated_at:datetimesource
12source
A stored prompt row and the operations on it (download, rename, delete).
sessionAPISessionrecordPromptSummary | PromptRecordpropertyid:strsource
propertystatus:JobStatussource
SUCCESS once the prompt is ready, else the status of the job producing it.
propertyjob_id:str | Nonesource
The job that produces the prompt; None for an upload.
propertyowner:str | Nonesource
propertyname:str | Nonesource
propertydescription:str | Nonesource
propertycreated_at:datetime | Nonesource
propertydigest:str | Nonesource
The row's content identity.
methoddownload()→bytessource
Download the zip, one FASTA file per replicate.
methodreplicates()→list[list[str]]source
Each replicate's complex sequences, parsed from the download.
methodupdate(name=None, description=None)→Promptsource
Update mutable metadata (name / description); refreshes in place.
namestr | None= Nonedescriptionstr | None= Nonemethoddelete()→Nonesource
Delete this prompt.
30source
Bases: TaskFuture
Handle on an alignment sampled into prompt replicates.
Each replicate is one unit, submitted in position order. get and
wait return each replicate's sequences. A reloaded sampling job loads
as Prompt instead.
sessionAPISessionjobJobmax_workersint= config.MAX_CONCURRENT_WORKERSsubmission_Submission | None= Nonepropertyreplicates:intsource
The submitted replicate count.
A count of 0 means the job hasn't reported it yet, so this refreshes the job once, then uses the requested count from the job args. If that is absent, a job that names its provider counts its units and any other job reports 0.
methodget(verbose=False, output=None, **kwargs)→list[list[str]]source
Read each replicate's sequences, with chains joined by :.
verbosebool= Falseoutputstr | None= None**kwargsAnymethodwait(interval=5, timeout=None, verbose=False, **kwargs)→list[list[str]]source
Wait for sampling and read each replicate's sequences.
intervalint= config.POLLING_INTERVALtimeoutint | None= Noneverbosebool= False**kwargsAnypropertyargs:dict[str, Any]source
inherited from openprotein.jobs.TaskFuture
The job's validated request, loaded on first access.
methodcancelled()→boolsource
inherited from openprotein.jobs.Future
Check if the job has been cancelled.
True if the job is cancelled, False otherwise.
propertycreated_date:datetimesource
inherited from openprotein.jobs.Future
The creation timestamp of the job.
propertydataset:AssayDataset | Nonesource
inherited from openprotein.jobs.TaskFuture
The assay the job's sequences came from, or None; read on first access.
propertydescription:str | Nonesource
inherited from openprotein.jobs.Future
The job's description, or an empty string if the job has none.
methoddone()→boolsource
inherited from openprotein.jobs.Future
Check if the job has completed.
True if the job is done, False otherwise.
propertyend_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The end timestamp of the job.
methodget_item(k, output=None, **kwargs)→Anysource
inherited from openprotein.jobs.TaskFuture
Retrieve a single item by its key.
kKThe key of the item to retrieve.
outputstr | None= None**kwargsAnymethoditer_outputs(output)→Iterator[Any]source
inherited from openprotein.jobs.TaskFuture
Read a named output in submitted position order.
outputstrmethoditer_units(output=None)→Iterator[FutureUnit]source
inherited from openprotein.jobs.TaskFuture
One handle per submitted unit, in position order.
outputstr | None= Noneattributejob:Job= jobsource
inherited from openprotein.jobs.MappedFuture
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
propertyoutputs:list[str]source
inherited from openprotein.jobs.TaskFuture
Output names supplied by the method or job.
propertyprogress_counter:intsource
inherited from openprotein.jobs.Future
The progress counter of the job.
methodrefresh()source
inherited from openprotein.jobs.Future
Refresh the job status and internal job object.
methodrename(name=None, description=None)source
inherited from openprotein.jobs.Future
Set this job's name and description.
Only the arguments given are sent, so renaming leaves the description alone. Extra fields carried on the job are preserved, as on refresh.
namestr | None= Nonedescriptionstr | None= Noneattributesession:APISession= sessionsource
inherited from openprotein.jobs.MappedFuture
propertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodstream(output=None, *, follow=False, interval=5, **kwargs)→Iterator[Any]source
inherited from openprotein.jobs.TaskFuture
Stream decoded outputs in position order; None is the default output.
An emitted output grows while the job runs. follow keeps reading,
every interval seconds, until it is complete.
outputstr | None= Nonefollowbool= Falseintervalfloat= config.POLLING_INTERVAL**kwargsAnymethodunit(position, output=None)→FutureUnitsource
inherited from openprotein.jobs.TaskFuture
Handle on one unit's selected output.
A named output fetches nothing; None resolves the default once.
positionintoutputstr | None= Nonepropertyunits:list[Unit]source
inherited from openprotein.jobs.TaskFuture
Records for the job's submitted positions, loaded on first access.
propertyversion:str | Nonesource
inherited from openprotein.jobs.TaskFuture
The submitted method's version, refreshing the job if it is missing.
methodwait_until_done(interval=5, timeout=None, verbose=False)→boolsource
inherited from openprotein.jobs.Future
Wait for the job to complete.
intervalfloat= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
True if the job completed successfully.
This method does not fetch the job results, unlike wait().