Cytoscape 2.2 (c) 2004 ISB, MSKCC, UCSD

cytoscape.layout
Class AttributeLayout

java.lang.Object
  extended bycytoscape.layout.AttributeLayout

public class AttributeLayout
extends Object

This class provides methods for performing operations on a graph related to the values of a particular data attribute attached to the nodes of the graph. It allows edges to be added between nodes that share an attribute value, to lay out the graph by grouping nodes with shared attribute values, and to clean up after these operations by removing the nodes and edges that were created.


Field Summary
static int CLEAR_OBJECTS
           
static int CREATE_EDGES
           
static int DO_LAYOUT
           
 
Constructor Summary
AttributeLayout(CyNetworkView cyWindow)
           
 
Method Summary
 Map buildValueMap(String attributeName)
          This function build a Map structure based on the unique values of the data attribute specified by the argument.
 void clearPreviousGraphObjects()
          Removes any nodes and edges that were created by a previously called method of this class.
 void createEdges(String attributeName)
          Adds edges between all nodes that share a value for the given node attribute.
 void doCallback(String attributeName, int functionToPerform)
           
 void doLayout(String attributeName)
          Performs a layout operation based on values of the given node attribute.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DO_LAYOUT

public static final int DO_LAYOUT
See Also:
Constant Field Values

CREATE_EDGES

public static final int CREATE_EDGES
See Also:
Constant Field Values

CLEAR_OBJECTS

public static final int CLEAR_OBJECTS
See Also:
Constant Field Values
Constructor Detail

AttributeLayout

public AttributeLayout(CyNetworkView cyWindow)
Method Detail

doCallback

public void doCallback(String attributeName,
                       int functionToPerform)

clearPreviousGraphObjects

public void clearPreviousGraphObjects()
Removes any nodes and edges that were created by a previously called method of this class. It does not undo a previously applied layout.


doLayout

public void doLayout(String attributeName)
Performs a layout operation based on values of the given node attribute. This method creates a new node for each unique value of the given attribute and computes a layout assuming that each of these new nodes is connected to every node that has that attribute value and all other edges are ignored.

This method first removes any nodes or edges created by previous calls to methods in this class by calling clearPreviousGraphObjects().

This method works by cloning the existing GraphPerspective and computing the layout on modifications of that clone. The computed layout is copied to the current GraphPerspective and the newly created category nodes are added.


createEdges

public void createEdges(String attributeName)
Adds edges between all nodes that share a value for the given node attribute. Multiple edges will be added if the attribute value is a list and two nodes share more than one value. The created edges are saved for later removal by the clearPreviousGraphObjects method.


buildValueMap

public Map buildValueMap(String attributeName)
This function build a Map structure based on the unique values of the data attribute specified by the argument. The Map maps each unique attribute value to the set of nodes that have that attribute value. That is, the keys of the map are the unique data attribute values, and the values for each key is a Set containing the nodes that have that data attribute value. Note that, if the data attribute is actually a List of values, then a given node may match more than one attribute value and thus may appear more than once in the map. The data is taken from the node attributes structure of the current network available from the CyWindow attached to this class. An empty Map will be returned if no such attribute exists.


www.cytoscape.org