Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.data
Class Semantics

java.lang.Object
  extended by cytoscape.data.Semantics

public class Semantics
extends Object

This class defines names for certain data attributes that are commonly used within Cytoscape. The constants defined here are provided to enable different modules to use the same name when referring to the same conceptual attribute. This class also defines some static methods for assigning these attributes to a network, given the objects that serve as the source for this information.


Field Summary
static String BIOLOGICAL_PROCESS
           
static String CANONICAL_NAME
          The name "CANONICAL_NAME" is an historical artifact.
static String CELLULAR_COMPONENT
           
static String DNA
           
static String GO_ALIASES
           
static String GO_COMMON_NAME
           
static String INTERACTION
           
static String MOLECULAR_FUNCTION
           
static String MOLECULE_TYPE
           
static String PROTEIN
           
static String RNA
           
static String SPECIES
           
 
Constructor Summary
Semantics()
           
 
Method Summary
static void applyNamingServices(CyNetwork network)
          This method should be called in the process of creating a new network, or upon loading a new bioDataServer.
static boolean areSynonyms(String firstName, String secondName, CyNetwork network)
          This method is used to determine if two, potentially different names really refer to the same thing; that is, the two names are synonyms.
static void assignCommonNames(CyNetwork network, BioDataServer bioDataServer)
          This method takes every canonical name defines in the node attributes of the given network, and attempts to assign a common name by getting a list of synonyms for the canonical name from the bioDataServer and using the first synonym as the common name.
static void assignNodeAliases(CyNode node, String species, BioDataServer bds)
          Use the given BioDataServer to set all of the aliases for a node, given its species.
static void assignSpecies(CyNetwork network)
          This method attempts to set a species attribute for every canonical name defined in the node attributes member of the supplied network.
static List getAllSynonyms(String name, CyNetwork network)
          This method returns a list of all names that are synonyms of the given name.
static String getInteractionType(CyNetwork network, Edge edge)
          Returns the interaction type of the given edge.
static String[] getInteractionTypes(CyNetwork network)
          Returns an array containing all of the unique interaction types present in the network.
static Set getSpeciesInNetwork(CyNetwork network)
          Returns every unique species defined in the supplied network.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANONICAL_NAME

public static final String CANONICAL_NAME
The name "CANONICAL_NAME" is an historical artifact. The ONLY purpose for this variable is to provide the name for an automatically created node attribute that is guaranteed to be created when the node is created. Any other purpose or function this value has supported in the past is officially no longer supported!

See Also:
Constant Field Values

GO_COMMON_NAME

public static final String GO_COMMON_NAME
See Also:
Constant Field Values

GO_ALIASES

public static final String GO_ALIASES
See Also:
Constant Field Values

SPECIES

public static final String SPECIES
See Also:
Constant Field Values

INTERACTION

public static final String INTERACTION
See Also:
Constant Field Values

MOLECULE_TYPE

public static final String MOLECULE_TYPE
See Also:
Constant Field Values

PROTEIN

public static final String PROTEIN
See Also:
Constant Field Values

DNA

public static final String DNA
See Also:
Constant Field Values

RNA

public static final String RNA
See Also:
Constant Field Values

MOLECULAR_FUNCTION

public static final String MOLECULAR_FUNCTION
See Also:
Constant Field Values

BIOLOGICAL_PROCESS

public static final String BIOLOGICAL_PROCESS
See Also:
Constant Field Values

CELLULAR_COMPONENT

public static final String CELLULAR_COMPONENT
See Also:
Constant Field Values
Constructor Detail

Semantics

public Semantics()
Method Detail

applyNamingServices

public static void applyNamingServices(CyNetwork network)
This method should be called in the process of creating a new network, or upon loading a new bioDataServer. This method will use the bioDataServer to assign common names to the network using the synonym utilities of the bioDataServer. In the process, it will assign a species attribute for any name that does not currently have one. Currently, this method calls assignSpecies and assignCommonNames. At some point it may be desirable to check the configuration to see what to do, or put up a UI to prompt the user for what services they would like. KONO: 04/19/2006 Since attribute cannonical name no longer exists, these names should be created node identifiers.


assignSpecies

public static void assignSpecies(CyNetwork network)
This method attempts to set a species attribute for every canonical name defined in the node attributes member of the supplied network. The value returned by getDefaultSpecies is used; if this return value is null, then this method exits without doing anything, as there is no species to set. If a canonical name already has an entry for the SPECIES attribute, then this method does not change that value. Otherwise, this method sets the value of that attribute to that returned by getDefaultSpecies. This method does nothing at all if either argument is null.


getSpeciesInNetwork

public static Set getSpeciesInNetwork(CyNetwork network)
Returns every unique species defined in the supplied network. Searches the species attribute in the node attributes of the supplied network and returns a Set containing every unique value found.


assignNodeAliases

public static void assignNodeAliases(CyNode node,
                                     String species,
                                     BioDataServer bds)
Use the given BioDataServer to set all of the aliases for a node, given its species.

Note: This is only for GO data!

Parameters:
node - the Node that will be assigned names
species - the species of the Node ( NOTE: if null, there will be a check to see if the node has a species set for attribute Semantics.SPECIES, if not, then the general Cytoscape defaultSpecies ( settable with -s ) will be used. )
bds - the given BioDataServer ( NOTE: if null, then the general Cytoscape BioDataServer will be used ( settable with -b ) ).

assignCommonNames

public static void assignCommonNames(CyNetwork network,
                                     BioDataServer bioDataServer)
This method takes every canonical name defines in the node attributes of the given network, and attempts to assign a common name by getting a list of synonyms for the canonical name from the bioDataServer and using the first synonym as the common name. This operation requires the SPECIES attribute to be defined for the canonical name, as input to the bioDataServer. Any canonicalName that does not have this attribute defined is skipped. This method does nothing if either argument is null. Also, for any canonical name, this method does nothing if no synonyms for that name can be provided by the bioDataServer.


getInteractionTypes

public static String[] getInteractionTypes(CyNetwork network)
Returns an array containing all of the unique interaction types present in the network. Formally, gets from the edge attributes all of the unique values for the "interaction" attribute. If the argument is null, returns an array of length 0.


getInteractionType

public static String getInteractionType(CyNetwork network,
                                        Edge edge)
Returns the interaction type of the given edge. Formally, gets from the edge attributes the value for the "interaction" attribute". If either argument is null, returns null.


areSynonyms

public static boolean areSynonyms(String firstName,
                                  String secondName,
                                  CyNetwork network)
This method is used to determine if two, potentially different names really refer to the same thing; that is, the two names are synonyms. The rules applied are as follows: 1) If either name is null, this method returns true if both are null, false otherwise. 2) If the names themselves match, this method returns true 3) The getAllSynonyms method is called for both names, to get all known synonyms. each possible pair of synonyms is compared, and this method returns true if any match is found, false otherwise. In all cases, comparisons are done with name1.equalsIgnoreCase(name2). The network and cytoscapeObj arguments may be null, which simply limits the tests that can be done to find synonyms.


getAllSynonyms

public static List getAllSynonyms(String name,
                                  CyNetwork network)
This method returns a list of all names that are synonyms of the given name. The returned list will include the name argument itself, and thus will always be non-null and contain at least one member (unless the argument itself is null, in which case a list of size 0 is returned). The search for other names follows the following steps: First, if the network argument is non-null and the node attributes include the name argument as a canonical name, then add any entry for the COMMON_NAME attribute associated with the canonical name. Next, if a BioDataServer is available, try to get a species for the given name either from the SPECIES attribute associated with the canonicalName, or using the return value of getDefaultSpecies if needed. If a species can be determined, then use the BioDataServer to add all the synonyms that are registered for the name argument.


www.cytoscape.org