The TMBpred web server has some RESTful endpoints for programmatic access.
You can:

  • Send a job to query the panel for a cancer type.
  • Send a job to predict TMB by amount of mutations by genes/exons.
  • Send a job to predict TMB by mutated genomic coordenates.
  • Check the job status.
  • Retrive the results of the executed jobs.
There are available some examples below using the RESTful endpoints for programmatic access, and the input/output files.
The GET request for consult a job status return a JSON
GET

Example code in python for the GET request

       import requests  
       jobid = ""
       status_job = "http://tmbpred.leloir.org.ar/api/" + jobid;         
       consult_r = requests.get(status_job)
       output_json = consult_r.json()
       
The structure of JSON output for the GET request
Item Type Description
job_id string of 36 characters Or 'Not found' is a UUID code which identifies the job
status string of job status Possible values are Pending, Executing, Successfully, Error or '' (if the jobid is not found).
date_done Date-time Date and time of the sent job or '' if the jobid is not found.

A tar.gz file will be downloaded if the Job ID is valid and its execution is finished.

The GET request return a tar.gz file
GET

Example code in python for the GET request

       import requests  
       jobid = ""
       down_data = "http://tmbpred.leloir.org.ar/download/" + jobid;         
       consult_r = requests.get(down_data)
       if consult_r.status_code == 200:
           #save as tar.gz     
           with open(jobid + ".tar.gz", "wb") as f:
               f.write(consult_r.content)    
        else:
            #some error found
            output_json = consult_r.json()      
       
The POST request to send a job to predict TMB by mutations, return a JSON
POST

The data sent in the POST request must have the following items
Item Type Default Description
model-cancer list of at least one Cancer Type ID [] Possible cancer types: "BRE", "COL", "END", "GAS", "GLI", "HAV", "LIV", "MEL", "NME", "NSL", "OVA", "PAN", "PRO" and "UNI". See more details in About, subheading List of cancer types.
model-quality char B 'B', 'S' or 'X' for Best, Suggested or All Models respectively.
model-databy list of one or two chars ['G'] 'G' for Gene and 'E' for Exon.
model-subset list of one, two or three chars ['O'] 'O', 'C' and 'F' for Our-strategy, Census-strategy Foundation-one-strategy respectively.
email string It is optional, a valid mail to send the job id.
efile-delimiter string \t '\t', ',', ';', ':', '\s+' for the separator TAB, COMMA, SEMICOLON, COLON and SPACES respectively.
efile-header char o boolean True Any value is considered if the file has a header in the first line, except False, 'false', 'n', 'no' or '' indicate has not header.
data

The file sent in the POST request must have the following structure
Tuple as (<name_file>, <data_file>, <encoding>). When <name_file> is a string of the file name, <data_file> is the content of the file as a binary read, and <encoding> depend of the extension file, as follow: encoding "text/plain", "application/vnd.ms-excel", "application/octet-stream", "application/x-tar", "application/x-gzip" and "application/x-zip-compressed" for the extensions "txt", "csv", "tsv", "tar", "tar.gz" and "zip" respectivelly.

The structure of JSON output for the POST request
Item Type Description
message string 'Send the job to process' if the data and file sent has not errors, or 'Errors on the submited data' if the data has errors.
status integer A status code, 200 for Ok, and 400 for Errors.
jobid string if no errors, this key is present and has the job id.
jobtype string type of job: CONSULT, PREDICT_BY_MUTATIONS or PREDICT_BY_COORDENATES
errors dictionary all the errors found in the data and file submited, specified the error origin.

The GET request return the structure of data and file to be sent as a JSON
GET

Example code in python for the POST request

       import requests  
       pred_tmb = "http://tmbpred.leloir.org.ar/api/pred_mutations"
       data_send = {
           "model-cancer": "BRE", 
           "model-quality": "B", 
           "model-databy": ["G"], 
           "model-subset": ["O"], 
           "email": "",
           "efile-delimiter": "\t", 
           "efile-header": True, 
           "column-gene_exon_id": 1, 
           "column-mutations": 2
       }
       file_send = {
           "efile-filename": ("example_by_mutations.txt", open("ejemplo.txt","rb"), "text/plain")
       }           
       consult_r = requests.post(pred_tmb, data=data_send, files=file_send)
       output_json = consult_r.json()
       

The POST request to send a job to predict TMB by genomic coordenates, return a JSON
POST

The data sent in the POST request must have the following items
Item Type Default Description
model-cancer list of at least one Cancer Type ID [] Possible cancer types: "BRE", "COL", "END", "GAS", "GLI", "HAV", "LIV", "MEL", "NME", "NSL", "OVA", "PAN", "PRO" and "UNI". See more details in About, subheading List of cancer types.
model-quality char B 'B', 'S' or 'X' for Best, Suggested or All Models respectively.
model-databy list of one or two chars ['G'] 'G' for Gene and 'E' for Exon.
model-subset list of one, two or three chars ['O'] 'O', 'C' and 'F' for Our-strategy, Census-strategy Foundation-one-strategy respectively.
email string It is optional, a valid mail to send the job id.
efile-delimiter string \t '\t', ',', ';', ':', '\s+' for the separator TAB, COMMA, SEMICOLON, COLON and SPACES respectively.
efile-header char o boolean True Any value is considered if the file has a header in the first line, except False, 'false', 'n', 'no' or '' indicate has not header.
data

The file sent in the POST request must have the following structure
Tuple as (<name_file>, <data_file>, <encoding>). When <name_file> is a string of the file name, <data_file> is the content of the file as a binary read, and <encoding> depend of the extension file, as follow: encoding "text/plain", "application/vnd.ms-excel", "application/octet-stream", "application/x-tar", "application/x-gzip" and "application/x-zip-compressed" for the extensions "txt", "csv", "tsv", "tar", "tar.gz" and "zip" respectivelly.

The structure of JSON output for the POST request
Item Type Description
message string 'Send the job to process' if the data and file sent has not errors, or 'Errors on the submited data' if the data has errors.
status integer A status code, 200 for Ok, and 400 for Errors.
jobid string if no errors, this key is present and has the job id.
jobtype string type of job: CONSULT, PREDICT_BY_MUTATIONS or PREDICT_BY_COORDENATES
errors dictionary all the errors found in the data and file submited, specified the error origin.

The GET request return the structure of data and file to send as a JSON
GET

Example code in python for the POST request

       import requests  
       pred_tmb = "http://tmbpred.leloir.org.ar/api/pred_coordenates"
       data_send = {
           "model-cancer": "BRE", 
           "model-quality": "B", 
           "model-databy": ["G"], 
           "model-subset": ["O"], 
           "email": "", 
           "efile-delimiter": "\t", 
           "efile-header": True, 
           "column-chromosome": 1, 
           "column-start_position": 2, 
           "column-end_position": 3
       }
       file_send = {
           "efile-filename": ("example_by_coordenates.txt", open("ejemplo.txt","rb"), "text/plain")
       }           
       consult_r = requests.post(pred_tmb, data=data_send, files=file_send)
       output_json = consult_r.json()
       
The POST request to send a job to query the panel, return a JSON
POST

The data sent in the post request must have the following items
Item Type Default Description
model-cancer list of at least one Cancer Type ID [] Possible cancer types: "BRE", "COL", "END", "GAS", "GLI", "HAV", "LIV", "MEL", "NME", "NSL", "OVA", "PAN", "PRO" and "UNI". See more details in About, subheading List of cancer types.
model-quality char B 'B', 'S' or 'X' for Best, Suggested or All Models respectively.
model-databy list of one or two chars ['G'] 'G' for Gene and 'E' for Exon.
model-subset list of one, two or three chars ['O'] 'O', 'C' and 'F' for Our-strategy, Census-strategy Foundation-one-strategy respectively.
email string It is optional, a valid mail to send the job id.

The GET request return the previous table as a JSON
GET

The structure of JSON output for the POST request
Item Type Description
message string 'Send the job to process' if the data and file sent has not errors, or 'Errors on the submited data' if the data has errors.
status integer A status code, 200 for Ok, and 400 for Errors.
jobid string if no errors, this key is present and has the job id.
jobtype string type of job: CONSULT, PREDICT_BY_MUTATIONS or PREDICT_BY_COORDENATES
errors dictionary all the errors found in the data and file submited, specified the error origin.

Example code in python for the POST request

       import requests  
       consult_models = "http://tmbpred.leloir.org.ar/api/models"
       data_send = {
           "model-cancer": "BRE", 
           "model-quality": "B", 
           "model-databy": ["G"], 
           "model-subset": ["O"], 
           "email": ""  
       }
       consult_r = requests.post(consult_models, data=data_send)
       output_json = consult_r.json()
       

We propose two file templates to run the analysis and consider how appropiate TMBpred server is for your needs.The examples are purely fictitious and any resemblance to existing sample ID is purely coincidental:
Example of input file to predict TMB by amount of mutations per gene/exon
Example of input file to predict TMB by mutated genomic coordenates


After the execution and when the process is ended, you will have access to the results indicating your Job ID in the job status tab (in case you have added your email account, you will be notified there as well). Finally, you will receive a tar.gz file which contains 4 .txt files + README.pdf with a detail description of each file + other .pdf files with graphically results (the number of these files depends on the quality parameter you have selected):
Example of output file to predict TMB by amount of Mutations
Example of output file to predict TMB by mutated genomic coordenates


If you want to ascertain the genes/exons model(s) to be sequenced by cancer type, you will receive a tar.gz file which contains 2 .txt files + README.pdf with a detail description of each file:
Example of output file to query the panel