API Documentation
Learn how to use our REST API to submit predictions and retrieve results programmatically.
Authentication
All API requests require a token for authentication. The token should be included in the request body or form data.
Single Sequence Prediction
Submit a prediction request
POST /online-predictors/api/submit/single-sequence/
Content-Type: application/json
{
"token": "your_token_here",
"sequence": "MLSDEDFKAVFGMTRSAFANLPLWKQQNLKKEKGLF",
"predictor_type": "dynamine"}
Available predictor types:
dynamine- DynaMinedisomine- DisoMineearlyfolding- EarlyFoldingagmata- AgMatapsp- PSP
Response
{
"request_id": "uuid_here",
"status": "enqueued"
}
MSA Prediction
Submit a prediction request
POST /online-predictors/api/submit/msa/
Content-Type: application/json
{
"token": "your_token_here",
"msa_data": ">Protein1\nMLSDEDFKAVFGMTRSAFANLPLWKQQNLKKEKGLF\n>Protein2\nMLSDEDFKAVFGMTRSAFANLPLWKQQNLKKEKGLF"
}
Response
{
"request_id": "uuid_here",
"status": "enqueued"
}
ShiftCrypt Prediction
Submit a prediction request
POST /online-predictors/api/submit/shiftcrypt/ Content-Type: multipart/form-data token: your_token_here nef_file: [file] nrm_star_file: [file]
Response
{
"request_id": "uuid_here",
"status": "enqueued"
}
Get Results
Retrieve prediction results
GET /online-predictors/api/results/{request_id}/
Response (Success)
{
"status": "success",
"predictor": "dynamine",
"timestamp": "2024-03-20T12:34:56.789Z",
"results": {
"sequence": "MLSDEDFKAVFGMTRSAFANLPLWKQQNLKKEKGLF",
"prediction": {
// Prediction-specific results
}
}
}
Response (In Progress)
{
"status": "RUNNING"
}
Response (Error)
{
"error": "Error message here"
}
Example Usage
Python
import requests
import json
# Submit a single sequence prediction
response = requests.post(
'http://your-domain/online-predictors/api/submit/single-sequence/',
json={
'token': 'your_token_here',
'sequence': 'MLSDEDFKAVFGMTRSAFANLPLWKQQNLKKEKGLF',
'predictor_type': 'dynamine'
}
)
request_id = response.json()['request_id']
# Poll for results
while True:
response = requests.get(f'http://your-domain/online-predictors/api/results/{request_id}/')
data = response.json()
if data.get('status') == 'FINISHED':
print('Results:', data['results'])
break
elif data.get('status') == 'FAILED':
print('Error:', data['error'])
break
time.sleep(5) # Wait 5 seconds before polling again