NAME

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

SYNOPSIS

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');

DESCRIPTION

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

METHODS

get_nodes()

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_root_node()

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
number_nodes()

Returns the number of nodes.

Title   : number_nodes
Usage   : my $size = $tree->number_nodes
Function: Returns the number of nodes
Example :
Returns : 
Args    :
total_branch_length()

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
height()

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
id()

An id value for the tree.

Title   : id
Usage   : my $id = $tree->id();
Function: An id value for the tree
Returns : scalar
Args    : 
score()

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)
get_leaf_nodes()

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

SEE ALSO

Bio::Tree::TreeI

Bio::Phylo::Adaptor::Bioperl::Tree is an adaptor that makes Bio::Phylo trees compatible with the Bio::Tree::TreeI interface.

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual.

REVISION

$Id: Tree.pm 4213 2007-07-15 03:11:27Z rvosa $