Aggrescan3D 2.0 webserver may be operated through RESTful services, using following URIs:
https://biocomp.chem.uw.edu.pl/a4d/RESTful/submit/1ywo/
submit new job (1ywo pdb entry)https://biocomp.chem.uw.edu.pl/a4d/RESTful/submit/userinput/
submit user pdb file (details below)https://biocomp.chem.uw.edu.pl/a4d/RESTful/submit/1ywo/chain/A/
submit new job (chain A of 1ywo pdb)
name
- project name. Default: randomly generated string (jobid).email
- email (info about job will be send to this email). Default: Noneph
("True"
or "False"
) - Calculate A3D scores at various pH values.Default: True.foldx
("True"
or "False"
) - use FoldX for stability calculations.Default: True.alpha_cutter
("True"
or "False"
) - Use the AlphaCutter to remove the disordered regions of the protein.Default: False.distance
("10"
or "5"
) - distance of aggregation. Default: 10.dynamic
("True"
or "False"
) - use dynamic mode. Default: Falsehide
("True"
or "False"
) - if True - do not show job on the queue page. Default: Truemutate
- list of residues to mutate before A3D analysis. This option will Illustrated in the code snippets. Default: Noneauto_mutation
- selected this option to automatically enhance protein stability. Read more. Default: Noneauto_evolve
- Automatically select mutation targets and mutate them into several amino acids using a conservative evolutionary apporach. Read more. Default: NoneA Python script including custom options that could be used to submit a PDB code:
import requests import json # define which residues to mutate. If the specified residues do not exist within the pdb file # the server will respond with an error (code 400). mutation_table = [{'idx': "1", 'chain': 'A', 'oldres': 'I', 'newres': 'W'}, {'idx': "2", 'chain': 'A', 'oldres': 'D', 'newres': 'W'}] # specify additional options options = {'dynamic': False, 'distance': 5, 'email': 'mary@sue.com', 'name': 'REST_test', 'hide': False, 'mutate': mutation_table, 'foldx': True, 'ph': True, 'alpha_cutter': False, 'auto_mutation': "2 2"} req = requests.post('https://biocomp.chem.uw.edu.pl/a4d/RESTful/submit/1ywo/', data=json.dumps(options), headers={'content-type': 'application/json'}) print(req.status_code) # Print the HTTP code. 200 = OK. 400 = server recognises the problem, 404 = bad. print(req.text) # Print the Response - explained below
A Python script including custom options that could be used to submit a custom PDB file:
import requests import json # define which residues to mutate. If the specified residues do not exist within the pdb file # the server will respond with an error (code 400). mutation_table = [{'idx': "1", 'chain': 'A', 'oldres': 'I', 'newres': 'W'}, {'idx': "2", 'chain': 'A', 'oldres': 'D', 'newres': 'W'}] # specify additional options options = {'dynamic': False, 'distance': 5, 'email': 'mary@sue.com', 'name': 'REST_test', 'hide': False, 'mutate': mutation_table, 'foldx': True, 'auto_mutation': "2 2"} # send the request, note that the test.pdb file has to be in the same directory as this script req = requests.post('https://biocomp.chem.uw.edu.pl/a4d/RESTful/submit/userinput/', files={'inputfile': ("file", open('test.pdb', 'rb')), 'json': (None, json.dumps(options), 'application/json')}) print(req.status_code) # Print the HTTP code. 200 = OK. 400 = server recognises the problem, 404 = bad. print(req.text) # Print the Response - explained below
Other tools can be used to submit the job, as long as they are capable of POST'ing requests. Below is an example of using curl available for most unix systems for users who prefer bash scripting:
curl -i -X POST -d '{"email": "mary@sue.com", "dynamic": "True", "name": "some project name"}' -H 'Content-Type: application/json' https://biocomp.chem.uw.edu.pl/a4d/RESTful/submit/1ywo/The responses might vary depending on the tool used, here we will focus on the Python scripts presented above
200 { "jobid": "a0ae2bb71feeaf0", "status": "submitted" }
400 Auto mutation cannot be selected with dynamic nor mutate
404 <!doctype html> <html lang='en'> [...]
https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/status/
- Check job statushttps://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/structure/
- Get output structure with A3D values in the temperature factor columnhttps://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/
- Get full information about submitted job (see explained in details below)The job status can take on 5 values: pending, queue, running, error and done. See the project status in this tutorial for more explanation.
An example Python script to check the job status:
import requests req = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/status/') try: data = req.json() print(data) except ValueError: print("The server responded but the jobid was not found")The likely response is:
{'status': 'done'}
An example Python script that would save the result A3D pdb file to rest_job.pdb if the job is done:
test = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/status/') if test.json()["status"] == "done": req = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/structure/') with open("rest_job.pdb", "w") as f: f.write(req.text) else: print("Job not yet done")
To get full information about submitted job, user may create Python script like:
import requests req = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/somejobidentifier/') print(req.status_code) data = req.json() for k in data.keys(): print("key: %s: %s" % (k, data[k]))getting output similar to:
200 key: chain_sequence: GSFTMPGLVDSNPAPPESQEKKPLKPCCACPETKKARDACIIEKGEEHCGHLIEAHKECMRALGFKI key: status: done key: mutated_residues: None key: dynamic_mode: 0 key: automated_mutations: 2 3 key: stability_calculations: 1 key: mutation_energetic_effect: 0.0 key: mutation_mode: 0 key: started: 29 Jan 2019 13:19:05 GMT key: updated: 29 Jan 2019 13:24:00 GMT key: project_name: your_job_name key: aggregation_distance: 10 key: aggrescan3Dscore: {u'max': 1.664, u'sum': -95.41120000000001, u'min': -4.1893, u'avg': -1.424, u'tab': [[[u'5', u'S', u'A', u'-0.3282'], [u'6', u'A', u'A', u'-0.1352'], ... ]} key: auto_mut: {u'IE28A': [1.0209, -0.6262, -0.0538], u'VD4P': [-0.042, -0.6319, -0.0595], u'IR28A': [0.8208, -0.6252, -0.0528], ...}
Explaining some of the tabs:
Example script interacting with the output is presented below.
import requests req = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/') data = req.json() # Get the data as a json a3d = data['aggrescan3Dscore'] # Select the aggrescan3Dscore for analysis print("AVG A3D: %s" % (a3d['average_value'])) # print the average value - care the data is all strings at this point print("MIN A3D: %s" % (a3d['min_value'])) for row in a3d['table'][:6]: print(row[0], row[3])to get output like:
AVG A3D: -1.424 MIN A3D: -4.1893 (u'1', u'-0.3367') (u'2', u'0.3541') (u'3', u'1.6640') (u'4', u'0.8468') (u'5', u'1.2976') (u'6', u'0.5633')
Example script to download all the files for a given job:
import os import requests test = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/yourjobid/status/') if test.json()["status"] == "done": req = requests.get('https://biocomp.chem.uw.edu.pl/a4d/RESTful/job/all_data/jourjobid') with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "a3d.tar.gz"), "wb") as f: f.write(req.content) else: print("Job not yet done")Running this script would download a `a3d.tar.gz` file to the directory of the script. The file contains all of the files from the job ran. Depending on the options for the job this archive might have different conatents. Extracting the file should yield: