Cytoscape 2.2 (c) 2004 ISB, MSKCC, UCSD

cytoscape
Class Cytoscape

java.lang.Object
  extended bycytoscape.Cytoscape

public abstract class Cytoscape
extends Object

This class, Cytoscape is the primary class in the API. All Nodes and Edges must be created using the methods getCyNode and getCyEdge, available only in this class. Once A node or edge is created using these methods it can then be added to a CyNetwork, where it can be used algorithmically.

The methods get/setNode/EdgeAttributeValue allow you to assocate data with nodes or edges. That data is then carried into all CyNetworks where that Node/Edge is present.


Field Summary
static String ATTRIBUTES_CHANGED
           
static String CYTOSCAPE_EXIT
           
static String EXPRESSION_DATA_LOADED
           
static int FILE_BY_SUFFIX
          When creating a network, use one of the standard suffixes to have it parsed correctly
sif -- Simple Interaction File gml -- Graph Markup Languange sbml -- SBML
static int FILE_GML
           
static int FILE_SBML
           
static int FILE_SIF
           
static String NETWORK_CREATED
           
static String NETWORK_DESTROYED
           
static String NETWORK_LOADED
           
static String NETWORK_MODIFIED
           
static String NETWORK_SAVED
           
static String PREFERENCE_MODIFIED
           
static int SELECT_EDGES_ONLY
           
static int SELECT_NODES_AND_EDGES
           
static int SELECT_NODES_ONLY
           
 
Constructor Summary
Cytoscape()
           
 
Method Summary
static void clearCytoscape()
          Deprecated. WARNING: this should only be used under special circumstances.
static CyNetwork createNetwork(Collection nodes, Collection edges, String title)
          Creates a new Network
static CyNetwork createNetwork(Collection nodes, Collection edges, String child_title, CyNetwork parent)
          Creates a new Network, that inherits from the given ParentNetwork
static CyNetwork createNetwork(int[] nodes, int[] edges, String title)
          Creates a new Network
static CyNetwork createNetwork(int[] nodes, int[] edges, String child_title, CyNetwork parent)
          Creates a new Network, that inherits from the given ParentNetwork
static CyNetwork createNetwork(String title)
          Creates a new, empty Network.
static CyNetwork createNetwork(String title, boolean create_view)
          Creates a new, empty Network.
static CyNetwork createNetwork(String location, int file_type, boolean canonicalize, BioDataServer biodataserver, String species)
          Creates a cytoscape.data.CyNetwork from a file.
static CyNetwork createNetworkFromFile(String location)
          Creates a cytoscape.data.CyNetwork from a file.
static CyNetwork createNetworkFromProject(CyProject project, BioDataServer bioDataServer)
          Constructs a network using information from a CyProject argument that contains information on the location of the graph file, any node/edge attribute files, and a possible expression data file.
static CyNetworkView createNetworkView(CyNetwork network)
          Creates a CyNetworkView, but doesn't do anything with it.
static CyNetworkView createNetworkView(CyNetwork network, String title)
          Creates a CyNetworkView, but doesn't do anything with it.
static void destroyNetwork(CyNetwork network)
          destroys the given network
static void destroyNetwork(CyNetwork network, boolean destroy_unique)
          destroys the given network
static void destroyNetwork(String network_id)
          destroys the given network
static void destroyNetworkView(CyNetwork network)
          destroys the networkview, including any layout information
static void destroyNetworkView(CyNetworkView view)
          destroys the networkview, including any layout information
static void destroyNetworkView(String network_view_id)
          destroys the networkview, including any layout information
static void disableSquiggle()
          Utility method to disable Squiggle function.
static void enableSquiggle()
          Utility method to enable Squiggle function.
static void ensureCapacity(int nodes, int edges)
          Ensure the capacity of Cytoscapce.
static void exit()
          Shuts down Cytoscape, after giving plugins time to react.
static void firePropertyChange(String property_type, Object old_value, Object new_value)
           
static BioDataServer getBioDataServer()
           
static CyNetwork getCurrentNetwork()
          Return the Network that currently has the Focus.
static CyNetworkView getCurrentNetworkView()
          Return the CyNetworkView that currently has the focus.
static CyEdge getCyEdge(Node node_1, Node node_2, String attribute, Object attribute_value, boolean create)
          Gets the first CyEdge found between the two nodes (direction does not matter) that has the given value for the given attribute.
static CyEdge getCyEdge(String source_alias, String edge_name, String target_alias, String interaction_type)
           
static List getCyEdgesList()
           
static CyNode getCyNode(String alias)
           
static CyNode getCyNode(String alias, boolean create)
           
static List getCyNodesList()
           
static CytoscapeObj getCytoscapeObj()
          Deprecated.  
static CytoscapeDesktop getDesktop()
           
static CyAttributes getEdgeAttributes()
          Gets Global Edge Attributes
static String[] getEdgeAttributesList()
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static Object getEdgeAttributeValue(Edge edge, String attribute)
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static cytoscape.data.GraphObjAttributes getEdgeNetworkData()
          Deprecated. Use getEdgeAttributes() instead. This method will be removed in September, 2006.
static ExpressionData getExpressionData()
           
static CyNetwork getNetwork(String id)
           
static Set getNetworkSet()
          Return a List of all available CyNetworks
static CyNetworkView getNetworkView(String network_id)
           
static Map getNetworkViewMap()
          This Map has keys that are Strings ( network_ids ) and values that are networkviews.
static CyAttributes getNodeAttributes()
          Gets Global Node Attributes.
static String[] getNodeAttributesList()
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static String[] getNodeAttributesList(Edge[] edges)
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static String[] getNodeAttributesList(Node[] nodes)
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static Object getNodeAttributeValue(Node node, String attribute)
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static cytoscape.data.GraphObjAttributes getNodeNetworkData()
          Deprecated. Use getNodeAttributes() instead. This method will be removed in September, 2006.
static PropertyChangeSupport getPropertyChangeSupport()
           
static cytoscape.giny.CytoscapeRootGraph getRootGraph()
          Return the CytoscapeRootGraph
static int getSelectionMode()
          Gets the selection mode value.
static SwingPropertyChangeSupport getSwingPropertyChangeSupport()
          Bound events are: NETWORK_CREATED NETWORK_DESTROYED ATTRIBUTES_ADDED CYTOSCAPE_EXIT
static boolean isSquiggleEnabled()
          Returns the value of the global flag to indicate whether the Squiggle function is enabled.
static void loadAttributes(String[] nodeAttrLocations, String[] edgeAttrLocations)
          Loads Node and Edge attribute data into Cytoscape from the given file locations.
static void loadAttributes(String[] nodeAttrLocations, String[] edgeAttrLocations, boolean canonicalize, BioDataServer bioDataServer, String species)
          Loads Node and Edge attribute data into Cytoscape from the given file locations.
static BioDataServer loadBioDataServer(String location)
          A BioDataServer should be loadable from a file systems file or from a URL.
static boolean loadExpressionData(String filename, boolean copy_atts)
          Load Expression Data
static void setCurrentNetwork(String id)
          Deprecated.  
static boolean setCurrentNetworkView(String id)
          Deprecated.  
static boolean setEdgeAttributeValue(Edge edge, String attribute, Object value)
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static void setExpressionData(ExpressionData expData)
           
static boolean setNodeAttributeValue(Node node, String attribute, Object value)
          Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.
static void setSelectionMode(int selectionMode)
          Sets the specified selection mode on all views.
static void setSelectionMode(int selectionMode, GraphView view)
          Utility method to set the selection mode on the specified GraphView.
static void setSpecies()
          Deprecated. argh!...
static boolean viewExists(String network_id)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORK_CREATED

public static String NETWORK_CREATED

ATTRIBUTES_CHANGED

public static String ATTRIBUTES_CHANGED

EXPRESSION_DATA_LOADED

public static String EXPRESSION_DATA_LOADED

NETWORK_DESTROYED

public static String NETWORK_DESTROYED

CYTOSCAPE_EXIT

public static String CYTOSCAPE_EXIT

NETWORK_MODIFIED

public static final String NETWORK_MODIFIED
See Also:
Constant Field Values

NETWORK_SAVED

public static final String NETWORK_SAVED
See Also:
Constant Field Values

NETWORK_LOADED

public static final String NETWORK_LOADED
See Also:
Constant Field Values

PREFERENCE_MODIFIED

public static final String PREFERENCE_MODIFIED
See Also:
Constant Field Values

FILE_BY_SUFFIX

public static int FILE_BY_SUFFIX
When creating a network, use one of the standard suffixes to have it parsed correctly


FILE_GML

public static int FILE_GML

FILE_SIF

public static int FILE_SIF

FILE_SBML

public static int FILE_SBML

SELECT_NODES_ONLY

public static final int SELECT_NODES_ONLY
See Also:
Constant Field Values

SELECT_EDGES_ONLY

public static final int SELECT_EDGES_ONLY
See Also:
Constant Field Values

SELECT_NODES_AND_EDGES

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

Cytoscape

public Cytoscape()
Method Detail

exit

public static void exit()
Shuts down Cytoscape, after giving plugins time to react.


getSwingPropertyChangeSupport

public static SwingPropertyChangeSupport getSwingPropertyChangeSupport()
Bound events are:
  1. NETWORK_CREATED
  2. NETWORK_DESTROYED
  3. ATTRIBUTES_ADDED
  4. CYTOSCAPE_EXIT


getPropertyChangeSupport

public static PropertyChangeSupport getPropertyChangeSupport()

getRootGraph

public static cytoscape.giny.CytoscapeRootGraph getRootGraph()
Return the CytoscapeRootGraph


ensureCapacity

public static void ensureCapacity(int nodes,
                                  int edges)
Ensure the capacity of Cytoscapce. This is to prevent the inefficiency of adding nodes one at a time.


clearCytoscape

public static void clearCytoscape()
Deprecated. WARNING: this should only be used under special circumstances.


getCyNodesList

public static List getCyNodesList()
Returns:
all CyNodes that are present in Cytoscape

getCyEdgesList

public static List getCyEdgesList()
Returns:
all CyEdges that are present in Cytoscape

getCyNode

public static CyNode getCyNode(String alias)
Parameters:
alias - an alias of a node
Returns:
will return a node, if one exists for the given alias

getCyNode

public static CyNode getCyNode(String alias,
                               boolean create)
Parameters:
alias - an alias of a node
create - will create a node if one does not exist
Returns:
will always return a node, if create is true

getCyEdge

public static CyEdge getCyEdge(Node node_1,
                               Node node_2,
                               String attribute,
                               Object attribute_value,
                               boolean create)
Gets the first CyEdge found between the two nodes (direction does not matter) that has the given value for the given attribute.

Parameters:
node_1 - one end of the edge
node_2 - the other end of the edge
attribute - the attribute of the edge to be searched, a common one is Semantics.INTERACTION
attribute_value - a value for the attribute, like "pp"
create - will create an edge if one does not exist and if attribute is Semantics.INTERACTION
Returns:
returns an existing CyEdge if present, or creates one if create is true and attribute is Semantics.INTERACTION, otherwise returns null.

getCyEdge

public static CyEdge getCyEdge(String source_alias,
                               String edge_name,
                               String target_alias,
                               String interaction_type)
Parameters:
source_alias - an alias of a node
edge_name - the name of the node
target_alias - an alias of a node
Returns:
will always return an edge

getNodeAttributeValue

public static Object getNodeAttributeValue(Node node,
                                           String attribute)
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Returns the requested Attribute for the given Node

Parameters:
node - the given CyNode
attribute - the name of the requested attribute
Returns:
the value for the give node, for the given attribute.

getEdgeAttributeValue

public static Object getEdgeAttributeValue(Edge edge,
                                           String attribute)
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Returns the requested Attribute for the given Edge


getNodeAttributesList

public static String[] getNodeAttributesList()
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Return all availble Attributes for the Nodes in this CyNetwork.


getNodeAttributesList

public static String[] getNodeAttributesList(Node[] nodes)
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Return all available Attributes for the given Nodes.


getEdgeAttributesList

public static String[] getEdgeAttributesList()
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Return all availble Attributes for the Edges in this CyNetwork.


getNodeAttributesList

public static String[] getNodeAttributesList(Edge[] edges)
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Return all available Attributes for the given Edges


setNodeAttributeValue

public static boolean setNodeAttributeValue(Node node,
                                            String attribute,
                                            Object value)
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Return the requested Attribute for the given Node

Parameters:
node - the given CyNode
attribute - the name of the requested attribute
value - the value to be set
Returns:
if it overwrites a previous value

setEdgeAttributeValue

public static boolean setEdgeAttributeValue(Edge edge,
                                            String attribute,
                                            Object value)
Deprecated. Use CyAttributes directly. This method will be removed in September, 2006.

Return the requested Attribute for the given Edge


setSpecies

public static void setSpecies()
Deprecated. argh!...


getCurrentNetwork

public static CyNetwork getCurrentNetwork()
Return the Network that currently has the Focus. Can be different from getCurrentNetworkView


getNetworkSet

public static Set getNetworkSet()
Return a List of all available CyNetworks


getNetwork

public static CyNetwork getNetwork(String id)
Returns:
the CyNetwork that has the given identifier or null if there is no such network

getNetworkView

public static CyNetworkView getNetworkView(String network_id)
Returns:
a CyNetworkView for the given ID, if one exists, otherwise returns null

viewExists

public static boolean viewExists(String network_id)
Returns:
if a view exists for a given network id

getCurrentNetworkView

public static CyNetworkView getCurrentNetworkView()
Return the CyNetworkView that currently has the focus. Can be different from getCurrentNetwork


getDesktop

public static CytoscapeDesktop getDesktop()
Returns:
the reference to the One CytoscapeDesktop

setCurrentNetwork

public static void setCurrentNetwork(String id)
Deprecated.  


setCurrentNetworkView

public static boolean setCurrentNetworkView(String id)
Deprecated.  

Returns:
true if there is network view, false if not

getNetworkViewMap

public static Map getNetworkViewMap()
This Map has keys that are Strings ( network_ids ) and values that are networkviews.


destroyNetwork

public static void destroyNetwork(String network_id)
destroys the given network


destroyNetwork

public static void destroyNetwork(CyNetwork network)
destroys the given network


destroyNetwork

public static void destroyNetwork(CyNetwork network,
                                  boolean destroy_unique)
destroys the given network

Parameters:
network - the network tobe destroyed
destroy_unique - if this is true, then all Nodes and Edges that are in this network, but no other are also destroyed.

destroyNetworkView

public static void destroyNetworkView(CyNetworkView view)
destroys the networkview, including any layout information


destroyNetworkView

public static void destroyNetworkView(String network_view_id)
destroys the networkview, including any layout information


destroyNetworkView

public static void destroyNetworkView(CyNetwork network)
destroys the networkview, including any layout information


createNetwork

public static CyNetwork createNetwork(String title)
Creates a new, empty Network.

Parameters:
title - the title of the new network.

createNetwork

public static CyNetwork createNetwork(String title,
                                      boolean create_view)
Creates a new, empty Network.

Parameters:
title - the title of the new network.
create_view - if the size of the network is under the node limit, create a view

createNetwork

public static CyNetwork createNetwork(int[] nodes,
                                      int[] edges,
                                      String title)
Creates a new Network

Parameters:
nodes - the indeces of nodes
edges - the indeces of edges
title - the title of the new network.

createNetwork

public static CyNetwork createNetwork(Collection nodes,
                                      Collection edges,
                                      String title)
Creates a new Network

Parameters:
nodes - a collection of nodes
edges - a collection of edges
title - the title of the new network.

createNetwork

public static CyNetwork createNetwork(int[] nodes,
                                      int[] edges,
                                      String child_title,
                                      CyNetwork parent)
Creates a new Network, that inherits from the given ParentNetwork

Parameters:
nodes - the indeces of nodes
edges - the indeces of edges
child_title - the title of the new network.

createNetwork

public static CyNetwork createNetwork(Collection nodes,
                                      Collection edges,
                                      String child_title,
                                      CyNetwork parent)
Creates a new Network, that inherits from the given ParentNetwork

Parameters:
nodes - the indeces of nodes
edges - the indeces of edges

createNetworkFromFile

public static CyNetwork createNetworkFromFile(String location)
Creates a cytoscape.data.CyNetwork from a file. The file type is determined by the suffice of the file

Parameters:
location - the location of the file

createNetwork

public static CyNetwork createNetwork(String location,
                                      int file_type,
                                      boolean canonicalize,
                                      BioDataServer biodataserver,
                                      String species)
Creates a cytoscape.data.CyNetwork from a file. The passed variable determines the type of file, i.e. GML, SIF, SBML, etc.

This operation may take a long time to complete. It is a good idea NOT to call this method from the AWT event handling thread.

Parameters:
location - the location of the file
file_type - the type of file GML, SIF, SBML, etc.
canonicalize - this will set the preferred display name to what is on the server.
biodataserver - provides the name conversion service
species - the species used by the BioDataServer

getCytoscapeObj

public static CytoscapeObj getCytoscapeObj()
Deprecated.  


getNodeNetworkData

public static cytoscape.data.GraphObjAttributes getNodeNetworkData()
Deprecated. Use getNodeAttributes() instead. This method will be removed in September, 2006.

Gets Node Network Data: GraphObjAttributes.

Returns:
GraphObjAttributes Object.

getEdgeNetworkData

public static cytoscape.data.GraphObjAttributes getEdgeNetworkData()
Deprecated. Use getEdgeAttributes() instead. This method will be removed in September, 2006.

Gets Edge Network Data: GraphObjAttributes.

Returns:
GraphObjAttributes Object.

getNodeAttributes

public static CyAttributes getNodeAttributes()
Gets Global Node Attributes.

Returns:
CyAttributes Object.

getEdgeAttributes

public static CyAttributes getEdgeAttributes()
Gets Global Edge Attributes

Returns:
CyAttributes Object.

getExpressionData

public static ExpressionData getExpressionData()

setExpressionData

public static void setExpressionData(ExpressionData expData)

loadExpressionData

public static boolean loadExpressionData(String filename,
                                         boolean copy_atts)
Load Expression Data


loadAttributes

public static void loadAttributes(String[] nodeAttrLocations,
                                  String[] edgeAttrLocations,
                                  boolean canonicalize,
                                  BioDataServer bioDataServer,
                                  String species)
Loads Node and Edge attribute data into Cytoscape from the given file locations. Currently, the only supported attribute types are of the type "name = value".

Parameters:
nodeAttrLocations - an array of node attribute file locations. May be null.
edgeAttrLocations - an array of edge attribute file locations. May be null.
canonicalize - convert to the preffered name on the biodataserver
bioDataServer - provides the name conversion service
species - the species to use with the bioDataServer's

loadAttributes

public static void loadAttributes(String[] nodeAttrLocations,
                                  String[] edgeAttrLocations)
Loads Node and Edge attribute data into Cytoscape from the given file locations. Currently, the only supported attribute types are of the type "name = value".

Parameters:
nodeAttrLocations - an array of node attribute file locations. May be null.
edgeAttrLocations - an array of edge attribute file locations. May be null.

createNetworkFromProject

public static CyNetwork createNetworkFromProject(CyProject project,
                                                 BioDataServer bioDataServer)
Constructs a network using information from a CyProject argument that contains information on the location of the graph file, any node/edge attribute files, and a possible expression data file. If the data server argument is non-null and the project requests canonicalization, the data server will be used for name resolution given the names in the graph/attributes files.

See Also:
CyProject

loadBioDataServer

public static BioDataServer loadBioDataServer(String location)
A BioDataServer should be loadable from a file systems file or from a URL.


getBioDataServer

public static BioDataServer getBioDataServer()
Returns:
the BioDataServer that was loaded, should not be null, but not contain any data.

createNetworkView

public static CyNetworkView createNetworkView(CyNetwork network)
Creates a CyNetworkView, but doesn't do anything with it. Ifnn's you want to use it

Parameters:
network - the network to create a view of

createNetworkView

public static CyNetworkView createNetworkView(CyNetwork network,
                                              String title)
Creates a CyNetworkView, but doesn't do anything with it. Ifnn's you want to use it

Parameters:
network - the network to create a view of

firePropertyChange

public static void firePropertyChange(String property_type,
                                      Object old_value,
                                      Object new_value)

enableSquiggle

public static void enableSquiggle()
Utility method to enable Squiggle function.


disableSquiggle

public static void disableSquiggle()
Utility method to disable Squiggle function.


isSquiggleEnabled

public static boolean isSquiggleEnabled()
Returns the value of the global flag to indicate whether the Squiggle function is enabled.


getSelectionMode

public static int getSelectionMode()
Gets the selection mode value.


setSelectionMode

public static void setSelectionMode(int selectionMode)
Sets the specified selection mode on all views.

Parameters:
selectionMode - SELECT_NODES_ONLY, SELECT_EDGES_ONLY, or SELECT_NODES_AND_EDGES.

setSelectionMode

public static void setSelectionMode(int selectionMode,
                                    GraphView view)
Utility method to set the selection mode on the specified GraphView.

Parameters:
selectionMode - SELECT_NODES_ONLY, SELECT_EDGES_ONLY, or SELECT_NODES_AND_EDGES.
view - the GraphView to set the selection mode on.

www.cytoscape.org