Differences between revisions 16 and 17
Revision 16 as of 2007-10-05 18:54:59
Size: 11730
Editor: malbec
Comment:
Revision 17 as of 2007-10-06 00:15:18
Size: 12300
Editor: malbec
Comment:
Deletions are marked like this. Additions are marked like this.
Line 105: Line 105:
== General Bundle Organization ==

 * Each service described below will consist of a small number of interfaces. All service interfaces will be part of a single framework bundle.
 * Each service implementation will (probably) have a separate bundle. This isn't necessary, but some organization is a good idea.
 * There will be an initialization bundle that will handle starting and stopping all of the core services defined in the framework.
 * The GUI will consist of separate bundles.
 * Each service will (for the most part) have an associated GUI bundle.
 

Cytoscape APIs

Cytoscape Provided Services

Plugin Implemented Services

The APIs for these services are defined as interfaces in Cytoscape. The interfaces are as follows:

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

  • Control Tab
  • Results Tab
  • Dialog

// 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

  • Menu Item
  • Button On Toolbar

// 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);

Menu Action flow of events

  1. MenuItem is created.

  2. Click on a menu
  3. The menuSelected() method checks the CytoscapeActionFactory metadata to see if the menu item should be enabled/disabled. The Action could just declare what attributes need to exist in the world in the metadata of the CytoscapeActionFactory. For example, you could define metadata like requiresNetwork, requiresNetworkView, requiresNodeSelection, requiresEdgeSelection, etc.. There could also a overriding metadatum called isEnabled that could be forced to be true if necessary.

  4. The menu would be displayed if the action is enabled.
  5. The menu looks for a registered service for CytoscapeActionFactory. The individual factory returned is determined based on a parameter to the MenuItem. This happens dynamically based on how the CytoscapeActionFactories are defined.

  6. First call createParameters() that creates some sort of UI (e.g. a GUI that allows input values or a command line that reads a config file or queries a database or reads a command line, etc.). This data is specified by the user and is then passed into the action that is created next.
  7. The factory.createAction() method is called with all of the appropriate params (e.g. currentNetwork, currentNetworkView, etc.).
  8. The CytoscapeAction object can now be run at your leisure.

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

A CytoscapeAction needs it's basic inputs (current network, current view, or possibly a DataManager), but it also may need separate parameters. These should be defined as some sort of Tunable or List<Tunable> or a JPanel that returns some sort of configuration object, e.g. a Dictionary of key -> value pairs.

The action context could be a DataManager interface that provides methods like getCurrentNetwork, getCurrentNetworkView, etc.. Alternatively, you could provide an Context object (e.g. CIShellContext) which could provide access to all Cytoscape services. This isn't an osgi context that worries about bundles, but is an application specific context that provides services appropriate for how the application is currently being run.

Scripting

This Action model needs to be separated from the GUI so that it can be used in a scripting context (i.e headless mode) as well.

MetaData could also be used to specify where the Action can be used. For example you could set a requiresGUI (or even requiresSwing) element that would disable the action if the current running context doesn't support a GUI.

the Solution

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

Action Services

  • An action gets current context (network, view, etc.). Then the action does "something". The action should be independent of the UI. Make the actions chainable.

General Bundle Organization

  • Each service described below will consist of a small number of interfaces. All service interfaces will be part of a single framework bundle.
  • Each service implementation will (probably) have a separate bundle. This isn't necessary, but some organization is a good idea.
  • There will be an initialization bundle that will handle starting and stopping all of the core services defined in the framework.
  • The GUI will consist of separate bundles.
  • Each service will (for the most part) have an associated GUI bundle.

Breakdown of Cytoscape Services

Currently supported by Cytoscape.java.

  • handled by OSGi
    • void exit(int returnVal) {
  • gui specific
  • network service
    • Set getNetworkSet() {
    • CyNetwork getNetwork(String id) {

    • CyNetwork getNullNetwork() {

    • CyNetwork getCurrentNetwork() {

    • void setCurrentNetwork(String id) {
    • void destroyNetwork(CyNetwork network) {

    • CyNetwork createNetwork(String title, ...) {

    • encapsulate in CyNetwork:

      • List getCyNodesList() {
      • List getCyEdgesList() {
      • CyNode getCyNode(String alias)

      • CyEdge getCyEdge(Node node_1, Node node_2, ...)

  • network view service
  • session service
    • String getCurrentSessionFileName() {
    • void setCurrentSessionFileName(String newName) {
    • void setSessionState(int state) {
    • int getSessionstate() {
    • void createNewSession() {
  • attribute service
    • CyAttributes getNodeAttributes() {

    • CyAttributes getEdgeAttributes() {

    • CyAttributes getNetworkAttributes() {

    • void loadAttributes(String[] nodeAttrLocations, String[] edgeAttrLocations) {
  • import service
  • event handling service
  • expression data service
    • ExpressionData getExpressionData() {

    • void setExpressionData(ExpressionData expData) {

    • boolean loadExpressionData(String filename, boolean copy_atts) {
  • ontology service
  • bookmark service
    • Bookmarks getBookmarks() throws JAXBException, IOException {
    • void setBookmarks(Bookmarks pBookmarks) {

NOT Currently provided by Cytoscape.java

  • Export service

"Services" currently existing elsewhere that would be transformed into OSGi services.

Visual Styles

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

Current Cytoscape Actions

OSGI_Refactoring_Possibilities (last edited 2009-02-12 01:03:49 by localhost)

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