Archive Ensembl HomeArchive Ensembl Home
Bio::EnsEMBL::Compara::Graph::Node Class Reference
Inheritance diagram for Bio::EnsEMBL::Compara::Graph::Node:

List of all members.


Class Summary

Description

 

Synopsis

Description

Object oriented graph system which is based on Node and Link objects.  There is
no 'graph' object, the graph is constructed out of Nodes and Links, and the
graph is 'walked' from Node to Link to Node.  Can be used to represent any graph
structure from  DAGs (directed acyclic graph) to Trees to undirected cyclic Graphs.
The system is fully connected so from any object in the graph one can 'walk' to
any other.  Links contain pointers to the nodes on either side (called neighbors),
and each Node contains a list of the links it is connected to.  
Nodes also keep hashes of their neighbors for fast 'set theory' operations.  
This graph system is used as the foundation for the Nested-set 
(Compara::NestedSet) system for storing trees in the compara database.
System has a simple API based on creating Nodes and then linking them together:
  my $node1 = new Bio::EnsEMBL::Compara::Graph::Node;
  my $node2 = new Bio::EnsEMBL::Compara::Graph::Node;
  new Bio::EnsEMBL::Compara::Graph::Link($node1, $node2, $distance_between);
And to 'disconnect' nodes, one just breaks a link;
  my $link = $node1->link_for_neighbor($node2);
  $link->dealloc;
Convenience methods to simplify this process
  $node1->create_link_to_node($node2, $distance_between);
  $node2->unlink_neighbor($node1);
 

Definition at line 42 of file Node.pm.

Available Methods

protected _add_neighbor_link_to_hash ()
protected void _load_tags ()
protected _unlink_node_in_hash ()
protected _walk_graph_until ()
public Subclass adaptor ()
public Boolean add_tag ()
public all_links_in_graph ()
public all_nodes_in_graph ()
public alloc ()
public void AUTOLOAD ()
public cascade_unlink ()
public copy ()
public copy_graph ()
public copy_shallow_links ()
public create_directed_link_to_node ()
public Compara::Graph::Link create_link_to_node ()
public dealloc ()
public delete_tag ()
public DESTROY ()
public equals ()
public find_node_by_name ()
public find_node_by_node_id ()
public Array get_all_tags ()
public ArrayRef get_all_values_for_tag ()
public Scalar get_tagvalue ()
public Hashref get_tagvalue_hash ()
public Scalar get_value_for_tag ()
public has_neighbor ()
public Boolean has_tag ()
public init ()
public is_leaf ()
public like ()
public link_count ()
public link_for_neighbor ()
public Array links ()
public minimize_node ()
public name ()
public neighbors ()
public new ()
public Int node_id ()
public obj_id ()
public print_links ()
public print_node ()
public refcount ()
public release ()
public retain ()
public store ()
public store_tag ()
public unlink_all ()
public Undef unlink_neighbor ()

Method Documentation

protected Bio::EnsEMBL::Compara::Graph::Node::_add_neighbor_link_to_hash ( )

Undocumented method

protected void Bio::EnsEMBL::Compara::Taggable::_load_tags ( ) [inherited]
  Description: loads all the tags (from the database) if possible.
               Otherwise, an empty hash is created
  Example    : $ns_node->_load_tags();
  Returntype : none
  Exceptions : none
  Caller     : internal
 
Code:
click to view
protected Bio::EnsEMBL::Compara::Graph::Node::_unlink_node_in_hash ( )

Undocumented method

protected Bio::EnsEMBL::Compara::Graph::Node::_walk_graph_until ( )

Undocumented method

Code:
click to view
public Subclass Bio::EnsEMBL::Compara::Graph::CGObject::adaptor ( ) [inherited]
  Arg [1]    : (opt.) subcalss of Bio::EnsEMBL::DBSQL::BaseAdaptor
  Example    : my $object_adaptor = $object->adaptor();
  Example    : $object->adaptor($object_adaptor);
  Description: Getter/Setter for the adaptor this object uses for database
               interaction.
  Returntype : subclass of Bio::EnsEMBL::DBSQL::BaseAdaptor
  Exceptions : none
  Caller     : general
 
Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::SpeciesSet.

public Boolean Bio::EnsEMBL::Compara::Taggable::add_tag ( ) [inherited]
  Description: adds metadata tags to a node.  Both tag and value are added
               as metdata with the added ability to retreive the value given
               the tag (like a perl hash). In case of one to many relation i.e.
               one tag and different values associated with it, the values are
               returned in a array reference.
  Arg [1]    : <string> tag
  Arg [2]    : <string> value
  Arg [3]    : (optional) <int> allows overloading the tag with different values
               default is 0 (no overloading allowed, one tag points to one value)
  Example    : $ns_node->add_tag('scientific name', 'Mammalia');
               $ns_node->add_tag('lost_taxon_id', 9593, 1);
  Returntype : Boolean indicating if the tag could be added
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::all_links_in_graph ( )

Undocumented method

public Bio::EnsEMBL::Compara::Graph::Node::all_nodes_in_graph ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::alloc ( ) [inherited]

Undocumented method

Code:
click to view
public void Bio::EnsEMBL::Compara::Taggable::AUTOLOAD ( ) [inherited]
  Description: matches the get_value_for_XXX calls to get_value_for_tag('XXX') and other calls
  Returntype : none
  Exceptions : none
  Caller     : system
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::cascade_unlink ( )
  Overview   : release all neighbors and clear arrays and hashes
               will cause potential deletion of neighbors if refcount reaches Zero.
  Example    : $self->cascade_unlink
  Returntype : $self
  Exceptions : none
  Caller     : general
 
public Bio::EnsEMBL::Compara::Graph::Node::copy ( )

Undocumented method

Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::CGObject.

Reimplemented in Bio::EnsEMBL::Compara::GeneTreeMember, Bio::EnsEMBL::Compara::GenomicAlignTree, Bio::EnsEMBL::Compara::NCBITaxon, and Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Graph::Node::copy_graph ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::copy_shallow_links ( )

Undocumented method

public Bio::EnsEMBL::Compara::Graph::Node::create_directed_link_to_node ( )

Undocumented method

public Compara::Graph::Link Bio::EnsEMBL::Compara::Graph::Node::create_link_to_node ( )
  Overview   : attaches neighbor Graph::Node to this nested set
  Arg [1]    : Bio::EnsEMBL::Compara::Graph::Node $node
  Arg [2]    : (opt.) <float> distance to node
  Example    : $self->add_child($node);
  Returntype : Compara::Graph::Link object
  Exceptions : if neighbor is undef or not a NestedSet subclass
  Caller     : general
 
public Bio::EnsEMBL::Compara::Graph::Node::dealloc ( )

Undocumented method

Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::CGObject.

Reimplemented in Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Taggable::delete_tag ( ) [inherited]
  Description: removes a tag from the metadata. If the value is provided, it tries
               to delete only it (if present). Otherwise, it just clears the tag,
               whatever value it was containing
  Arg [1]    : <string> tag
  Arg [2]    : (optional) <string> value
  Example    : $ns_node->remove_tag('scientific name', 'Mammalia');
               $ns_node->remove_tag('lost_taxon_id', 9593);
  Returntype : 0 if the tag couldn't be removed,
               1 if it is only in the PERL object,
               2 if it is also stored in the database
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::DESTROY ( ) [inherited]

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::equals ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::find_node_by_name ( )

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Graph::Node::find_node_by_node_id ( )

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::NestedSet.

public Array Bio::EnsEMBL::Compara::Taggable::get_all_tags ( ) [inherited]
  Description: returns an array of all the available tags
  Example    : $ns_node->get_all_tags();
  Returntype : Array
  Exceptions : none
  Caller     : general
 
Code:
click to view
public ArrayRef Bio::EnsEMBL::Compara::Taggable::get_all_values_for_tag ( ) [inherited]
  Description: returns all the values of the tag, or $default (undef
               if not provided) if the tag doesn't exist. In case of
               a single value, it is wrapped with an array
  Arg [1]    : <string> tag
  Arg [2]    : (optional) <scalar> default
  Example    : $ns_node->get_tagvalue('scientific name');
  Returntype : ArrayRef
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Scalar Bio::EnsEMBL::Compara::Taggable::get_tagvalue ( ) [inherited]
  Description: returns the value(s) of the tag, or $default (undef
               if not provided) if the tag doesn't exist.
  Arg [1]    : <string> tag
  Arg [2]    : (optional) <scalar> default
  Example    : $ns_node->get_tagvalue('scientific name');
  Returntype : Scalar or ArrayRef
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Hashref Bio::EnsEMBL::Compara::Taggable::get_tagvalue_hash ( ) [inherited]
  Description: returns the underlying hash that contains all
               the tags
  Example    : $ns_node->get_tagvalue_hash();
  Returntype : Hashref
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Scalar Bio::EnsEMBL::Compara::Taggable::get_value_for_tag ( ) [inherited]
  Description: returns the value of the tag, or $default (undef
               if not provided) if the tag doesn't exist. In case
               of multiple values, the first one is returned.
  Arg [1]    : <string> tag
  Arg [2]    : (optional) <scalar> default
  Example    : $ns_node->get_tagvalue('scientific name');
  Returntype : Scalar
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::has_neighbor ( )

Undocumented method

Code:
click to view
public Boolean Bio::EnsEMBL::Compara::Taggable::has_tag ( ) [inherited]
  Description: indicates whether the tag exists in the metadata
  Arg [1]    : <string> tag
  Example    : $ns_node->has_tag('scientific name');
  Returntype : Boolean
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::init ( )

Undocumented method

Code:
click to view

Reimplemented from Bio::EnsEMBL::Compara::Graph::CGObject.

Reimplemented in Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Graph::Node::is_leaf ( )

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Graph::Node::like ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::link_count ( )

Undocumented method

public Bio::EnsEMBL::Compara::Graph::Node::link_for_neighbor ( )

Undocumented method

public Array Bio::EnsEMBL::Compara::Graph::Node::links ( )
  Overview   : returns a list of Compara::Graph::Link connected to this node
  Example    : my @links = @{self->links()};
  Returntype : array reference of Bio::EnsEMBL::Compara::Graph::Link objects (could be empty)
  Exceptions : none
  Caller     : general
 
public Bio::EnsEMBL::Compara::Graph::Node::minimize_node ( )

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Graph::CGObject::name ( ) [inherited]

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::GeneTreeMember, and Bio::EnsEMBL::Compara::GenomicAlignTree.

public Bio::EnsEMBL::Compara::Graph::Node::neighbors ( )

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::new ( ) [inherited]

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::Graph::Link, and Bio::EnsEMBL::Compara::SpeciesSet.

public Int Bio::EnsEMBL::Compara::Graph::Node::node_id ( )
  Arg [1]    : (opt.) integer node_id
  Example    : my $nsetID = $object->node_id();
  Example    : $object->node_id(12);
  Description: Getter/Setter for the node_id of this object in the database
  Returntype : integer node_id
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::obj_id ( ) [inherited]
  Example    : my $nsetID = $object->obj_id();
  Description: returns the unique identifier of this object.  
  Returntype : <string> uuid
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::print_links ( )

Undocumented method

public Bio::EnsEMBL::Compara::Graph::Node::print_node ( )

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::GeneTreeMember, Bio::EnsEMBL::Compara::NCBITaxon, and Bio::EnsEMBL::Compara::NestedSet.

public Bio::EnsEMBL::Compara::Graph::CGObject::refcount ( ) [inherited]

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::release ( ) [inherited]

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::retain ( ) [inherited]

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Graph::CGObject::store ( ) [inherited]

Undocumented method

Code:
click to view
public Bio::EnsEMBL::Compara::Taggable::store_tag ( ) [inherited]
  Description: calls add_tag and then stores the tag in the database. Has the
               exact same arguments as add_tag
  Arg [1]    : <string> tag
  Arg [2]    : <string> value
  Arg [3]    : (optional) <int> allows overloading the tag with different values
               default is 0 (no overloading allowed, one tag points to one value)
  Example    : $ns_node->store_tag('scientific name', 'Mammalia');
               $ns_node->store_tag('lost_taxon_id', 9593, 1);
  Returntype : 0 if the tag couldn't be stored,
               1 if it is only in the PERL object,
               2 if it is also stored in the database
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Node::unlink_all ( )

Undocumented method

public Undef Bio::EnsEMBL::Compara::Graph::Node::unlink_neighbor ( )
  Overview   : unlink and release neighbor from self if its mine
               might cause neighbor to delete if refcount reaches Zero.
  Arg [1]    : $node Bio::EnsEMBL::Compara::Graph::Node instance
  Example    : $self->unlink_neighbor($node);
  Returntype : undef
  Caller     : general
 

The documentation for this class was generated from the following file:
  • Bio/EnsEMBL/Compara/Graph/Node.pm