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()
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()
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()
Title   : number_nodes
Usage   : my $size = $tree->number_nodes
Function: Returns the number of nodes
Example :
Returns : 
Args    :
total_branch_length()
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()
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()
Title   : id
Usage   : my $id = $tree->id();
Function: An id value for the tree
Returns : scalar
Args    : 
score()
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()
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.

FORUM

CPAN hosts a discussion forum for Bio::Phylo. If you have trouble using this module the discussion forum is a good place to start posting questions (NOT bug reports, see below): http://www.cpanforum.com/dist/Bio-Phylo

BUGS

Please report any bugs or feature requests to bug-bio-phylo@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bio-Phylo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Be sure to include the following in your request or comment, so that I know what version you're using:

$Id: Tree.pm 3335 2007-03-21 00:53:50Z rvosa $

AUTHOR

Rutger A. Vos,

email: rvosa@sfu.ca
web page: http://www.sfu.ca/~rvosa/

ACKNOWLEDGEMENTS

The author would like to thank Jason Stajich for many ideas borrowed from BioPerl http://www.bioperl.org, and CIPRES http://www.phylo.org and FAB* http://www.sfu.ca/~fabstar for comments and requests.

COPYRIGHT & LICENSE

Copyright 2005 Rutger A. Vos, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.