Help:WikiPathways Webservice

From WikiPathways

(Difference between revisions)
Jump to: navigation, search
(The WikiPathways web service)
Line 3: Line 3:
|}
|}
= The WikiPathways web service =
= The WikiPathways web service =
-
WikiPathways can be accessed through a [[wikipedia:SOAP|SOAP]] webservice. This page contains documentation for the webservice API.
+
WikiPathways can be accessed through a [[wikipedia:SOAP|SOAP]] web service. This page provides documentation and examples of what you can do with the web service.
== Showcase ==
== Showcase ==
Line 9: Line 9:
{|style="width:75%;" border="0" valign="top" cellspacing="5" cellpadding="1"
{|style="width:75%;" border="0" valign="top" cellspacing="5" cellpadding="1"
-
  |align="center"|<big>'''Search'''</big>{{#imgLink:WikiPathwaysSearch.png|150|center||Help|{{FULLPAGENAME}}/WikiPathwaysSearch|Search}}
+
  |align="center"|<big>'''Search'''</big>{{#imgLink:WikiPathwaysSearch.png|125|center||Help|{{FULLPAGENAME}}/WikiPathwaysSearch|Search}}
''Use the web service to search for pathways''
''Use the web service to search for pathways''
-
  |align="center"|<big>'''Integrate'''</big>{{#imgLink:AtlasMapper.png|150|center||Help|{{FULLPAGENAME}}/AtlasMapper|Integrate}}
+
  |align="center"|<big>'''Integrate'''</big>{{#imgLink:AtlasMapper.png|125|center||Help|{{FULLPAGENAME}}/AtlasMapper|Integrate}}
''Integrate pathway information with gene expression data''
''Integrate pathway information with gene expression data''
  |-
  |-
-
  |align="center"|<big>'''Query interactions'''</big>{{#imgLink:Cytoscape.png|150|center||Help|{{FULLPAGENAME}}/Cytoscape|Cytoscape}}
+
  |align="center"|<big>'''Query interactions'''</big>{{#imgLink:Cytoscape.png|125|center||Help|{{FULLPAGENAME}}/Cytoscape|Cytoscape}}
''Load pathways as interaction networks in Cytoscape''
''Load pathways as interaction networks in Cytoscape''
-
  |align="center"|<big>'''Build workflows'''</big>{{#imgLink:Taverna.png|150|center||Help|{{FULLPAGENAME}}/Taverna|Taverna}}
+
  |align="center"|<big>'''Build workflows'''</big>{{#imgLink:Taverna.png|125|center||Help|{{FULLPAGENAME}}/Taverna|Taverna}}
''Use pathway information in your Taverna workflows''
''Use pathway information in your Taverna workflows''
|}
|}
== Getting Started ==
== Getting Started ==
-
The web service is described in a WSDL file that can be downloaded from:
+
The web service is described in a WSDL file that is located at:
-
[http://www.wikipathways.org/wpi/webservice/webservice.php?wsdl http://www.wikipathways.org/wpi/webservice/webservice.php?wsdl]
+
 
 +
[http://www.wikipathways.org/wpi/webservice/webservice.php?wsdl http://www.wikipathways.org/wpi/webservice/webservice.php?wsdl]
 +
 
 +
You can try out the WikiPathways web service quickly, by loading this WSDL file in [http://www.soapui.org/ SoapUI], a tool for testing web services.
== API Reference ==
== API Reference ==
Line 28: Line 31:
=== Java libraries for WikiPathways ===
=== Java libraries for WikiPathways ===
-
'''Coming soon'''
+
* [http://svn.bigcat.unimaas.nl/pathvisio/trunk/tools/wikipathways-client wikipathways-client]: A high-level API to the WikiPathways web service.
-
 
+
* [http://svn.bigcat.unimaas.nl/pathvisio/trunk/ PathVisio libraries]: Libraries to process GPML and use the synonym databases.
-
* [http://svn.bigcat.unimaas.nl/pathvisio/trunk/ PathVisio libraries]
+
-
* [http://svn.bigcat.unimaas.nl/pathvisio/trunk/tools/wikipathways-client wikipathways-client]
+
=== Working with GPML ===
=== Working with GPML ===
-
The pathways on WikiPathways are stored in the GPML format. This is an XML format and can be processed in any programming language. See [http://www.pathvisio.org/EverythingGPML here] for the GPML specification.
+
The pathways on WikiPathways are stored in the GPML format. This is an XML format and can be processed in any programming language. See [http://www.pathvisio.org/EverythingGPML here] for the GPML specification. If you are developing in Java, we recommend using the [[#Java libraries for WikiPathways|PathVisio library]].
=== SOAP libraries ===
=== SOAP libraries ===
Line 55: Line 56:
== Examples ==
== Examples ==
=== Scripts ===
=== Scripts ===
-
'''Coming soon:''' small example scripts in various languages.
+
Below you find some small example scripts in various languages that may help to get you started.
 +
==== Java ====
 +
Use the [[#Java libraries for WikiPathways|wikipathways-client and PathVisio libraries]] to access the WikiPathways web service from Java. Below is a short example program in Java.
 +
 
 +
<pre>
 +
package org.pathvisio.wikipathways;
 +
 
 +
import java.net.URL;
 +
 
 +
import org.pathvisio.model.DataSource;
 +
import org.pathvisio.model.ObjectType;
 +
import org.pathvisio.model.Pathway;
 +
import org.pathvisio.model.PathwayElement;
 +
import org.pathvisio.model.Xref;
 +
import org.pathvisio.wikipathways.webservice.WSPathway;
 +
import org.pathvisio.wikipathways.webservice.WSPathwayInfo;
 +
import org.pathvisio.wikipathways.webservice.WSSearchResult;
 +
 
 +
public class Example {
 +
public static void main(String[] args) {
 +
try {
 +
//Create a client to the WikiPathways web service
 +
WikiPathwaysClient client = new WikiPathwaysClient(
 +
new URL("http://www.wikipathways.org/wpi/webservice/webservice.php")
 +
);
 +
 +
//Find a pathway by affymetrix probeset
 +
Xref affy = new Xref("at_1234", DataSource.AFFY);
 +
System.out.println("Searching for pathways with Affymetrix probeset " + affy);
 +
 
 +
WSSearchResult[] result = client.findPathwaysByXref(affy);
 +
for(WSSearchResult r : result) {
 +
System.out.println("Found pathway: " + r.getName() + " (" + r.getSpecies() + ")");
 +
}
 +
 +
//Download a pathway from WikiPathways
 +
WSPathway wsPathway = client.getPathway("WP274");
 +
System.out.println("Downloaded pathway " + wsPathway.getName() +
 +
", revision " + wsPathway.getRevision());
 +
//Create a pathway object
 +
Pathway pathway = WikiPathwaysClient.toPathway(wsPathway);
 +
 +
//Get all genes, proteins and metabolites for a pathway
 +
for(PathwayElement pwElm : pathway.getDataObjects()) {
 +
//Only take elements with type DATANODE (genes, proteins, metabolites)
 +
if(pwElm.getObjectType() == ObjectType.DATANODE) {
 +
//Print information to the screen
 +
System.out.println(pwElm.getTextLabel());
 +
System.out.println("\t" + pwElm.getXref());
 +
System.out.println("\t" + pwElm.getDataNodeType());
 +
}
 +
}
 +
 +
//Save the pathway locally
 +
pathway.writeToXml(new File(wsPathway.getName() + ".gpml"));
 +
 +
//Print info for all WikiPathways pathways
 +
WSPathwayInfo[] pathwayList = client.listPathways();
 +
 +
for(WSPathwayInfo pathwayInfo : pathwayList) {
 +
System.out.println("Pathway:");
 +
System.out.println("\tIdentifier:\t" + pathwayInfo.getId());
 +
System.out.println("\tName:\t" + pathwayInfo.getName());
 +
System.out.println("\tOrganism:\t" + pathwayInfo.getSpecies());
 +
}
 +
} catch(Exception e) {
 +
e.printStackTrace();
 +
}
 +
}
 +
}
 +
</pre>
==== R ====
==== R ====

Revision as of 14:26, 12 December 2008

Contents

The WikiPathways web service

WikiPathways can be accessed through a SOAP web service. This page provides documentation and examples of what you can do with the web service.

Showcase

Click on one of the images below for examples on what you can do with the WikiPathways web service.

Search

Use the web service to search for pathways

Integrate

Integrate pathway information with gene expression data

Query interactions

Load pathways as interaction networks in Cytoscape

Build workflows

Use pathway information in your Taverna workflows

Getting Started

The web service is described in a WSDL file that is located at:

http://www.wikipathways.org/wpi/webservice/webservice.php?wsdl

You can try out the WikiPathways web service quickly, by loading this WSDL file in SoapUI, a tool for testing web services.

API Reference

See the API reference page for a list of available web service functions and data structures.

Java libraries for WikiPathways

Working with GPML

The pathways on WikiPathways are stored in the GPML format. This is an XML format and can be processed in any programming language. See here for the GPML specification. If you are developing in Java, we recommend using the PathVisio library.

SOAP libraries

For most programming languages, libraries exist to make working with SOAP web service easier. Below is a short list of SOAP libraries for popular programming languages that might help you work with the WikiPathways web service.

Examples

Scripts

Below you find some small example scripts in various languages that may help to get you started.

Java

Use the wikipathways-client and PathVisio libraries to access the WikiPathways web service from Java. Below is a short example program in Java.

package org.pathvisio.wikipathways;

import java.net.URL;

import org.pathvisio.model.DataSource;
import org.pathvisio.model.ObjectType;
import org.pathvisio.model.Pathway;
import org.pathvisio.model.PathwayElement;
import org.pathvisio.model.Xref;
import org.pathvisio.wikipathways.webservice.WSPathway;
import org.pathvisio.wikipathways.webservice.WSPathwayInfo;
import org.pathvisio.wikipathways.webservice.WSSearchResult;

public class Example {
	public static void main(String[] args) {
		try {
			//Create a client to the WikiPathways web service
			WikiPathwaysClient client = new WikiPathwaysClient(
					new URL("http://www.wikipathways.org/wpi/webservice/webservice.php")	
			);
			
			//Find a pathway by affymetrix probeset
			Xref affy = new Xref("at_1234", DataSource.AFFY);
			System.out.println("Searching for pathways with Affymetrix probeset " + affy);

			WSSearchResult[] result = client.findPathwaysByXref(affy);
			for(WSSearchResult r : result) {
				System.out.println("Found pathway: " + r.getName() + " (" + r.getSpecies() + ")");
			}
			
			//Download a pathway from WikiPathways
			WSPathway wsPathway = client.getPathway("WP274");
			System.out.println("Downloaded pathway " + wsPathway.getName() + 
					", revision " + wsPathway.getRevision());
			//Create a pathway object
			Pathway pathway = WikiPathwaysClient.toPathway(wsPathway);
			
			//Get all genes, proteins and metabolites for a pathway
			for(PathwayElement pwElm : pathway.getDataObjects()) {
				//Only take elements with type DATANODE (genes, proteins, metabolites)
				if(pwElm.getObjectType() == ObjectType.DATANODE) {
					//Print information to the screen
					System.out.println(pwElm.getTextLabel());
					System.out.println("\t" + pwElm.getXref());
					System.out.println("\t" + pwElm.getDataNodeType());
				}
			}
			
			//Save the pathway locally
			pathway.writeToXml(new File(wsPathway.getName() + ".gpml"));
			
			//Print info for all WikiPathways pathways
			WSPathwayInfo[] pathwayList = client.listPathways();
			
			for(WSPathwayInfo pathwayInfo : pathwayList) {
				System.out.println("Pathway:");
				System.out.println("\tIdentifier:\t" + pathwayInfo.getId());
				System.out.println("\tName:\t" + pathwayInfo.getName());
				System.out.println("\tOrganism:\t" + pathwayInfo.getSpecies());
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}

R

Using the SSOAP package in R, you can retrieve pathway information from the WikiPathways web service and use it in your R scripts (e.g. for gene set enrichment or pathway statistics). Below are a few code snippets that show you how to use SSOAP with the WikiPathways web service.

## Install SSOAP from Bioconductor ##
source("http://bioconductor.org/biocLite.R")
biocLite("SSOAP")

## Load the SSOAP library ##
library(SSOAP)

## Create a SOAPServer instance for the web service ##
srv = SOAPServer("http://www.wikipathways.org/wpi/webservice/webservice.php");

## List all organisms on WikiPathways ##
reply = .SOAP(srv, "listOrganisms", action=I("listOrganisms"), handlers=NULL)
doc = xmlParse(reply$content, asText=TRUE)
organismNodes = xmlElementsByTagName(xmlRoot(doc), "organisms", TRUE)

for(node in organismNodes) {
	print(xmlValue(node)) #Print the organism name to the screen
}

## Find all pathways for the 'apoptosis' keyword ##
reply = .SOAP(srv, "findPathwaysByText", query="apoptosis", species="", action=I("findPathwaysByText"), handlers=NULL)
doc = xmlParse(reply$content, asText=TRUE)

# Find the result nodes with an xpath query
resultNodes = getNodeSet(doc, "//*[local-name()='result']")
# Print the pathway name, species and url for each result
for(node in resultNodes) {
	children = xmlChildren(node, addNames= TRUE)
	url = xmlValue(children$url)
	name = xmlValue(children$name);
	species = xmlValue(children$species);
	
	print(paste(name, " (", species, "): ", url, sep=""))
}

Return to Help Contents

Continue to FAQ

Personal tools