Question: Access Pathwaycommons Api
2
gravatar for wlq121
7.4 years ago by
wlq12120
wlq12120 wrote:

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

  1. Is PathwayCommons API SOAP- or REST-based?
  2. What is the URL of PathwayCommons API server?
  3. 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

pathway data api • 1.4k views
ADD COMMENTlink modified 3.8 years ago by Biostar ♦♦ 20 • written 7.4 years ago by wlq12120
2

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.

ADD REPLYlink written 7.4 years ago by Pierre Lindenbaum124k
1
gravatar for Joachim
7.4 years ago by
Joachim2.8k
San Francisco, California
Joachim2.8k wrote:

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
  1. cmd: command for the API
  2. version: API version to use, which will be mostly 2.0, but is 3.0 for the command get_neighbors
  3. q: I am quoting the documentation here: "a comma separated list of internal or external identifiers (IDs), used to identify the physical entities of interest"
  4. 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

ADD COMMENTlink written 7.4 years ago by Joachim2.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1287 users visited in the last hour