[Bioperl-l] TreeIO question/problem

Simon K. Chan skchan at cs.usask.ca
Wed Mar 10 00:56:24 EST 2004


Hi,

I wish to parse a tree in newick format.

I attempted to use the TreeIO module to do so:

My problem is that $treeio->next_tree does not return anything, thus I cannot
call the get_nodes method to get all the nodes in my tree.

My code follows.  Many thanks for your time.

use lib '/home/skchan/bioperl/bioperl-1.4';
use Bio::Tree::Node;
use Bio::TreeIO;
use Bio::Tree::Tree;
use Bio::Tree::TreeI;
                     
# obtained code from bioperl documentation:                                    
                      
my $treeio = new Bio::TreeIO(-format=>"newick", -file=>"./newick_tree");
my $tree = $treeio->next_tree;
                                                                                
print "tree: $tree\n";
                                                                                
my @nodes = $treeIO->get_nodes;
                                                                                
print "nodes: @nodes\n";






More information about the Bioperl-l mailing list