openprotein.fold#
Create PDBs of your protein sequences via our folding models!
Note that for AlphaFold2 Models, you will also need to utilize our align. workflow.
Endpoints#
- class openprotein.fold.FoldAPI[source]#
This class defines a high level interface for accessing the fold API.
- esmfold: ESMFoldModel#
- alphafold2: AlphaFold2Model#
- __init__(session)[source]#
- Parameters:
session (APISession)
- property af2#
Alias for AlphaFold2
- list_models()[source]#
list models available for creating folds of your sequences
- Return type:
list[FoldModel]
- get_model(model_id)[source]#
Get model by model_id.
FoldModel allows all the usual job manipulation: e.g. making POST and GET requests for this model specifically.
- Parameters:
model_id (str) – the model identifier
- Returns:
The model
- Return type:
FoldModel
- Raises:
HTTPError – If the GET request does not succeed.
Models#
- class openprotein.fold.ESMFoldModel[source]#
- model_id: list[str] | str = 'esmfold'#
- fold(sequences, num_recycles=1)[source]#
Fold sequences using this model.
- Parameters:
sequences (List[bytes]) – sequences to fold
num_recycles (int) – number of times to recycle models
- Return type:
- static create(session, model_id, metadata=None, default=None)#
Create and return an instance of the appropriate Future class based on the job type.
Returns: - An instance of the appropriate Future class.
- Parameters:
session (APISession)
model_id (str)
metadata (ModelMetadata | None)
default (type[FoldModel] | None)
- get_metadata()#
Get model metadata for this model.
- Return type:
ModelMetadata
- classmethod get_model()#
- property metadata#
- class openprotein.fold.AlphaFold2Model[source]#
-
- fold(msa, num_recycles=None, num_models=1, num_relax=0)[source]#
Post sequences to alphafold model.
- Parameters:
msa (Union[str, MSAFuture]) – msa
num_recycles (int) – number of times to recycle models
num_models (int) – number of models to train - best model will be used
max_msa (Union[str, int]) – maximum number of sequences in the msa to use.
relax_max_iterations (int) – maximum number of iterations
num_relax (int)
- Returns:
job
- Return type:
Job
- static create(session, model_id, metadata=None, default=None)#
Create and return an instance of the appropriate Future class based on the job type.
Returns: - An instance of the appropriate Future class.
- Parameters:
session (APISession)
model_id (str)
metadata (ModelMetadata | None)
default (type[FoldModel] | None)
- get_metadata()#
Get model metadata for this model.
- Return type:
ModelMetadata
Results#
- class openprotein.fold.FoldResultFuture[source]#
Future Job for manipulating results
- __init__(session, job, sequences=None, max_workers=10)[source]#
Retrieve results from asynchronous, mapped endpoints.
Use max_workers > 0 to enable concurrent retrieval of multiple pages.
- Parameters:
session (APISession)
job (FoldJob)
sequences (list[bytes] | None)
max_workers (int)
- property sequences: list[bytes]#
Sequences submitted for fold request.
- property id#
ID of fold request.
- get(verbose=False)[source]#
Retrieve the fold results as a tuple of sequence to pdb-encoded string.
- Return type:
list[tuple[str, str]]
- get_item(sequence)[source]#
Get fold results for specified sequence.
- Parameters:
sequence (bytes) – sequence to fetch results for
- Returns:
fold
- Return type:
np.ndarray
- cancelled()#
check if job is cancelled
- Return type:
bool
- done()#
Check if job is complete
- Return type:
bool
- refresh()#
Refresh job status.
- stream()#
Retrieve results for this job as a stream.
- wait(interval=5, timeout=None, verbose=False)#
Wait for job to complete, then fetch results.
- Parameters:
interval (int, optional) – time between polling. Defaults to config.POLLING_INTERVAL.
timeout (int, optional) – max time to wait. Defaults to None.
verbose (bool, optional) – verbosity flag. Defaults to False.
- Returns:
results of job
- Return type:
results
- wait_until_done(interval=5, timeout=None, verbose=False)#
Wait for job to complete. Do not fetch results (unlike wait())
- Parameters:
interval (int, optional) – time between polling. Defaults to config.POLLING_INTERVAL.
timeout (int, optional) – max time to wait. Defaults to None.
verbose (bool, optional) – verbosity flag. Defaults to False.
- Returns:
results of job
- Return type:
results