ESMFold API#

Article Information

Oct 24, 2023

5 min read

This page explains the use of ESMFold, as well as documents its usage on BioLM for protein structure prediction.

API Usage#

here are 2 BioLM endpoints to ESMFold single and multi chain.

Making Requests#

Using ESMFold single chain as an example, folding requests to the endpoints can be made with in several ways including ‘python requests’ or the biolmai SDK

curl --location 'https://biolm.ai/api/v2/esmfold-singlechain/predict/' \
  --header 'Cookie: access=MY_ACCESS_TOKEN;refresh=MY_REFRESH_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
        "items": [
            {
                "sequence": "MSILVTRPSPAGEELVSRLRTLGQVAWHFPLIEFSPGQQLPQLADQLAALGESDLLFALSQHAVAFAQSQLHQQDRKWPRLPDYFAIGRTTALALHTVSGQKILYPQDREISEVLLQLPELQNIAGKRALILRGNGGRELIGDTLTARGAEVTFCECYQRCAIHYDGAEEAMRWQAREVTMVVVTSGEMLQQLWSLIPQWYREHWLLHCRLLVVSERLAKLARELGWQDIKVADNADNDALLRALQ"
            }
        ]
    }'
import requests
import json

url = "https://biolm.ai/api/v2/esmfold-singlechain/predict/"

payload = json.dumps({
        "items": [
            {
                "sequence": "MSILVTRPSPAGEELVSRLRTLGQVAWHFPLIEFSPGQQLPQLADQLAALGESDLLFALSQHAVAFAQSQLHQQDRKWPRLPDYFAIGRTTALALHTVSGQKILYPQDREISEVLLQLPELQNIAGKRALILRGNGGRELIGDTLTARGAEVTFCECYQRCAIHYDGAEEAMRWQAREVTMVVVTSGEMLQQLWSLIPQWYREHWLLHCRLLVVSERLAKLARELGWQDIKVADNADNDALLRALQ"
            }
        ]
    })
headers = {
  'Cookie': 'access=MY_ACCESS_TOKEN;refresh=MY_REFRESH_TOKEN',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
import biolmai
seqs = ["MSILVTRPSPAGEELVSRLRTLGQVAWHFPLIEFSPGQQLPQLADQLAALGESDLLFALSQHAVAFAQSQLHQQDRKWPRLPDYFAIGRTTALALHTVSGQKILYPQDREISEVLLQLPELQNIAGKRALILRGNGGRELIGDTLTARGAEVTFCECYQRCAIHYDGAEEAMRWQAREVTMVVVTSGEMLQQLWSLIPQWYREHWLLHCRLLVVSERLAKLARELGWQDIKVADNADNDALLRALQ"]

cls = biolmai.ESMFoldSingleChain()
resp = cls.predict(seqs)
library(RCurl)
headers = c(
  "Cookie" = "access=MY_ACCESS_TOKEN;refresh=MY_REFRESH_TOKEN",
  "Content-Type" = "application/json"
)
payload = "{
  \"items\": [
    {
      \"sequence\" \"MSILVTRPSPAGEELVSRLRTLGQVAWHFPLIEFSPGQQLPQLADQLAALGESDLLFALSQHAVAFAQSQLHQQDRKWPRLPDYFAIGRTTALALHTVSGQKILYPQDREISEVLLQLPELQNIAGKRALILRGNGGRELIGDTLTARGAEVTFCECYQRCAIHYDGAEEAMRWQAREVTMVVVTSGEMLQQLWSLIPQWYREHWLLHCRLLVVSERLAKLARELGWQDIKVADNADNDALLRALQ\"
    }
  ]
}"
res <- postForm("https://biolm.ai/api/v2/esmfold-singlechain/predict/", .opts=list(postfields = payload, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)

JSON Response#

Expand Example Response
{
“results”: [
{

“pdb”: “PARENT N/AnATOM 1 N MET A 1 -3.717 -20.294 -18.979 1.00 87.61 N nATOM 2 CA MET A 1 “mean_plddt”: 94.2749252319336, “ptm”: 0.9202359914779663 }

]

}

Request Definitions#

items:
Inside items is a list of dictionaries with each dictionary corresponding to one model input.
sequence:

The input sequence for the model

Response Definitions#

results:

This is the main key in the JSON object that contains an array of model results. Each element in the array represents a set of predictions for one input instance.

pdb:

Contains a string representing the 3D structure of the protein predicted by the model in PDB (Protein Data Bank) format.

mean_plddt:

Contains a string representing the mean pLDDT score of the predicted structure. The pLDDT (predicted Local Distance Difference Test) score is a measure of the accuracy of the predicted structure, with values ranging from 0 to 100. Higher scores indicate higher confidence in the prediction.

Note

This graph will be available soon.

The duration for folding predominantly depends on sequence length. A sequence of length 60 might fold in 6 seconds, however a sequence of length 500 might fold in 400 seconds.