The PTGLweb Application Programming Interface (API) allows you to quickly retrieve data from the PTGLweb programmatically. This page explains
how to use the API.
A typical use case is that you want more data than you are willing to download manually by clicking in your web browser. You may, for example, have a list of 250 PDB chains, and you want the albe protein graphs for all of them in GML format.
If you are not a programmer, you may prefer the HTML interface of the PTGLweb.
You can retrieve protein graph (PG) and folding graph (FG) data in GML and JSON formats. You can also retrieve the linear notations (linnots) of a folding graph as a string. It is also possible to retrieve the graph images -- both the PG visualization and the 4 different linnot visualizations.
The PTGLweb is a protein topology database which works mainly on the level of a protein chain: a protein graph includes all the secondary structure elements (SSEs) of a chain. (Which SSEs types are included is determined by the graph type, e.g., the alpha graph only contains alpha helices, while the alpha-beta graph contains both alpha helices and beta strands.)
You may have guessed it, but all methods provided are GET. You cannot alter (insert, update, delete) any data on the server using this API.
All data must be retrieved via GET. Atm, no authentication is required to access the API.
Learn howto address: Protein graphs | Folding graphs | Linear notations | Motifs
Here are some example queries against the API:
Protein graphs:
To automatically process all data of a certain type, it is very handy to know which data is available. For example, you may want to process all chains of a protein -- but how do you know the chain names? The same applies to the
number of connected components (folding graphs) of a protein graph -- how do you know how many connected components a protein graph has? We also provide methods to get this information:
All chain names of a protein:
All queries presented so far were entity queries, i.e., they return data on a single object. We also provide some collection queries, which return some handy lists of objects. All of these return data in JSON format only:
A JSON list of all linear notation strings of a folding graph:
To query for PDB chains containing a motif, you need the following information:
PHP
Here is some simple example code which queries this API from PHP, using libcurl. The code retrieves the ADJ linear notation string of the albe graph of 7tim chain A. Feel free to use and extend it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php $url_linnot = 'http://ptgl.uni-frankfurt.de/api/index.php/linnot/7tim/A/albe/0/adj'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url_linnot); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FAILONERROR, 1); $result = curl_exec($curl); if(curl_errno($curl)) { // TODO: handle error here echo 'ERROR: ' . curl_error($curl); } else { // TODO: do something with the result here // the result will be "{h,3ph,-2me,-3pe,-2pe,-2pe,-2pe,18pe,-2pe,-4pe,-3pe,2zh,3ph,2me}" echo "OK. adj string: " . json_decode($result); } ?> |
BASH shell
We also provide a BASH shell script for Linux that will download the GML files for a list of proteins or chains. The list can be in a CSV file. The script and an example list is available for download here: bash_api_example.zip. The script comes without any warranty. Make sure you understand it and adapt it to your needs before usage. The script uses wget, awk, tr and other standard unix tools.
PTGLweb and the data this API serves are based on PTGLtools. For help, please refer to the PTGLweb about page or the PTGLtools (formerly labeled VPLG) wiki.
The PTGLweb REST API was written by Tim Schäfer at the MolBI group at Uni Frankfurt, Germany.
Please cite the PTGLweb if you use this API for scientific work.
Imprint.