
Bio::Phylo::Adaptor::Bioperl::Tree - Adaptor class for bioperl compatibility

use Bio::Phylo::Adaptor;
# some way to get a tree
use Bio::Phylo::IO;
my $string = '((A,B),C);';
my $forest = Bio::Phylo::IO->parse(
-format => 'newick',
-string => $string
);
my $tree = $forest->first;
$Bio::Phylo::COMPAT = 'Bioperl';
my $bptree = Bio::Phylo::Adaptor->new( $tree );
print "compatible!" if $bptree->isa('Bio::Tree::TreeI');

This class wraps Bio::Phylo::Forest::Tree objects to give them an interface compatible with bioperl.

Return list of Tree::NodeI objects.
Title : get_nodes
Usage : my @nodes = $tree->get_nodes()
Function: Return list of Tree::NodeI objects
Returns : array of Tree::NodeI objects
Args : (named values) hash with one value
order => 'b|breadth' first order or 'd|depth' first order
Get the Top Node in the tree.
Title : get_root_node
Usage : my $node = $tree->get_root_node();
Function: Get the Top Node in the tree, in this implementation
Trees only have one top node.
Returns : Bio::Tree::NodeI object
Args : none
Returns the number of nodes.
Title : number_nodes Usage : my $size = $tree->number_nodes Function: Returns the number of nodes Example : Returns : Args :
Returns the sum of the length of all branches.
Title : total_branch_length Usage : my $size = $tree->total_branch_length Function: Returns the sum of the length of all branches Returns : integer Args : none
Gets the height of tree.
Title : height
Usage : my $height = $tree->height
Function: Gets the height of tree - this LOG_2($number_nodes)
WARNING: this is only true for strict binary trees. The TreeIO
system is capable of building non-binary trees, for which this
method will currently return an incorrect value!!
Returns : integer
Args : none
An id value for the tree.
Title : id Usage : my $id = $tree->id(); Function: An id value for the tree Returns : scalar Args :
Sets the associated score with this tree.
Title : score
Usage : $obj->score($newval)
Function: Sets the associated score with this tree
This is a generic slot which is probably best used
for log likelihood or other overall tree score
Returns : value of score
Args : newvalue (optional)
Returns the leaves (tips) of the tree.
Title : get_leaf_nodes Usage : my @leaves = $tree->get_leaf_nodes() Function: Returns the leaves (tips) of the tree Returns : Array of Bio::Tree::NodeI objects Args : none

The base class for the adaptor architecture, instantiates the appropriate wrapper depending on $Bio::Phylo::COMPAT
Bio::Phylo::Adaptor::Bioperl::Tree is an adaptor that makes Bio::Phylo trees compatible with the Bio::Tree::TreeI interface.
Also see the manual: Bio::Phylo::Manual.

$Id: Tree.pm 4265 2007-07-20 14:14:44Z rvosa $