Hi all,
I want to incorporate pathway search into my routine program for network analysis. As a starting point, I want to use the API service of PathwayCommons. I am an API newbie. From reading some API instruction webpages, I think that I will need the following information to setup my API search
- Is PathwayCommons API SOAP- or REST-based?
- What is the URL of PathwayCommons API server?
- What language can I use? Can I use Python to access API?
However, I did not find this information on the PathwayCommons website (http://www.pathwaycommons.org/pc/webservice.do?cmd=help). Does anyone here have experience of using PathwayCommons API? Would you mind giving me some guidance?
Your help is much appreciated.
Thank you, Wendy
1 answer
Hi!
To extend a bit on Pierre's comment:
REST or SOAP?
REST, because you access the API through parametrized URLs. SOAP would have some form of XML message that you need to send, http://en.wikipedia.org/wiki/SOAP.
PathwayCommons API URL
The base URL for making RESTful requests is: http://www.pathwaycommons.org/pc/webservice.do
In order to get the API to do anything, you need to add some arguments to the URL though. For example:
http://www.pathwaycommons.org/pc/webservice.do?cmd=get_pathways&version=2.0&q=O14763&input_id_type=UNIPROT
cmd: command for the APIversion: API version to use, which will be mostly 2.0, but is 3.0 for the commandget_neighborsq: I am quoting the documentation here: "a comma separated list of internal or external identifiers (IDs), used to identify the physical entities of interest"input_id_type: the type of IDs you are using; a list of valid IDs is listed here: http://www.pathwaycommons.org/pc/webservice.do?cmd=help#valid_input_id_type
You can execute a query in your BASH as follows:
$ curl -s 'http://www.pathwaycommons.org/pc/webservice.do?cmd=get_pathways&version=2.0&q=O14763&input_id_type=UNIPROT'
Database:ID Pathway_Name Pathway_Database_Name CPATH_ID
UNIPROT:O14763 Caspase-8 is formed from procaspase-8 REACTOME 486288
UNIPROT:O14763 TRAIL signaling REACTOME 486289
UNIPROT:O14763 Activation of Pro-Caspase 8 REACTOME 486291
UNIPROT:O14763 Death Receptor Signalling REACTOME 486300
UNIPROT:O14763 Extrinsic Pathway for Apoptosis REACTOME 486301
UNIPROT:O14763 Apoptosis REACTOME 486302
...
Language
It is possible to query the API with curl from the command line, or pretty much any programming language which has libraries for making HTTP requests. Here is a simple snippet how to get the same information from above via Ruby. Save the following text as api.rb:
require 'net/http'
require 'uri'
url = URI.parse('http://www.pathwaycommons.org')
res = Net::HTTP.start(url.host, url.port) {|http|
http.get('/pc/webservice.do?cmd=get_pathways&version=2.0&q=O14763&input_id_type=UNIPROT')
}
puts res.body
Now you can run this Ruby script in your shell as:
ruby api.rb
Hope that helps,
Joachim
Log in to answer this question.
I could find all the needed information on http://www.pathwaycommons.org/pc/webservice.do?cmd=help . Where's the problem ? 1) REST API 2) http://www.pathwaycommons.org/pc/webservice.do 3) whatever you want.