org.systemsbiology.gaggle.geese.cy.tileViewer
Class ControlPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.systemsbiology.gaggle.geese.cy.tileViewer.ControlPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.rmi.Remote, javax.accessibility.Accessible, Goose

public class ControlPanel
extends javax.swing.JPanel
implements Goose, java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.lang.String[] activeGooseNames
           
protected  java.awt.Cursor busyCursor
           
protected  javax.swing.JButton connectButton
           
protected  CytoscapeWindow cw
           
protected  BioDataServer dataServer
           
protected  java.awt.Cursor defaultCursor
           
protected  javax.swing.JButton disconnectButton
           
protected  GeneFinder geneFinder
           
protected  UndoableGraphHider graphHider
           
protected  java.awt.GridBagLayout gridbagLayout
           
protected  javax.swing.JTextField nodeInClusterSelectionTextField
           
protected  javax.swing.JTextField nodeSelectionTextField
           
protected  javax.swing.JToolBar tileNavigationToolbar
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ControlPanel(CytoscapeWindow cw)
           
 
Method Summary
protected  void clearNetworkSelections()
          ************************************************* protected void broadcastClusterMatrix () { // System.out.println ("broadcastClusterMatrix");

NodeCursor nc = cw.getGraph().selectedNodes ();

ArrayList clusterNodes = new ArrayList (); while (nc.ok ()) { String name = cw.getNodeAttributes().getCanonicalName (nc.node ()); String type = cw.getNodeAttributes().getStringValue ("type", name); if (type != null && type.equals ("cluster")) clusterNodes.add (name); nc.next (); }

if (clusterNodes.size () != 1) { JOptionPane.showMessageDialog (null, "Please choose exactly one cluster to broadcast.", "TileViewer Control Panel Error", JOptionPane.ERROR_MESSAGE); return; }

String clusterName = (String) clusterNodes.get (0); String [] clusteredGenes = cw.getNodeAttributes().getStringArrayValues ("clusterGenes", clusterName); for (int i=0; i < clusteredGenes.length; i++) clusteredGenes [i] = clusteredGenes [i].toUpperCase ();

String [] conditionNames = cw.getNodeAttributes().getStringArrayValues ("clusterConditions", clusterName);

String [] fixedConditionNames = new String [conditionNames.length]; for (int i=0; i < conditionNames.length; i++) { String name = conditionNames [i]; // if (conditionNameFixer.containsKey (name)) // name = (String) conditionNameFixer.get (name); // else // System.err.println ("found no map for old condition name '" + name + "'"); fixedConditionNames [i] = name; } // for i

//System.out.println (clusteredGenes.length + " genes in " + // fixedConditionNames.length + " conditions.");

//for (int i=0; i < clusteredGenes.length; i++) // System.out.println (clusteredGenes [i]);

//for (int i=0; i < fixedConditionNames.length; i++) // System.out.println (fixedConditionNames [i]);

try { System.out.println ("ICP broadcast cluster: " + clusteredGenes.length + " genes " + fixedConditionNames.length + " clusters"); gaggleBoss.broadcast (myGaggleName, species, clusteredGenes, fixedConditionNames); } catch (RemoteException rex0) { System.err.println ("ControlPanel.broadcastClusterMatrix: " + rex0.getMessage ()); }

} // broadcastClusterMatrix ****************************************

 void clearSelections()
           
 void connectToGaggle()
           
protected  int countRegulatoryEdges(Node logicGateNode)
           
protected  javax.swing.JToolBar createGaggleToolBar()
           
protected  javax.swing.JToolBar createTileNavigationToolBar()
           
 void doBroadcastList()
           
 void doExit()
          Tells the goose to exit (terminate).
 void doHide()
          Tells the goose to hide itself
 void doShow()
          Tells the goose to show itself
protected  java.lang.String[] getCanonicalNamesOfNodesInGraph()
           
 java.lang.String[] getCommands()
           
protected  java.util.HashMap getCommonNamesInHash(java.lang.String[] canonicalNames)
          ********************** public String [] getSelectedNodeNames () { Graph2D graph = cw.getGraph (); ArrayList list = new ArrayList (); for (NodeCursor nc = graph.selectedNodes(); nc.ok(); nc.next()) { Node node = nc.node (); String canonicalName = cw.getCanonicalNodeName (node); String organism = cw.getNodeAttributes().getStringValue ("species", canonicalName); list.add (canonicalName); } // for nc

return (String []) list.toArray (new String [0]);

} // getSelectedNodeNames ***********************

 double[] getDoubleEdgeAttributes(java.lang.String attributeName)
           
 double[] getDoubleNodeAttributes(java.lang.String attributeName)
           
 double[] getEdgeWeights()
           
protected  java.util.HashMap getGeneClusters()
           
 java.lang.String getName()
          Returns the name of the goose.
 int getSelectionCount()
           
 void handleCluster(java.lang.String source, Cluster cluster)
          Called when the goose receives a Cluster object
 void handleMatrix(java.lang.String source, DataMatrix matrix)
          Called when the goose receives a DataMatrix object
 void handleNameList(java.lang.String source, Namelist nameList)
          Called when the goose receives a NameList object
 void handleNetwork(java.lang.String source, Network network)
          Called when the goose receives a Network object
 void handleTuple(java.lang.String source, GaggleTuple gaggleTuple)
          Called when the goose receives a GaggleTuple object
 void hideEdgesByWeight(double min)
           
 void hideNodesByThreshold(java.lang.String nodeAttributeName, double threshold, int aboveOrBelow)
           
protected  void hideOrphans()
          'orphan' is defined broadly here to include, not only all unconnected nodes, but also all nodes not connected, directly or indirectly, to a bicluster.
 void selectAllRegulatedClusters()
           
 void selectAllRegulatorsOfSelectedClusters()
           
protected  void selectClustersRegulatedByThisGene(Node regulatorNode)
          select all clusters, all co-regulating genes, and all logicGate nodes within one or two steps from the specified regulator.
protected  void selectNodes()
           
protected  void selectRegulatorsOfOneCluster(Node clusterNode)
           
 void selectTilesAboveCurrentLambdaThreshold()
           
 void selectTilesAboveCurrentRatioThreshold()
           
 void setGeometry(int x, int y, int width, int height)
           
 void setName(java.lang.String newValue)
          Sets the name of (renames) the goose.
 void update(java.lang.String[] gooseNames)
          Provides the goose with an updated list of the names of active geese.
 void zoomInOnNextSelectedNode()
           
 void zoomInOnPreviousSelectedNode()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activeGooseNames

protected java.lang.String[] activeGooseNames

connectButton

protected javax.swing.JButton connectButton

disconnectButton

protected javax.swing.JButton disconnectButton

tileNavigationToolbar

protected javax.swing.JToolBar tileNavigationToolbar

gridbagLayout

protected java.awt.GridBagLayout gridbagLayout

nodeSelectionTextField

protected javax.swing.JTextField nodeSelectionTextField

nodeInClusterSelectionTextField

protected javax.swing.JTextField nodeInClusterSelectionTextField

cw

protected CytoscapeWindow cw

dataServer

protected BioDataServer dataServer

graphHider

protected UndoableGraphHider graphHider

geneFinder

protected GeneFinder geneFinder

defaultCursor

protected java.awt.Cursor defaultCursor

busyCursor

protected java.awt.Cursor busyCursor
Constructor Detail

ControlPanel

public ControlPanel(CytoscapeWindow cw)
Method Detail

connectToGaggle

public void connectToGaggle()

createTileNavigationToolBar

protected javax.swing.JToolBar createTileNavigationToolBar()

selectTilesAboveCurrentRatioThreshold

public void selectTilesAboveCurrentRatioThreshold()

selectTilesAboveCurrentLambdaThreshold

public void selectTilesAboveCurrentLambdaThreshold()

zoomInOnNextSelectedNode

public void zoomInOnNextSelectedNode()

zoomInOnPreviousSelectedNode

public void zoomInOnPreviousSelectedNode()

getCommonNamesInHash

protected java.util.HashMap getCommonNamesInHash(java.lang.String[] canonicalNames)
********************** public String [] getSelectedNodeNames () { Graph2D graph = cw.getGraph (); ArrayList list = new ArrayList (); for (NodeCursor nc = graph.selectedNodes(); nc.ok(); nc.next()) { Node node = nc.node (); String canonicalName = cw.getCanonicalNodeName (node); String organism = cw.getNodeAttributes().getStringValue ("species", canonicalName); list.add (canonicalName); } // for nc

return (String []) list.toArray (new String [0]);

} // getSelectedNodeNames ***********************


selectNodes

protected void selectNodes()

getCanonicalNamesOfNodesInGraph

protected java.lang.String[] getCanonicalNamesOfNodesInGraph()

getGeneClusters

protected java.util.HashMap getGeneClusters()

hideOrphans

protected void hideOrphans()
'orphan' is defined broadly here to include, not only all unconnected nodes, but also all nodes not connected, directly or indirectly, to a bicluster. a simple trick makes it easy to figure out where the second rule applies:
  1. find all the logicGate nodes
  2. for each, count the number of regulatory edges (type = 'activates' or 'represses')
  3. when that count is zero, remove ALL edges on the logicGate node

after these edges are removed, the final step is simply to hide all nodes with no edges


countRegulatoryEdges

protected int countRegulatoryEdges(Node logicGateNode)

clearNetworkSelections

protected void clearNetworkSelections()
************************************************* protected void broadcastClusterMatrix () { // System.out.println ("broadcastClusterMatrix");

NodeCursor nc = cw.getGraph().selectedNodes ();

ArrayList clusterNodes = new ArrayList (); while (nc.ok ()) { String name = cw.getNodeAttributes().getCanonicalName (nc.node ()); String type = cw.getNodeAttributes().getStringValue ("type", name); if (type != null && type.equals ("cluster")) clusterNodes.add (name); nc.next (); }

if (clusterNodes.size () != 1) { JOptionPane.showMessageDialog (null, "Please choose exactly one cluster to broadcast.", "TileViewer Control Panel Error", JOptionPane.ERROR_MESSAGE); return; }

String clusterName = (String) clusterNodes.get (0); String [] clusteredGenes = cw.getNodeAttributes().getStringArrayValues ("clusterGenes", clusterName); for (int i=0; i < clusteredGenes.length; i++) clusteredGenes [i] = clusteredGenes [i].toUpperCase ();

String [] conditionNames = cw.getNodeAttributes().getStringArrayValues ("clusterConditions", clusterName);

String [] fixedConditionNames = new String [conditionNames.length]; for (int i=0; i < conditionNames.length; i++) { String name = conditionNames [i]; // if (conditionNameFixer.containsKey (name)) // name = (String) conditionNameFixer.get (name); // else // System.err.println ("found no map for old condition name '" + name + "'"); fixedConditionNames [i] = name; } // for i

//System.out.println (clusteredGenes.length + " genes in " + // fixedConditionNames.length + " conditions.");

//for (int i=0; i < clusteredGenes.length; i++) // System.out.println (clusteredGenes [i]);

//for (int i=0; i < fixedConditionNames.length; i++) // System.out.println (fixedConditionNames [i]);

try { System.out.println ("ICP broadcast cluster: " + clusteredGenes.length + " genes " + fixedConditionNames.length + " clusters"); gaggleBoss.broadcast (myGaggleName, species, clusteredGenes, fixedConditionNames); } catch (RemoteException rex0) { System.err.println ("ControlPanel.broadcastClusterMatrix: " + rex0.getMessage ()); }

} // broadcastClusterMatrix ****************************************


hideEdgesByWeight

public void hideEdgesByWeight(double min)

hideNodesByThreshold

public void hideNodesByThreshold(java.lang.String nodeAttributeName,
                                 double threshold,
                                 int aboveOrBelow)

selectAllRegulatorsOfSelectedClusters

public void selectAllRegulatorsOfSelectedClusters()

selectRegulatorsOfOneCluster

protected void selectRegulatorsOfOneCluster(Node clusterNode)

selectAllRegulatedClusters

public void selectAllRegulatedClusters()

selectClustersRegulatedByThisGene

protected void selectClustersRegulatedByThisGene(Node regulatorNode)
select all clusters, all co-regulating genes, and all logicGate nodes within one or two steps from the specified regulator. the success of the current algorithm depends upon there being either zero or one logic gates between regulators and the clusters they regulate.


getDoubleEdgeAttributes

public double[] getDoubleEdgeAttributes(java.lang.String attributeName)

getDoubleNodeAttributes

public double[] getDoubleNodeAttributes(java.lang.String attributeName)

getEdgeWeights

public double[] getEdgeWeights()

handleNameList

public void handleNameList(java.lang.String source,
                           Namelist nameList)
                    throws java.rmi.RemoteException
Description copied from interface: Goose
Called when the goose receives a NameList object

Specified by:
handleNameList in interface Goose
Parameters:
source - Optional string indicating name of source goose
nameList - The NameList object
Throws:
java.rmi.RemoteException - if RMI communication fails

handleMatrix

public void handleMatrix(java.lang.String source,
                         DataMatrix matrix)
                  throws java.rmi.RemoteException
Description copied from interface: Goose
Called when the goose receives a DataMatrix object

Specified by:
handleMatrix in interface Goose
Parameters:
source - Optional string indicating name of source goose
matrix - The DataMatrix object
Throws:
java.rmi.RemoteException - if RMI communication fails

handleTuple

public void handleTuple(java.lang.String source,
                        GaggleTuple gaggleTuple)
Description copied from interface: Goose
Called when the goose receives a GaggleTuple object

Specified by:
handleTuple in interface Goose
Parameters:
source - Optional string indicating name of source goose
gaggleTuple - The GaggleTuple object

handleCluster

public void handleCluster(java.lang.String source,
                          Cluster cluster)
                   throws java.rmi.RemoteException
Description copied from interface: Goose
Called when the goose receives a Cluster object

Specified by:
handleCluster in interface Goose
Parameters:
source - Optional string indicating name of source goose
cluster - The Cluster object
Throws:
java.rmi.RemoteException - if RMI communication fails

handleNetwork

public void handleNetwork(java.lang.String source,
                          Network network)
Description copied from interface: Goose
Called when the goose receives a Network object

Specified by:
handleNetwork in interface Goose
Parameters:
source - Optional string indicating name of source goose
network - The Network object

getName

public java.lang.String getName()
Description copied from interface: Goose
Returns the name of the goose.

Specified by:
getName in interface Goose
Overrides:
getName in class java.awt.Component
Returns:
the name of the goose

setName

public void setName(java.lang.String newValue)
Description copied from interface: Goose
Sets the name of (renames) the goose.

Specified by:
setName in interface Goose
Overrides:
setName in class java.awt.Component
Parameters:
newValue - The new name of the goose

getSelectionCount

public int getSelectionCount()

doHide

public void doHide()
Description copied from interface: Goose
Tells the goose to hide itself

Specified by:
doHide in interface Goose

doShow

public void doShow()
Description copied from interface: Goose
Tells the goose to show itself

Specified by:
doShow in interface Goose

clearSelections

public void clearSelections()

setGeometry

public void setGeometry(int x,
                        int y,
                        int width,
                        int height)

doBroadcastList

public void doBroadcastList()
Specified by:
doBroadcastList in interface Goose

doExit

public void doExit()
Description copied from interface: Goose
Tells the goose to exit (terminate).

Specified by:
doExit in interface Goose

getCommands

public java.lang.String[] getCommands()

createGaggleToolBar

protected javax.swing.JToolBar createGaggleToolBar()

update

public void update(java.lang.String[] gooseNames)
Description copied from interface: Goose
Provides the goose with an updated list of the names of active geese. This list includes the name of the goose receiving the list.

Specified by:
update in interface Goose
Parameters:
gooseNames - the names of the currently active geese
See Also:
MiscUtil.updateGooseChooser(javax.swing.JComboBox gooseChooser, String callingGoose, String[] allGeese);