openprotein.embeddings
SDK release/v0.18.0This compatibility interface is deprecated. Use session.models for model access.
Create embeddings for your protein sequences using open-source and proprietary models! Note that for PoET Models, you will also need to supply a Prompt.
11source
Embeddings API providing the interface for creating embeddings using protein language models.
You can access all our models either via get_model or directly through the session's embedding attribute using the model's ID and the desired method. For example, to use the attention method on the protein sequence model, you would use session.embedding.prot_seq.attn().
Accessing a model's method:
# To call the attention method on the protein sequence model:
import openprotein
session = openprotein.connect(username="user", password="password")
session.embedding.prot_seq.attn()
Using the get_model method:
# Get a model instance by name:
import openprotein
session = openprotein.connect(username="user", password="password")
# list available models:
print(session.embedding.list_models() )
# init model by name
model = session.embedding.get_model('prot-seq')sessionAPISessionattributepoet2:PoET2Modelsource
PoET-2 model
attributeprot_seq:OpenProteinModelsource
Prot-seq model
attributerotaprot_large_uniref50w:OpenProteinModelsource
Rotaprot model trained on UniRef50
attributerotaprot_large_uniref90_ft:OpenProteinModelsource
Rotaprot model trained on UniRef90
methodlist_models()→list[EmbeddingModel]source
list models available for creating embeddings of your sequences
methodget_model(name)→EmbeddingModelsource
Get model by model_id.
ProtembedModel allows all the usual job manipulation: e.g. making POST and GET requests for this model specifically.
model_idstrthe model identifier
namestrThe model
If no listed model has that name.
If the GET request does not succeed.
These embedding models inherit from a base EmbeddingModel, due to their shared functionality in providing the embed method. These can also be used to fit the Transform Models.
11source
Bases: PoETModel, EmbeddingModel
Class for OpenProtein's foundation model PoET 2.
PoET functions are dependent on a prompt supplied via the prompt endpoints.
View specific model details (including supported tokens) with the ? operator.
import openprotein
session = openprotein.connect(username="user", password="password")
session.embedding.poet2?methodembed(sequences, reduction=ReductionType.MEAN, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, **kwargs)→EmbeddingsResultFuturesource
Embed sequences using this model.
sequenceslist of bytes or list of strSequences to embed.
Embeddings reduction to use (e.g. mean). Default is ReductionType.MEAN.
Prompt or prompt_id or prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_type(mlm, clm)= 'mlm'Decoder type. Default is None.
**kwargs= {}Additional keyword arguments.
A future object that returns the embeddings of the submitted sequences.
Note: The embeddings for PoET can have an extra first dimension if using ensemble
prompts, where the first dimension is the number of replicates in the ensemble
prompt. i.e. the shape is (N, L, D) if N > 1 else (L, D) where N is
the number of replicates in the prompt, L is the length of the sequence, D is
the dimensions of the ensemble.
methodlogits(sequences, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, **kwargs)→EmbeddingsResultFuturesource
Compute logit embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to analyze.
Prompt or prompt_id or prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_type(mlm, clm)= 'mlm'Decoder type. Default is None.
**kwargs= {}Additional keyword arguments.
A future object that returns the logits of the submitted sequences.
Note: The logits for PoET can have an extra first dimension if using ensemble
prompts, where the first dimension is the number of replicates in the ensemble
prompt. i.e. the shape is (N, L, D) if N > 1 else (L, D) where N is
the number of replicates in the prompt, L is the length of the sequence, D is
the size of the vocabulary.
methodscore(sequences, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, **kwargs)→EmbeddingsScoreFuturesource
Score query sequences using the specified prompt.
sequenceslist of bytesSequences to score.
Prompt or prompt_id or prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_typeclm= 'clm'Decoder type. Scoring runs on the clm decoder. Default is None.
**kwargs= {}Additional keyword arguments.
A future object that returns the scores of the submitted sequences.
methodindel(sequence, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, insert=None, delete=None, **kwargs)→EmbeddingsScoreFuturesource
Score all indels of the query sequence using the specified prompt.
sequencebytesSequence to analyze.
Prompt from an align workflow to condition the PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_typeclm= 'clm'Decoder type. Scoring runs on the clm decoder. Default is None.
insertstr or None= NoneInsertion fragment at each site.
deletelist of int or None= NoneRange of size of fragment to delete at each site.
**kwargs= {}Additional keyword arguments.
A future object that returns the scores of the indel-ed sequence.
If neither insert nor delete is provided.
methodsingle_site(sequence, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, **kwargs)→EmbeddingsScoreSingleSiteFuturesource
Score all single substitutions of the query sequence using the specified prompt.
sequencebytesSequence to analyze.
Prompt or prompt_id or prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_typeclm= 'clm'Decoder type. Scoring runs on the clm decoder. Default is None.
**kwargs= {}Additional keyword arguments.
A future object that returns the scores of the mutated sequence.
methodgenerate(prompt, query=None, design=None, use_query_structure_in_decoder=True, num_samples=100, temperature=1.0, topk=None, topp=None, max_length=1000, seed=None, ensemble_weights=None, ensemble_method=None, **kwargs)→EmbeddingsGenerateFuturesource
Generate protein sequences conditioned on a prompt.
promptstr or Prompt or NonePrompt from an align workflow to condition PoET model.
querystr or bytes or Protein or Complex or Query or list of these or None= NoneQuery to use with prompt.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
num_samplesint= 100The number of samples to generate. Default is 100.
temperaturefloat= 1.0The temperature for sampling. Higher values produce more random outputs. Default is 1.0.
topkfloat or None= NoneThe number of top-k residues to consider during sampling. Default is None.
toppfloat or None= NoneThe cumulative probability threshold for top-p sampling. Default is None.
max_lengthint= 1000The maximum length of generated proteins. Default is 1000.
seedint or None= NoneSeed for random number generation. Default is None.
ensemble_weightsSequence of float or None= NoneWeights for combining likelihoods from multiple prompts in the ensemble. The length of this sequence must match the number of prompts. All weights must be finite. If ensemble_method is "arithmetic", then weights must also be non-negative, and have a non-zero sum.
ensemble_method(arithmetic, geometric)= 'arithmetic'Method used to combine likelihoods from multiple prompts in the ensemble. If "arithmetic", the weighted mean is used; if "geometric", the weighted geometric mean is used. If None (default), the method defaults to "arithmetic", but this behavior may change in the future.
**kwargs= {}Additional keyword arguments.
A future object representing the status and information about the generation job.
methodfit_svd(sequences=None, assay=None, n_components=1024, reduction=None, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, **kwargs)→SVDModelsource
Fit an SVD on the embedding results of PoET.
This function will create an SVDModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneSequences to fit SVD. If None, assay must be provided.
Assay containing sequences to fit SVD. Ignored if sequences are provided.
n_componentsint= 1024Number of components in SVD. Determines output shapes. Default is 1024.
Embeddings reduction to use (e.g. mean).
Prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_type(mlm, clm)= 'mlm'Decoder type. Default is None.
**kwargs= {}Additional keyword arguments for the model.
A future that represents the fitted SVD model.
methodfit_umap(sequences=None, assay=None, n_components=2, reduction=ReductionType.MEAN, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, **kwargs)→UMAPModelsource
Fit a UMAP on assay using PoET and hyperparameters.
This function will create a UMAP based on the embeddings from this PoET model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneSequences to fit UMAP. If None, assay must be provided.
Assay containing sequences to fit UMAP. Ignored if sequences are provided.
n_componentsint= 2Number of components in UMAP fit. Determines output shapes. Default is 2.
Embeddings reduction to use (e.g. mean). Default is ReductionType.MEAN.
Prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_type(mlm, clm)= 'mlm'Decoder type. Default is None.
**kwargs= {}Additional keyword arguments for the model.
A future that represents the fitted UMAP model.
methodfit_gp(assay, properties, prompt=None, query=None, use_query_structure_in_decoder=True, decoder_type=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
Fit a Gaussian Process (GP) on assay using this embedding model and hyperparameters.
assayAssayMetadata or AssayDataset or strAssay to fit GP on.
propertieslist of strProperties in the assay to fit the GP on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
Prompt from an align workflow to condition PoET model.
use_query_structure_in_decoderbool= TrueWhether to use query structure in decoder. Default is True.
decoder_type(mlm, clm)= 'mlm'Decoder type. Default is None.
**kwargs= {}Additional keyword arguments for the model.
A future that represents the trained predictor model.
methodget_metadata()→ModelMetadatasource
inherited from openprotein.embeddings.EmbeddingModel
Get model metadata for this model.
The metadata associated with this model.
propertymetadatasource
inherited from openprotein.embeddings.EmbeddingModel
ModelMetadata for this model.
The metadata associated with this model.
11source
Bases: EmbeddingModel
Class for OpenProtein's foundation model PoET.
PoET functions are dependent on a prompt supplied via the prompt endpoints.
View specific model details (including supported tokens) with the ? operator.
import openprotein
session = openprotein.connect(username="user", password="password")
session.embedding.poet.<embeddings_method>methodembed(sequences, reduction=ReductionType.MEAN, prompt=None, **kwargs)→EmbeddingsResultFuturesource
Embed sequences using the PoET model.
sequenceslist of bytesSequences to embed.
Prompt from an align workflow to condition the PoET model.
Embeddings reduction to use (e.g., mean). Default is ReductionType.MEAN.
**kwargs= {}Additional keyword arguments.
Future object that returns the embeddings of the submitted sequences.
Note: The embeddings for PoET can have an extra first dimension if using ensemble
prompts, where the first dimension is the number of replicates in the ensemble
prompt. i.e. the shape is (N, L, D) if N > 1 else (L, D) where N is
the number of replicates in the prompt, L is the length of the sequence, D is
the dimensions of the ensemble.
methodlogits(sequences, prompt=None, **kwargs)→EmbeddingsResultFuturesource
Compute logits for sequences using the PoET model.
sequenceslist of bytesSequences to analyze.
Prompt from an align workflow to condition the PoET model.
**kwargs= {}Additional keyword arguments.
Future object that returns the logits of the submitted sequences.
Note: The logits for PoET can have an extra first dimension if using ensemble
prompts, where the first dimension is the number of replicates in the ensemble
prompt. i.e. the shape is (N, L, D) if N > 1 else (L, D) where N is
the number of replicates in the prompt, L is the length of the sequence, D is
the size of the vocabulary.
methodscore(sequences, prompt=None, **kwargs)→EmbeddingsScoreFuturesource
Score query sequences using the specified prompt.
sequenceslist of bytesSequences to score.
Prompt from an align workflow to condition the PoET model.
**kwargs= {}Additional keyword arguments.
Future object that returns the scores of the submitted sequences.
methodindel(sequence, prompt=None, insert=None, delete=None, **kwargs)→EmbeddingsScoreFuturesource
Score all indels of the query sequence using the specified prompt.
sequencebytesSequence to analyze.
Prompt from an align workflow to condition the PoET model.
insertstr or None= NoneInsertion fragment at each site.
deletelist of int or None= NoneRange of size of fragment to delete at each site.
**kwargs= {}Additional keyword arguments.
Future object that returns the scores of the indel-ed sequence.
If neither insert nor delete is provided.
methodsingle_site(sequence, prompt=None, **kwargs)→EmbeddingsScoreSingleSiteFuturesource
Score all single substitutions of the query sequence using the specified prompt.
sequencebytesSequence to analyze.
Prompt from an align workflow to condition the PoET model.
**kwargs= {}Additional keyword arguments.
Future object that returns the per-variant scores of the single substitutions.
methodgenerate(prompt, num_samples=100, temperature=1.0, topk=None, topp=None, max_length=1000, seed=None, **kwargs)→EmbeddingsGenerateFuturesource
Generate protein sequences conditioned on a prompt.
promptstr or PromptPrompt from an align workflow to condition the PoET model.
num_samplesint= 100Number of samples to generate. Default is 100.
temperaturefloat= 1.0Temperature for sampling. Higher values produce more random outputs. Default is 1.0.
topkfloat or None= NoneNumber of top-k residues to consider during sampling. Default is None.
toppfloat or None= NoneCumulative probability threshold for top-p sampling. Default is None.
max_lengthint= 1000Maximum length of generated proteins. Default is 1000.
seedint or None= NoneSeed for random number generation. Default is None.
**kwargs= {}Additional keyword arguments.
Future object representing the status and information about the generation job.
methodfit_svd(sequences=None, assay=None, n_components=1024, reduction=None, prompt=None, **kwargs)→SVDModelsource
Fit an SVD on the embedding results of PoET.
This function creates an SVDModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
Prompt from an align workflow to condition the PoET model.
sequenceslist of bytes or list of str or None= NoneSequences to use for SVD.
Assay dataset to use for SVD.
n_componentsint= 1024Number of components in SVD. Determines output shapes. Default is 1024.
Embeddings reduction to use (e.g., mean).
**kwargs= {}Additional keyword arguments.
Future that represents the fitted SVD model.
methodfit_umap(sequences=None, assay=None, n_components=2, reduction=ReductionType.MEAN, prompt=None, **kwargs)→UMAPModelsource
Fit a UMAP on assay using PoET and hyperparameters.
This function creates a UMAP based on the embeddings from this PoET model as well as the hyperparameters specified in the arguments.
Prompt from an align workflow to condition the PoET model.
sequenceslist of bytes or list of str or None= NoneOptional sequences to fit UMAP with. Either use sequences or assay. Sequences is preferred.
Optional assay containing sequences to fit UMAP with. Either use sequences or assay. Ignored if sequences are provided.
n_componentsint= 2Number of components in UMAP fit. Determines output shapes. Default is 2.
Embeddings reduction to use (e.g., mean). Default is ReductionType.MEAN.
**kwargs= {}Additional keyword arguments.
Future that represents the fitted UMAP model.
methodfit_gp(assay, properties, reduction, name=None, description=None, prompt=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
Fit a Gaussian Process (GP) on assay using this embedding model and hyperparameters.
assayAssayMetadata or AssayDataset or strAssay to fit GP on.
propertieslist of strProperties in the assay to fit the GP on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
Prompt from an align workflow to condition the PoET model.
**kwargs= {}Additional keyword arguments.
reductionReductionTypenamestr | None= Nonedescriptionstr | None= NoneFuture that represents the trained predictor model.
methodget_metadata()→ModelMetadatasource
inherited from openprotein.embeddings.EmbeddingModel
Get model metadata for this model.
The metadata associated with this model.
propertymetadatasource
inherited from openprotein.embeddings.EmbeddingModel
ModelMetadata for this model.
The metadata associated with this model.
8source
Bases: EmbeddingModel
Community AbLang2 model that targets antibodies.
View specific model details (inc supported tokens) with the ? operator.
import openprotein
session = openprotein.connect(username="user", password="password")
session.embedding.ablang2?methodsingle_site(sequence)→EmbeddingsScoreSingleSiteFuturesource
Score all single substitutions of a paired antibody sequence.
Masks each position of the sequence in turn and scores every
substitution there against the wild-type residue, so the wild type
scores 0 and a positive score means the model prefers the
substitution. sequence is a paired VH:VL sequence; the ':'
separator is kept and both chains are scanned. Gap ('-') positions
are skipped and kept in every variant. include_gaps is not
supported for this model.
sequencebytes or strPaired VH:VL sequence to analyze.
Future object that returns the per-variant scores of the single substitutions.
methodembed(sequences, reduction=ReductionType.MEAN, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.EmbeddingModel
Embed sequences using this model.
sequenceslist of bytes or list of strSequences to embed.
Reduction to use (e.g. mean). Defaults to mean embedding.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the embedding result.
methodfit_gp(assay, properties, reduction, name=None, description=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit a Gaussian Process (GP) on an assay using this embedding model and hyperparameters.
assayAssayMetadata, AssayDataset, or strAssay to fit GP on.
propertieslist of strProperties in the assay to fit the GP on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
reductionReductionTypeType of embedding reduction to use for computing features. PLM must use reduction.
namestr or None= NoneOptional name for the predictor model.
descriptionstr or None= NoneOptional description for the predictor model.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted predictor model.
If no properties are provided, properties are not a subset of assay measurements, or multitask GP is requested.
methodfit_svd(sequences=None, assay=None, n_components=1024, reduction=None, **kwargs)→SVDModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit an SVD on the embedding results of this model.
This function will create an SVDModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneSequences to fit SVD on.
Assay containing sequences to fit SVD on.
n_componentsint= 1024Number of components in SVD. Determines output shapes. Default is 1024.
Embeddings reduction to use (e.g. mean).
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted SVD model.
If neither or both of assay and sequences are provided.
methodfit_umap(sequences=None, assay=None, n_components=2, reduction='MEAN', **kwargs)→UMAPModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit a UMAP on the embedding results of this model.
This function will create a UMAPModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneOptional sequences to fit UMAP with. Either use sequences or assay. Sequences is preferred.
Optional assay containing sequences to fit UMAP with. Either use sequences or assay. Ignored if sequences are provided.
n_componentsint= 2Number of components in UMAP fit. Determines output shapes. Default is 2.
Embeddings reduction to use (e.g. mean). Defaults to MEAN.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted UMAP model.
If neither or both of assay and sequences are provided.
methodget_metadata()→ModelMetadatasource
inherited from openprotein.embeddings.EmbeddingModel
Get model metadata for this model.
The metadata associated with this model.
methodlogits(sequences, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.EmbeddingModel
Compute logit embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute logits for.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the logits result.
propertymetadatasource
inherited from openprotein.embeddings.EmbeddingModel
ModelMetadata for this model.
The metadata associated with this model.
8source
Bases: AttnModel, EmbeddingModel
Proprietary protein embedding models served by OpenProtein.
View specific model details (inc supported tokens) with the ? operator.
import openprotein
session = openprotein.connect(username="user", password="password")
session.embedding.prot_seq?methodattn(sequences, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.models.AttnModel
Compute attention embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute attention embeddings for.
kwargs= {}Additional keyword arguments to be used from foundational models.
Future object representing the attention result.
methodembed(sequences, reduction=ReductionType.MEAN, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.EmbeddingModel
Embed sequences using this model.
sequenceslist of bytes or list of strSequences to embed.
Reduction to use (e.g. mean). Defaults to mean embedding.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the embedding result.
methodfit_gp(assay, properties, reduction, name=None, description=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit a Gaussian Process (GP) on an assay using this embedding model and hyperparameters.
assayAssayMetadata, AssayDataset, or strAssay to fit GP on.
propertieslist of strProperties in the assay to fit the GP on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
reductionReductionTypeType of embedding reduction to use for computing features. PLM must use reduction.
namestr or None= NoneOptional name for the predictor model.
descriptionstr or None= NoneOptional description for the predictor model.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted predictor model.
If no properties are provided, properties are not a subset of assay measurements, or multitask GP is requested.
methodfit_svd(sequences=None, assay=None, n_components=1024, reduction=None, **kwargs)→SVDModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit an SVD on the embedding results of this model.
This function will create an SVDModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneSequences to fit SVD on.
Assay containing sequences to fit SVD on.
n_componentsint= 1024Number of components in SVD. Determines output shapes. Default is 1024.
Embeddings reduction to use (e.g. mean).
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted SVD model.
If neither or both of assay and sequences are provided.
methodfit_umap(sequences=None, assay=None, n_components=2, reduction='MEAN', **kwargs)→UMAPModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit a UMAP on the embedding results of this model.
This function will create a UMAPModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneOptional sequences to fit UMAP with. Either use sequences or assay. Sequences is preferred.
Optional assay containing sequences to fit UMAP with. Either use sequences or assay. Ignored if sequences are provided.
n_componentsint= 2Number of components in UMAP fit. Determines output shapes. Default is 2.
Embeddings reduction to use (e.g. mean). Defaults to MEAN.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted UMAP model.
If neither or both of assay and sequences are provided.
methodget_metadata()→ModelMetadatasource
inherited from openprotein.embeddings.EmbeddingModel
Get model metadata for this model.
The metadata associated with this model.
methodlogits(sequences, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.EmbeddingModel
Compute logit embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute logits for.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the logits result.
propertymetadatasource
inherited from openprotein.embeddings.EmbeddingModel
ModelMetadata for this model.
The metadata associated with this model.
9source
Bases: AttnModel, EmbeddingModel
Class providing inference endpoints for Facebook's ESM protein language models.
Covers ESM-1b, ESM-1v, ESM2 and ESM Cambrian (ESMC), and supports single-site
scanning with single_site.
View specific model details (inc supported tokens) with the ? operator.
import openprotein
session = openprotein.connect(username="user", password="password")
session.embedding.esm1b_t33_650M_UR50S?methodsingle_site(sequence)→EmbeddingsScoreSingleSiteFuturesource
Score all single substitutions of a sequence.
Masks each position in turn and scores every substitution there against the wild-type residue. The wild type therefore scores 0, and a positive score means the model prefers the substitution.
sequencebytes or strSequence to analyze.
Future object that returns the per-variant scores of the single substitutions.
methodattn(sequences, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.models.AttnModel
Compute attention embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute attention embeddings for.
kwargs= {}Additional keyword arguments to be used from foundational models.
Future object representing the attention result.
methodembed(sequences, reduction=ReductionType.MEAN, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.EmbeddingModel
Embed sequences using this model.
sequenceslist of bytes or list of strSequences to embed.
Reduction to use (e.g. mean). Defaults to mean embedding.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the embedding result.
methodfit_gp(assay, properties, reduction, name=None, description=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit a Gaussian Process (GP) on an assay using this embedding model and hyperparameters.
assayAssayMetadata, AssayDataset, or strAssay to fit GP on.
propertieslist of strProperties in the assay to fit the GP on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
reductionReductionTypeType of embedding reduction to use for computing features. PLM must use reduction.
namestr or None= NoneOptional name for the predictor model.
descriptionstr or None= NoneOptional description for the predictor model.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted predictor model.
If no properties are provided, properties are not a subset of assay measurements, or multitask GP is requested.
methodfit_svd(sequences=None, assay=None, n_components=1024, reduction=None, **kwargs)→SVDModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit an SVD on the embedding results of this model.
This function will create an SVDModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneSequences to fit SVD on.
Assay containing sequences to fit SVD on.
n_componentsint= 1024Number of components in SVD. Determines output shapes. Default is 1024.
Embeddings reduction to use (e.g. mean).
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted SVD model.
If neither or both of assay and sequences are provided.
methodfit_umap(sequences=None, assay=None, n_components=2, reduction='MEAN', **kwargs)→UMAPModelsource
inherited from openprotein.embeddings.EmbeddingModel
Fit a UMAP on the embedding results of this model.
This function will create a UMAPModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneOptional sequences to fit UMAP with. Either use sequences or assay. Sequences is preferred.
Optional assay containing sequences to fit UMAP with. Either use sequences or assay. Ignored if sequences are provided.
n_componentsint= 2Number of components in UMAP fit. Determines output shapes. Default is 2.
Embeddings reduction to use (e.g. mean). Defaults to MEAN.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted UMAP model.
If neither or both of assay and sequences are provided.
methodget_metadata()→ModelMetadatasource
inherited from openprotein.embeddings.EmbeddingModel
Get model metadata for this model.
The metadata associated with this model.
methodlogits(sequences, **kwargs)→EmbeddingsResultFuturesource
inherited from openprotein.embeddings.EmbeddingModel
Compute logit embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute logits for.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the logits result.
propertymetadatasource
inherited from openprotein.embeddings.EmbeddingModel
ModelMetadata for this model.
The metadata associated with this model.
9source
Base embeddings model used to understand and provide embeddings from sequences.
methodget_model()source
Get the model_id(s) for this EmbeddingModel subclass.
List of model_id strings associated with this class.
methodcreate(session, model_id, default=None, metadata=None, **kwargs)source
Create and return an instance of the appropriate EmbeddingModel subclass based on the model_id.
sessionAPISessionThe API session to use.
model_idstrThe model identifier.
defaulttype variable of EmbeddingModel or None= NoneDefault EmbeddingModel subclass to use if no match is found.
Pre-fetched metadata to avoid an extra API call.
kwargs= {}Additional keyword arguments to pass to the model constructor.
An instance of the appropriate EmbeddingModel subclass.
If no suitable EmbeddingModel subclass is found and no default is provided.
propertymetadatasource
ModelMetadata for this model.
The metadata associated with this model.
methodget_metadata()→ModelMetadatasource
Get model metadata for this model.
The metadata associated with this model.
methodembed(sequences, reduction=ReductionType.MEAN, **kwargs)→EmbeddingsResultFuturesource
Embed sequences using this model.
sequenceslist of bytes or list of strSequences to embed.
Reduction to use (e.g. mean). Defaults to mean embedding.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the embedding result.
methodlogits(sequences, **kwargs)→EmbeddingsResultFuturesource
Compute logit embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute logits for.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
Future object representing the logits result.
methodfit_svd(sequences=None, assay=None, n_components=1024, reduction=None, **kwargs)→SVDModelsource
Fit an SVD on the embedding results of this model.
This function will create an SVDModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneSequences to fit SVD on.
Assay containing sequences to fit SVD on.
n_componentsint= 1024Number of components in SVD. Determines output shapes. Default is 1024.
Embeddings reduction to use (e.g. mean).
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted SVD model.
If neither or both of assay and sequences are provided.
methodfit_umap(sequences=None, assay=None, n_components=2, reduction='MEAN', **kwargs)→UMAPModelsource
Fit a UMAP on the embedding results of this model.
This function will create a UMAPModel based on the embeddings from this model as well as the hyperparameters specified in the arguments.
sequenceslist of bytes or list of str or None= NoneOptional sequences to fit UMAP with. Either use sequences or assay. Sequences is preferred.
Optional assay containing sequences to fit UMAP with. Either use sequences or assay. Ignored if sequences are provided.
n_componentsint= 2Number of components in UMAP fit. Determines output shapes. Default is 2.
Embeddings reduction to use (e.g. mean). Defaults to MEAN.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted UMAP model.
If neither or both of assay and sequences are provided.
methodfit_gp(assay, properties, reduction, name=None, description=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
Fit a Gaussian Process (GP) on an assay using this embedding model and hyperparameters.
assayAssayMetadata, AssayDataset, or strAssay to fit GP on.
propertieslist of strProperties in the assay to fit the GP on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
reductionReductionTypeType of embedding reduction to use for computing features. PLM must use reduction.
namestr or None= NoneOptional name for the predictor model.
descriptionstr or None= NoneOptional description for the predictor model.
kwargs= {}Additional keyword arguments to be used from foundational models, e.g. prompt_id for PoET models.
The fitted predictor model.
If no properties are provided, properties are not a subset of assay measurements, or multitask GP is requested.
1source
Bases: EmbeddingModel
Embeddings model that provides attention computation.
methodattn(sequences, **kwargs)→EmbeddingsResultFuturesource
Compute attention embeddings for sequences using this model.
sequenceslist of bytes or list of strSequences to compute attention embeddings for.
kwargs= {}Additional keyword arguments to be used from foundational models.
Future object representing the attention result.
These models are overlaid on top of the base embeddings models to produce reduced/transformed embeddings. SVDModel represents an SVD model which is suitable to reduce the high-dimensional embeddings returned by base embedding models, whilst maintaining semantic information, fitted on your AssayDataset. You can fit your own SVD from any model's fit_svd. UMAPModel represents a UMAP model which is suitable to project the high-dimensional embeddings into a lower dimension (usually 2) for visualization, to understand the semantic grouping within your AssayDataset. You can fit your own UMAP from any model's fit_umap.
The legacy session.svd and session.umap interfaces are deprecated compatibility APIs. For new code, create and manage these estimators through session.models.SVD and session.models.UMAP.
27source
Bases: Future
SVD model that can be used to create reduced embeddings.
The model is also implemented as a Future to allow waiting for a fit job.
propertyidsource
The unique identifier of the job.
propertyn_componentssource
Number of components of the SVD.
propertysequence_lengthsource
Sequence length constraint of the SVD.
propertyreductionsource
Reduction of embeddings used to fit the SVD.
propertymetadatasource
Metadata of the SVD.
propertymodel:EmbeddingModelsource
Base embeddings model used for the SVD.
methoddelete()→boolsource
Delete this SVD model.
methodwait(verbose=False, **kwargs)→Selfsource
Wait for the job to complete, then fetch results.
intervalint= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint | None= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
**kwargs= {}Keyword arguments passed to get.
The results of the job.
methodget_inputs()→list[bytes]source
Get sequences used for svd job.
List of sequences
methodembed(sequences, **kwargs)→SVDEmbeddingsResultFuturesource
Use this SVD model to get reduced embeddings from input sequences.
sequencesList[bytes]List of protein sequences.
Future result containing the reduced embeddings.
methodfit_umap(sequences=None, assay=None, n_components=2, **kwargs)→UMAPModelsource
Fit an UMAP on the embedding results of this model.
sequenceslist[bytes] | list[str] | None= NoneSequences to fit the UMAP on. Provide either this or assay.
Assay whose sequences to fit the UMAP on. Provide either this or
sequences.
n_componentsint= 2Number of components in the UMAP, which determines the output shape. Defaults to 2.
**kwargs= {}Additional keyword arguments passed to the UMAP fit.
UMAP model fitted on the reduced embeddings from provided sequences or assay.
methodfit_gp(assay, properties, name=None, description=None, kernel='rbf', period=None, alpha=None, **kwargs)→PredictorModelsource
Fit a GP on assay using this embedding model and hyperparameters.
assayAssayMetadata or AssayDataset or strAssay to fit GP on. Or its assay_id.
propertieslist[str]Properties in the assay to fit the gp on.
Kernel for the GP, e.g. "rbf", "matern52", "periodic", "rational_quadratic". Defaults to "rbf".
periodfloat or None= NonePeriod length; only valid for the "periodic" kernel (must be > 0).
alphafloat or None= NoneScale-mixture parameter; only valid for "rational_quadratic" (must be > 0).
namestr | None= Nonedescriptionstr | None= NoneProperty predictor model trained using the reduced embeddings with provided assay and properties.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
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().
29source
Bases: Future['UMAPModel']
UMAP model that can be used to create projected embeddings.
The model is also implemented as a Future to allow waiting for a fit job.
The projected embeddings of the sequences used to fit the UMAP can be
accessed using embeddings.
propertyidsource
UMAP unique identifier.
propertyn_componentssource
Number of components specified for the UMAP.
propertyn_neighborssource
Number of neighbors specified for the UMAP.
propertymin_distsource
Minimum distance specified for the UMAP.
propertysequence_lengthsource
Sequence length constraint of the UMAP.
propertyreductionsource
Reduction used to fit the UMAP.
propertymetadatasource
Metadata of the UMAP.
propertysequencessource
The sequences used to fit the UMAP.
propertyembeddingssource
The projected embeddings of the sequences used to fit the UMAP.
propertymodel:EmbeddingModelsource
Base embeddings model used for the UMAP.
methoddelete()→boolsource
Delete this UMAP model.
methodget_inputs()→list[bytes]source
Get sequences used for umap job.
list of sequences
methodembed(sequences, **kwargs)→UMAPEmbeddingsResultFuturesource
Use this UMAP model to get projected embeddings from input sequences.
sequencesList[bytes]List of protein sequences.
Future result containing the projected embeddings.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodwait(interval=5, timeout=None, verbose=False, **kwargs)→Vsource
inherited from openprotein.jobs.Future
Wait for the job to complete, then fetch results.
intervalint= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint | None= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
**kwargs= {}Keyword arguments passed to get.
The results of the job.
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().
3source
SVD API providing the interface for creating and using SVD models.
sessionAPISessionmethodfit_svd(model, sequences=None, assay=None, n_components=1024, reduction=None, **kwargs)→SVDModelsource
Fit an SVD on the sequences with the specified model_id and hyperparameters (n_components).
modelstr or EmbeddingModelID of embeddings model to use or the EmbeddingModel.
sequenceslist of bytes or None= NoneOptional sequences to fit SVD with. Either use sequences or assay_id. sequences is preferred.
Optional assay containing sequences to fit SVD with. Or its assay_id. Either use sequences or assay. Ignored if sequences are provided.
n_componentsint= 1024The number of components for the SVD. Defaults to 1024.
reductionstr or ReductionType or None= NoneType of embedding reduction to use for computing features. E.g. "MEAN" or "SUM". Useful when dealing with variable length sequence. Defaults to None.
kwargs= {}Additional keyword arguments to be passed to foundational models, e.g. prompt_id for PoET models.
The SVD model being fit.
methodget_svd(svd_id)→SVDModelsource
Get SVD job results. Including SVD dimension and sequence lengths.
Requires a successful SVD job from fit_svd
svd_idstrThe ID of the SVD job.
The model with the SVD fit.
methodlist_svd(limit=None, offset=None)→list[SVDModel]source
List SVD models made by user.
limitint or None= NoneMaximum number of results to return. Defaults to None (all).
offsetint or None= NoneNumber of results to skip. Defaults to None.
List of SVDs that the user has access to.
3source
UMAP API providing the interface to fit and run UMAP visualizations.
sessionAPISessionmethodfit_umap(model, reduction=None, feature_type=None, sequences=None, assay=None, n_components=2, n_neighbors=15, min_dist=0.1, **kwargs)→UMAPModelsource
Fit an UMAP on the sequences with the specified model_id and hyperparameters (n_components).
sequenceslist[bytes] | list[str] | None= NoneOptional sequences to fit UMAP with. Either use sequences or assay_id. sequences is preferred.
Optional assay containing sequences to fit UMAP with. Or its assay_id. Either use sequences or assay. Ignored if sequences are provided.
modelEmbeddingModel or SVDModel or strInstance of either EmbeddingModel or SVDModel to use depending on feature type. Can also be a str specifying the model id, but then feature_type would have to be specified.
Type of features to use for encoding sequences. "SVD" or "PLM". None would require model to be EmbeddingModel or SVDModel.
n_componentsint= 2Number of UMAP components to fit. Defaults to 2.
n_neighborsint= 15Number of neighbors to use for fitting. Defaults to 15.
min_distfloat= 0.1Minimum distance in UMAP fitting. Defaults to 0.1.
Type of embedding reduction to use for computing features. E.g. "MEAN" or "SUM". Useful when dealing with variable length sequence. Defaults to None.
kwargs= {}Additional keyword arguments to be passed to foundational models, e.g. prompt_id for PoET models.
The UMAP model being fit.
Foundational embedding models also take an optional reduction to use simple pooling methods:
2source
Bases: str, Enum
ReductionType is an enumeration of the possible reduction types available.
source
Bases: BaseModel
Metadata about available protein embedding models.
21source
Bases: MappedFuture[bytes, np.ndarray]
Future for manipulating results for embeddings-related requests.
sessionAPISessionjobEmbeddingsJob | AttnJob | LogitsJobsequenceslist[bytes] | list[str] | None= Nonemax_workersint= config.MAX_CONCURRENT_WORKERSmethodstream_sync()source
Stream the embeddings results synchronously.
propertyidsource
The unique identifier of the job.
methodget_item(sequence)→np.ndarraysource
Get embedding results for specified sequence.
sequencestr or bytesOne of the sequences submitted with the request.
Embedding for that sequence. The shape depends on the model and on the reduction requested at submission time.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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(verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.Future
Return all results from the job by consuming the stream.
verbosebool= FalseIf True, display a progress bar. Defaults to False.
**kwargs= {}Keyword arguments passed to the stream method.
A list containing all results from the job.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodstream(**kwargs)→Iterator[tuple[K, V]]source
inherited from openprotein.jobs.MappedFuture
Retrieve results for this job as a stream.
A generator that yields (key, value) tuples.
methodwait(interval=5, timeout=None, verbose=False, **kwargs)→list[tuple[K, V]]source
inherited from openprotein.jobs.MappedFuture
Wait for the job to complete, then fetch results.
intervalint= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint | None= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
**kwargs= {}Keyword arguments passed to get.
The results of the job.
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().
19source
Bases: BaseScoreFuture[Score]
Future for manipulating results for embeddings score-related requests.
sessionAPISessionjobScoreJob | ScoreSingleSiteJob | GenerateJobsequenceslist[bytes] | list[str] | None= Nonemethodstream()→Iterator[Score]source
Return the results from this job as a generator.
A generator that yields job results.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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(verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.Future
Return all results from the job by consuming the stream.
verbosebool= FalseIf True, display a progress bar. Defaults to False.
**kwargs= {}Keyword arguments passed to the stream method.
A list containing all results from the job.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodwait(interval=5, timeout=None, verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.StreamingFuture
Wait for the job to complete, then fetch results.
intervalint= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint | None= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
**kwargs= {}Keyword arguments passed to get.
The results of the job.
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().
19source
Bases: BaseScoreFuture[SingleSiteScore]
Future for manipulating results for embeddings score-related requests.
sessionAPISessionjobScoreJob | ScoreSingleSiteJob | GenerateJobsequenceslist[bytes] | list[str] | None= Nonemethodstream()→Iterator[SingleSiteScore]source
Return the results from this job as a generator.
A generator that yields job results.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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(verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.Future
Return all results from the job by consuming the stream.
verbosebool= FalseIf True, display a progress bar. Defaults to False.
**kwargs= {}Keyword arguments passed to the stream method.
A list containing all results from the job.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodwait(interval=5, timeout=None, verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.StreamingFuture
Wait for the job to complete, then fetch results.
intervalint= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint | None= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
**kwargs= {}Keyword arguments passed to get.
The results of the job.
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().
19source
Bases: BaseScoreFuture[Score]
Future for manipulating results for embeddings generate-related requests.
sessionAPISessionjobScoreJob | ScoreSingleSiteJob | GenerateJobsequenceslist[bytes] | list[str] | None= Nonemethodstream()→Iterator[Score]source
Return the results from this job as a generator.
A generator that yields job results.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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(verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.Future
Return all results from the job by consuming the stream.
verbosebool= FalseIf True, display a progress bar. Defaults to False.
**kwargs= {}Keyword arguments passed to the stream method.
A list containing all results from the job.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodwait(interval=5, timeout=None, verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.StreamingFuture
Wait for the job to complete, then fetch results.
intervalint= config.POLLING_INTERVALTime in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeoutint | None= NoneMaximum time in seconds to wait. Defaults to None.
verbosebool= FalseVerbosity flag. Defaults to False.
**kwargs= {}Keyword arguments passed to get.
The results of the job.
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().
1source
Bases: StreamingFuture[S]
Future for manipulating results for embeddings score-related requests.
sessionAPISessionjobScoreJob | ScoreSingleSiteJob | GenerateJobsequenceslist[bytes] | list[str] | None= Nonemethodget(verbose=False, **kwargs)→list[V]source
inherited from openprotein.jobs.Future
Return all results from the job by consuming the stream.
verbosebool= FalseIf True, display a progress bar. Defaults to False.
**kwargs= {}Keyword arguments passed to the stream method.
A list containing all results from the job.
21source
Bases: EmbeddingsResultFuture, Future
SVD embeddings results represented as a future.
sessionAPISessionjobEmbeddingsJob | AttnJob | LogitsJobsequenceslist[bytes] | list[str] | None= Nonemax_workersint= config.MAX_CONCURRENT_WORKERSmethodwait(interval=5, timeout=None, verbose=False)source
Wait for the SVD embeddings job and retrieve the embeddings.
intervalint= config.POLLING_INTERVALtimeoutint | None= Noneverbosebool= Falsemethodget(verbose=False)source
Get all the SVD reduced embeddings from the job.
methodget_item(sequence)→np.ndarraysource
Get SVD embeddings for specified sequence.
sequencebytesSequence to fetch SVD embeddings for.
SVD embeddings represented a numpy array.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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.
propertyidsource
inherited from openprotein.embeddings.EmbeddingsResultFuture
The unique identifier of the job.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodstream(**kwargs)→Iterator[tuple[K, V]]source
inherited from openprotein.jobs.MappedFuture
Retrieve results for this job as a stream.
A generator that yields (key, value) tuples.
methodstream_sync()source
inherited from openprotein.embeddings.EmbeddingsResultFuture
Stream the embeddings results synchronously.
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().
21source
Bases: EmbeddingsResultFuture
UMAP embeddings results represented as a future.
sessionAPISessionjobEmbeddingsJob | AttnJob | LogitsJobsequenceslist[bytes] | list[str] | None= Nonemax_workersint= config.MAX_CONCURRENT_WORKERSmethodwait(interval=5, timeout=None, verbose=False)source
Wait for the UMAP embeddings job and retrieve the embeddings.
intervalint= config.POLLING_INTERVALtimeoutint | None= Noneverbosebool= Falsemethodget(verbose=False)source
Get all the UMAP projected embeddings from the job.
methodget_item(sequence)→np.ndarraysource
Get UMAP embeddings for specified sequence.
sequencebytesSequence to fetch UMAP embeddings for.
UMAP embeddings represented a numpy array.
propertyargs:dict[str, Any]source
inherited from openprotein.jobs.Future
The registered job arguments.
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.
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.
propertyidsource
inherited from openprotein.embeddings.EmbeddingsResultFuture
The unique identifier of the job.
propertyname:str | Nonesource
inherited from openprotein.jobs.Future
The job's name, or its job id if the job has no name.
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= Nonepropertystart_date:datetime | Nonesource
inherited from openprotein.jobs.Future
The start timestamp of the job.
methodstream(**kwargs)→Iterator[tuple[K, V]]source
inherited from openprotein.jobs.MappedFuture
Retrieve results for this job as a stream.
A generator that yields (key, value) tuples.
methodstream_sync()source
inherited from openprotein.embeddings.EmbeddingsResultFuture
Stream the embeddings results synchronously.
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().