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

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 41 of file Link.pm.

Available Methods

protected void _load_tags ()
public Subclass adaptor ()
public Boolean add_tag ()
public alloc ()
public void AUTOLOAD ()
public copy ()
public dealloc ()
public delete_tag ()
public DESTROY ()
public distance_between ()
public equals ()
public Array get_all_tags ()
public ArrayRef get_all_values_for_tag ()
public
Bio::EnsEMBL::Compara::Graph::Node 
get_neighbor ()
public Undef get_nodes ()
public Scalar get_tagvalue ()
public Hashref get_tagvalue_hash ()
public Scalar get_value_for_tag ()
public Boolean has_tag ()
public init ()
public name ()
public
Bio::EnsEMBL::Compara::Graph::Link 
new ()
public obj_id ()
public print_link ()
public refcount ()
public release ()
public retain ()
public store ()
public store_tag ()

Method Documentation

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
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::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::Link::copy ( )

Undocumented method

Code:
click to view

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

public Bio::EnsEMBL::Compara::Graph::Link::dealloc ( )

Undocumented method

Code:
click to view

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

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::Link::distance_between ( )
  Arg [1]    : (opt.) <int or double> distance
  Example    : my $dist = $link->distance_between();
  Example    : $link->distance_between(1.618);
  Description: Getter/Setter for the distance between the nodes
  Returntype : <int or double> distance
  Exceptions : none
  Caller     : general
 
Code:
click to view
public Bio::EnsEMBL::Compara::Graph::Link::equals ( )

Undocumented method

Code:
click to view
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 Bio::EnsEMBL::Compara::Graph::Node Bio::EnsEMBL::Compara::Graph::Link::get_neighbor ( )
  Example    : $node2 = $link->get_neighbor($node1);
  Description: returns the other node in a link given a node.  return undef if $node1 
               is not part of the link.
  Returntype : Bio::EnsEMBL::Compara::Graph::Node or undef
  Exceptions : none
 
Code:
click to view
public Undef Bio::EnsEMBL::Compara::Graph::Link::get_nodes ( )
  Example    : ($node1, $node2) = $link->get_nodes;
  Description: returns the nodes as an unordered list
  Returntype : undef
  Exceptions : none
 
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 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::CGObject::init ( ) [inherited]

Undocumented method

Code:
click to view

Reimplemented in Bio::EnsEMBL::Compara::Graph::Node, Bio::EnsEMBL::Compara::NestedSet, Bio::EnsEMBL::Compara::Production::GeneSet, and Bio::EnsEMBL::Compara::Production::HomologySet.

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::Link Bio::EnsEMBL::Compara::Graph::Link::new ( )
  Arg [1]    : <Bio::EnsEMBL::Compara::Graph::Node> node1
  Arg [2]    : <Bio::EnsEMBL::Compara::Graph::Node> node2
  Arg [3]    : (opt.) <float> length of link
  Example    : $link = new Bio::EnsEMBL::Compara::Graph::Link($node1, $node2);
  Description: creates new link between nodes
  Returntype : Bio::EnsEMBL::Compara::Graph::Link
  Exceptions : none
 
Code:
click to view

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

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::Link::print_link ( )

Undocumented method

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

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