BioLMTox API

Enhance biosecurity with the BioLMTox classification endpoint.




Make API Request

There is already a server on BioLM with ESMFold loaded into memory, so predictions should be fast. Let's import the requests library.

from IPython.display import JSON  # Helpful UI for JSON display
import time
from biolmai import BioLM
import requests  # Will use to make calls to BioLM.ai
import csv  # To read example data
lines = []
with open('data/protein/data/PLA2.csv', newline='') as csvfile:
    reader = csv.reader(csvfile)
    for row in reader:
        lines.append(row)
print(lines)
[['label', 'sequence'], ['toxin', 'MHPAHLLVLLAVCVSLLGASDIPPLPLNLAQFGFMIRCANGGSRSPLDYTDYGCYCGKGGRGTPVDDLDRCCQVHDECYGEAEKRLGCSPFVTLYSWKCYGKAPSCNTKTDCQRFVCNCDAKAAECFARSPYQKKNWNINTKARCK'], ['toxin', 'MRTLWIMAVLLVGVEGSLVELGKMILQETGKNPVTSYGAYGCNCGVLGRGKPKDATDRCCYVHKCCYKKLTDCNPKKDRYSYSWKDKTIVCGENNSCLKELCECDKAVAICLRENLDTYNKKYKNNYLKPFCKKADPC']]

Load the example toxin sequences from the CSV file

SEQ1 = lines[1][1]
SEQ2 = lines[2][1]
print("Sequence length 1: {}".format(len(SEQ1)))
print("Sequence length 2: {}".format(len(SEQ2)))
Sequence length 1: 146
Sequence length 2: 138

Let's make a secure REST API request to BioLM API to quickly make the prediction on GPU.

# Make the request - let's time it!
start = time.time()
result = BioLM(entity="biolmtox2", action="predict", type="sequence", items=SEQ1)
end = time.time()
print(f"BioLMTox prediction took {end - start:.4f} seconds.")


# If you wish to view the full result, you can expand the tree in the cell below
JSON(result)
BioLMTox prediction took 19.7995 seconds.
<IPython.core.display.JSON object>

There are keys for each input instance containing:

  • label, the predicted class label either 'toxin' or 'not toxin'
  • score, the model score for the outputed label, the closer to one the more confident the model is in its predction

The label is toxin with a high score of 0.999 which matches the true label! This sequence is infact Phospholipase A2 OS2 a venom protein from the taipan snake.

Next Steps

Check out additional tutorials at jupyter.biolm.ai, or head over to our BioLM Documentation to explore additional models and functionality.

See more use-cases and APIs on your BioLM Console Catalog.


BioLM hosts deep learning models and runs inference at scale. You do the science.

Contact us to learn more.

<span></span>

Accelerate yourLead generation

BioLM offers tailored AI solutions to meet your experimental needs. We deliver top-tier results with our model-agnostic approach, powered by our highly scalable and real-time GPU-backed APIs and years of experience in biological data modeling, all at a competitive price.

CTA

We speak the language of bio-AI

© 2022 - 2025 BioLM. All Rights Reserved.