Differences between revisions 1 and 2
Revision 1 as of 2005-07-23 00:31:18
Size: 2339
Editor: GaryBader
Comment:
Revision 2 as of 2005-07-23 00:33:45
Size: 2485
Editor: GaryBader
Comment:
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:

== Tutorials ==

["Hello World Plugin"]

["Neighbor Node Selection Cytoscape Plugin"]

["Multi-Network Node Selection Cytoscape Plugin"]

Cytoscape allows programmers to write plugins that access the core data structures and windows of Cytoscape to do a wide variety of operations. This tutorial explains how to write a plugin and how to get Cytoscape to load and use your plugin.

It is assumed that the reader is familiar with the basics of the Java programming language and has some kind of programming environment available. See the [http://java.sun.com/docs/books/tutorial/index.html Java Tutorial] for an excellent introduction and handy reference guide for Java. You will also want to check out the [http://www.cbio.mskcc.org/cytoscape/javadoc/ Cytoscape core API documentation].

Each plugin tutorial includes the Java source code and a jar file containing the compiled classes. To run Cytoscape via Java WebStart with all of these plugins automatically loaded, click here: [http://cytoscape.org/pluginTutorial/webStart/cy.jnlp WEB START]. (See the [http://cytoscape.systemsbiology.net/Cytoscape2.0/user/JavaWebStart/index.html Cytoscape Web Start documentation] for information on running Cytoscape via Java Web Start).

["Plugin license policy"]

The CytoscapePlugin class

The CytoscapePlugin class is very simple. It defines a default constructor and one instance method: describe, which can be overridden to describe what the plugin does. A static method also exists that is used by Cytoscape to load plugins. Since the constructor takes no arguments, it is not necessary to explicitly call a parent constructor from your plugin's constructor. The only requirement is that your plugin must have a default (no arguments) constructor, as Cytoscape will call this constructor to instantiate your plugin.

Java only allows a class to inherit from one parent. Since every plugin must extend CytoscapePlugin, this seems to be a severe limitation. The way around this is to define your Cytoscape plugin class as a simple wrapper around your real code. For example:

   1 public class PluginWrapper extends CytoscapePlugin {
   2 
   3     public PluginWrapper() {
   4         RealPlugin plugin = new RealPlugin();
   5     }
   6 }
   7 

This scheme can also be used to link to more complicated services, like a web server, or to connect to code written in other languages via the JNI mechanism (see the JNI section of the Java tutorial).

Tutorials

["Hello World Plugin"]

["Neighbor Node Selection Cytoscape Plugin"]

["Multi-Network Node Selection Cytoscape Plugin"]

Cytoscape_Plugin_Tutorial (last edited 2017-05-03 14:16:47 by bdemchak)

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux