GO::Node.3pm

Langue: en

Autres versions - même langue

Version: 2007-11-15 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

GO::Node - provides information about a node in the Gene Ontology

DESCRIPTION

The GO::Node package is intended to be used as a container for information about a node in one of the three Gene Ontologies. It allows the storage of the goid, and immediate parents and children, as well as paths to the top of the ontology. This package provides methods to both store and retrieve that information.

It should be strongly noted that clients are not expected to create individual Node objects themselves, but instead should rely in a Node Factory to create nodes and return them. Such a factory would be a concrete subclass of the abstract GO::OntologyProvider package.

TODO

The following items needs to be done at some point to make the Node class more flexible, and for it to better model the data.
     Add in methods to deal with secondary GOIDs
 
     Add in methods to allow definitions to be associated with, and
     retrieved from Nodes.
 
     Add in methods to allow dbxrefs to be included.
 
     Not require Factories to add the paths to the root, but instead
     have this class generate those paths from the inherent structure
     of the graph in which the Nodes sit.  This will also be useful to
     generate paths to leaves/descendants.
 
 

Protected Methods

_handleMissingArgument

This protected method simply provides a simple way for concrete subclasses to deal with missing arguments from method calls. It will die with an appropriate error message.

Usage:

     $self->_handleMissingArgument(argument=>'blah');
 
 

Instance Constructor

new

This is the constructor for the Node object At a minimum, the constructor expects, as named arguments, a GOID and a GO term, with which to create the node object.

Usage:

     my $node = GO::Node->new(goid => $goid,
                              term => $term);
 
 

Instance Methods

addChildNodes

The public setter method allows a client to indicate that an array of nodes are children of the 'self' node. Only one node per child goid will get stored.

Usage:

     $node->addChildNodes(@childNodes);
 
 

addParentNodes

The public setter method allows a client to indicate that an array of nodes are parents of the 'self' node. Only one node per parent goid will get stored.

Usage:

     $node->addParentNodes(@parentNodes);
 
 

addPathToRoot

This public setter method expects an array of nodes, that indicates a direct path to the root of the ontology. The array should not contain the self node, but should contain the root node. The last entry in the array is expected to be an immediate parent of the self node, while the first entry is expected to be the root node itself. This method will NOT check to see if the supplied path has not already been added. It is the Node Factory's responsibility to only add a unique path once. Furthermore, it will not check whether there is consistency between addedPaths and addedParents (this can be done using the isValid method though).

Usage:

     $node->addPathToRoot(@nodes);
 
 

goid

This public method returns the goid associated with the node.

Usage:

     my $goid = $node->goid;
 
 

term

This public method returns the term associated with the node.

Usage:

     my $goid = $node->term;
 
 

childNodes

This public method returns an array of child nodes for the self node.

Usage:

     my @childNodes = $node->childNodes;
 
 

parentNodes

This public method returns an array of parent nodes for the self node.

Usage:

     my @parentNodes = $node->parentNodes;
 
 

pathsToRoot

This public method returns an array of references to arrays, each of which contains the nodes in a path between the self node and the root. The self node is not included in the paths, but the root node is. The first node in each array is the most distant ancestor (the root), the last node is an immediate parent. If there are no paths to the root (i.e. it is the root node) then an empty array will be returned.

Usage:

     my @pathsToRoot = $node->pathsToRoot;
 
 

pathsToAncestor

This public method returns an array of references to arrays, each of which contains the nodes in a path between the self node and the specified ancestor. The self node is not included paths, but the specified ancestor node is. The first node in each array is the specified ancestor, the last node is an immediate parent. If there are no paths to the ancestor then an empty array will be returned.

Usage:

     my @pathsToAncestor = $node->pathsToAncestor($ancestorNode);
 
 

ancestors

This public method returns an array of unique GO::Nodes which are the unique ancestors that a node has. These ancestors will be derived from the paths to the root node that have been added to the node.

Usage:

     my @ancestors = $node->ancestors;
 
 

lengthOfLongestPathToRoot

This public method returns the length of the longest path to the root of the ontology from the node. If the node is in fact the root, then a value of zero will be returned.

Usage:

     my $length = $node->lengthOfLongestPathToRoot;
 
 

lengthOfShortestPathToRoot

This public method returns the length of the shortest path to the root of the ontology from the node. If the node is in fact the root, then a value of zero will be returned.

Usage:

     my $length = $node->lengthOfShortestPathToRoot;
 
 

meanLengthOfPathsToRoot

This public method returns the mean length of all paths to the root node. If the node is in fact the root, then a value of zero will be returned.

Usage:

     my $length = $node->meanLengthOfPathsToRoot;
 
 

isValid

This method can be used to check that a node has been constructed correctly. It checks that it is a child of all its parents, and a parent of all of its children. In addition, it checks that parents exist as the most recent ancestors of the node in its paths to the root node, and vice versa. It returns a boolean.

Usage:

     if ($node->isValid){
 
         # do something
 
     }
 
 

isAParentOf

This public method returns a boolean to indicate whether a node has the supplied node as a child.

Usage :

     if ($node->isAParentOf($anotherNode)){
     
         # blah
 
     }
 
 

isAChildOf

This public method returns a boolean to indicate whether a node has the supplied node as a parent.

Usage :

     if ($node->isAChildOf($anotherNode)){
     
         # blah
 
     }
 
 

isAnAncestorOf

This method returns a boolean to indicate whether a node is an ancestor of another.

Usage:

     if ($node->isAnAncestorOf($anotherNode)){
 
         # blah
 
     }
 
 

isADescendantOf

This method returns a boolean to indicate whether a node is a descendant of another.

Usage:

     if ($node->isADescendantOf($anotherNode)){
 
         # blah
 
     }
 
 

isLeaf

This method returns a boolean to indicate whether a node is a leaf in the ontology (i.e. it has no children).

Usage:

     if ($node->isLeaf){
     
         # blah  
 
     }
 
 

isRoot

This method returns a boolean to indicate whether a node is the root in the ontology (i.e. it has no parents).

Usage:

     if ($node->isRoot){
 
         # blah  
 
     }
 
 

Authors

     Gavin Sherlock; sherlock@genome.stanford.edu