Cytoscape Developer Documentation |
Getting Started
Developing Cytoscape means programming in Java. There are plugins that make it possible to instead use Python/Perl/R, but these plugins only allow a small amount of the opertaions that Cytoscape provides. In order to assist new Developers in writing plugings we have a variety of resources avalailable. We provide a Concepts Document that goes through what the key classes are in Cytoscape that are used by plugins. In addtion we have tried to make our API as complete as possible. Remember that you need not be limited to the API, you can use the API from any plugin in your plugin as well. Notably, Filters are only available as a plugin. If you need a jump start, there is a simple "Hello World" style plugin tutorial available.
Also, possibly the best source of information is the Cytoscape Community. By signing up for our discussion email list, you will have access to the worldwide community of Cytoscape developers. Thanks for developing for Cytoscape!
Species Specific Context Menus
One of the top questions is how to make ones own context menus. It does require some programming, but it should be fairly obvious how it is done. All context menus are loaded as a Plugin. What that means is that once you have built your new menus, and made them into a Java Jar file. Putting them in your Cytoscape plugins directory will have them automatically loaded next time you start Cytoscape.
Before proceeding, please read through the Concepts Document, and dowload the refercence code. The way that a context menu works is that each menu item is added to a NetworkView, and when clicked on, is run via an abstract static class.
First look at src/csplugins/contextmenu/yeast/YeastPlugin.java. Each menu item is added via code that looks like:
|
view.addContextMethod( "class
phoebe.PNodeView",
"csplugins.contextmenu.yeast.NodeAction", "openWebInfo", new Object[] { view } , JarLoader.getLoader() ); |
Breaking this down:
The code for NodeAction.openWebInfo is where the actaul menu item is defined:
|
/**
* This will open an web page that will give you more info. */ public static JMenuItem openWebInfo ( Object[] args, PNode node ) { final PNode nv = node; JMenu web_menu = new JMenu( "Web Info" ); web_menu.add( new JMenuItem( new AbstractAction( "SGD yeast only" ) { public void actionPerformed ( ActionEvent e ) { // Do this in the GUI Event Dispatch thread... SwingUtilities.invokeLater( new Runnable() { public void run() { String gene = null; if ( nv instanceof PNodeView ) { gene = ( ( PNodeView ) nv).getLabel().getText(); } if ( gene == null ) { gene = ( String )nv.getClientProperty("tooltip"); } OpenBrowser.openURL( "http://db.yeastgenome.org/cgi-bin/SGD/locus.pl?locus="+gene ); } } ); } } ) ); return web_menu; } |
Simply replacing the URL with your own, is enough to add support for a new organism. Please look at the rest of this class, and use the discussion list if you have any problems.