← Revision 1 as of 2010-07-01 05:18:56 →
Size: 163
Comment:
|
Size: 2235
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
[[https://wiki.nbic.nl/index.php/CytoscapeRPC|CytoscapeRPC]] is a plugin for Cytoscape to use Cytoscape as a RPC server. You can call Cytoscape functions from variety of languages including Perl, Python, Ruby, and R. In this tutorial, you learn how to use Cytoscape from R console. | |
Line 5: | Line 6: |
* CytoscapeRPC * XML-RPC package (customized by Paul Shannon. BSD License) |
== Setup == You need to install the following plugins/packages. === Cytoscape Plugin === Just copy the following jar files to Cytoscape plugin directory. * [[https://wiki.nbic.nl/index.php/CytoscapeRPC|CytoscapeRPC Plugin 0.95 or later]]. * [[http://www.ecoficial.com/apachemirror/ws/xmlrpc/|Apache XML RPC library]] * Required files are in '''lib''' directory: xmlrpc-common-3.1.3.jar, xmlrpc-server-3.1.3.jar, ws-commons-util-1.0.2.jar === R Packages === * XML-RPC package [[attachment:XMLRPC_0.2-mod.zip]] (Bug fix version by Paul Shannon. BSD License) * [[http://igraph.sourceforge.net/|igraph]] graph utility package |
Line 9: | Line 20: |
=== Start Cytoscape RPC === 1. Start Cytoscape. If you want to see the all messages (including Exceptions from CytoscapeRPC plugin), start Cytoscape from command line (by executing '''''cytoscape.sh''''' or '''''cytoscape.bat''''') 1. Select '''''Plugins-->CytoscapeRPC-->Activate RPC''''' 1. Modify port number if necessary. Default port is 9000. |
|
Line 10: | Line 25: |
=== Start R === 1. Start R console 1. Load required libraries {{{ > library(igraph) > library(XMLRPC) }}} 1. Test RPC Plugin. {{{ > testResponse = xml.rpc('http://localhost:9000', 'Cytoscape.test') > testResponse [1] "It works!" }}} === Create Network with igraph and Visualize It in Cytoscape === 1. Create an empty network. {{{ > networkID = xml.rpc('http://localhost:9000', 'Cytoscape.createNetwork', 'R-Cytoscape Test') > networkID [1] "2" > networkTitle = xml.rpc('http://localhost:9000', 'Cytoscape.getNetworkTitle', networkID) > networkTitle [1] "R-Cytoscape Test" }}} 1. Generate a scale-free graph according to the Barabasi-Albert model {{{ > g1 <- barabasi.game(200) > g1 Vertices: 200 Edges: 199 Directed: TRUE Edges: [0] 1 -> 0 [1] 2 -> 0 [2] 3 -> 1 . . . }}} |
Control Cytoscape from R Console
Introduction
CytoscapeRPC is a plugin for Cytoscape to use Cytoscape as a RPC server. You can call Cytoscape functions from variety of languages including Perl, Python, Ruby, and R. In this tutorial, you learn how to use Cytoscape from R console.
Setup
You need to install the following plugins/packages.
Cytoscape Plugin
Just copy the following jar files to Cytoscape plugin directory.
Required files are in lib directory: xmlrpc-common-3.1.3.jar, xmlrpc-server-3.1.3.jar, ws-commons-util-1.0.2.jar
R Packages
XML-RPC package XMLRPC_0.2-mod.zip (Bug fix version by Paul Shannon. BSD License)
igraph graph utility package
Tutorial
Start Cytoscape RPC
Start Cytoscape. If you want to see the all messages (including Exceptions from CytoscapeRPC plugin), start Cytoscape from command line (by executing cytoscape.sh or cytoscape.bat)
Select Plugins-->CytoscapeRPC-->Activate RPC
- Modify port number if necessary. Default port is 9000.
Start R
- Start R console
- Load required libraries
> library(igraph) > library(XMLRPC)
- Test RPC Plugin.
> testResponse = xml.rpc('http://localhost:9000', 'Cytoscape.test') > testResponse [1] "It works!"
Create Network with igraph and Visualize It in Cytoscape
- Create an empty network.
> networkID = xml.rpc('http://localhost:9000', 'Cytoscape.createNetwork', 'R-Cytoscape Test') > networkID [1] "2" > networkTitle = xml.rpc('http://localhost:9000', 'Cytoscape.getNetworkTitle', networkID) > networkTitle [1] "R-Cytoscape Test"
- Generate a scale-free graph according to the Barabasi-Albert model
> g1 <- barabasi.game(200) > g1 Vertices: 200 Edges: 199 Directed: TRUE Edges: [0] 1 -> 0 [1] 2 -> 0 [2] 3 -> 1 . . .