Cytoscape PUBLIC API

The core network and network view interfaces. We should consider rolling groups into network/view.

The core attribute interface.

Interfaces for writing various types to data. Session writing will not be provided as a service since on the internal core will ever write a session.

Interfaces for reading various types of data along with file filters that can be used to define how files get read.

The interfaces used for defining general actions in Cytoscape. Algorithms are strictly separated from any sort of UI.

The interfaces defining the user interface. Tunable objects are the primary mechanism for communicating data between Algorithms and the UI. If an Algorithm wants to be present in the UI, then it must provide its own SwingFactory. Eventually we'll have interfaces for things like CommandLineFactory (we could perhaps infer this automatically) or AJAXFactory.

The interface for defining a web service client.

The (substantially simplified) interfaces for defining visual styles.

The service interfaces for Cytoscape. These interfaces represent much of the functionality that is currently included in Cytoscape.java as static methods. These services will be implemented by cytoscape.

Plugin Implemented Services

The general mechanism for plugins to provide services to the rest of Cytoscape is to implement a public Cytoscape interface and register that object as a service with OSGi's service registry. The primary example of this is the Algorithm/AlgorithmFactory interface. Another example is the CyNetworkFileFilter.

Here is some example plugin code that would provide an SBML reader:

package sbmlreader;

import org.cytoscape.io.import.CyNetworkFileFilter;

import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;

import java.util.Hashtable;

public class SBMLReaderPlugin implements BundleActivator {

        private ServiceRegistration filterReg;

        public void start(BundleContext bc) {
                // defin the service metadata
                Hashtable metadata = new Hashtable();
                metadata.put("file.extensions",".sbml,.xml");
                metadata.put("description","SBML files");
                metadata.put("service.pid",SBMLFilter.class.getName());

                //                                               just an interface, implementation of interface, metadata
                filterReg = bc.registerService(CyNetworkFileFilter.class.getName(), new SBMLFilter(), metadata);
        }

        public void stop(BundleContext bc) {
                filterReg.unregister();
        }
}

Here is code that would exist in the Cytoscape core, consume services that have been registered as implementing CyNetworkFileFilter. Since SBMLReaderPlugin has done this, it will be found and used within the core normally.

package cytoscape;

import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.cytoscape.io.import.CyNetworkFileFilter;

public class ServiceHandler {

    private BundleContext bc;

    // perhaps called at startup or some other time
    public ServiceHandler(BundleContext bc) {
        this.bc = bc;
        registerCyFileFilters();
    }

    public void registerCyFileFilters() {
        try {
           ServiceReference[] sr = bc.getServiceReferences(CyNetworkFileFilter.class.getName(), null);
           for (ServiceReference r : sr ) {
               CyNetworkFileFilter filter = (CyNetworkFileFilter)bc.getService(r));
               // do something with filter
           }
        } catch (Exception e) { e.printStackTrace(); }
    }

CORE Bundle Organization

Plugin Bundle Organization

Scripting

This Algorithm model is separated from the GUI so that it can be easily used in a scripting context (i.e headless mode).

Algorithms

Algorithms can implement additional interfaces, e.g. ProgressTrackable, which would mean a progress monitor could be added.

[http://cishell.org CIShell] does all of this now.

Workflow

JMenu Context

WARNING This scheme currently does not support the case where the Algorithm interacts with the GUI, i.e. returns a result to the GUI.

Visual Styles Refactoring

A VisualStyle consists of a NodeAppearanceCalculator, EdgeAppearanceCalculator, and GlobalAppearanceCalculator.

NodeAppearanceCalculators and EdgeAppearanceCalculators consist of lists of Calculator objects. Each calculator has a specific VisualPropertyType. Only one Calculator of a given VisualPropertyType is allowed in either NodeAppearanceCalculators or EdgeAppearanceCalculators.

Possible Improvements for VisualStyles

UI Services

Interactive - provide an option to bring up before or after action has run Action to create panel Action to be triggered by the panel

// the service interface
interface UIPanel {
  JPanel getJPanel();
}

// in the plugin
// meta data defining where/how to use the panel
Hashtable dict = new HashTable();
dict.put("panel.location","control");
dict.put("panel.name","hello world");
dict.put("service.pid","myuipanel.persistent.id");

bundleContext.registerService(UIPanel.class.getName(), new MyUIPanel(), dict);

Single Action

// The factory is the service.  The factory will return individual action objects
// that can store internal state.  If we didn't have a factory, then the individual
// actions wouldn't be able to store their state because they'd persist as services.
interface CytoscapeActionFactory {
  CytoscapeAction createAction(context of some sort);
  List<Tunable> createParameters(possibly some context);
 boolean isEnabled(context of some sort);
}

interface CytoscapeAction {
   void run();
}

// meta data defining where/how to use the action
Hashtable dict = new HashTable();
dict.put("preferred.menu","whereever/submenu");
dict.put("action.panel","myuipanel.persistent.id"); // so that it can get the exact panel
dict.put("menu.label","asdfasdf");
dict.put("icon", new Icon("my.png"));

bundleContext.registerService(CytoscapeActionFactory.class.getName(), new MyCyActionFactory(), dict);

Current Cytoscape Actions

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