[Bioperl-l] Bio::TreeIO problems parsing bootstrap values in newick format trees

Vamsi vamsi at warta.bio.psu.edu
Tue Mar 30 10:26:44 EST 2004


Hi,

I am using the Bio::TreeIO module to parse trees but have some
problems with the bootstrap values. I used the following code to
place arbitrary bootstrap values at interior nodes of the tree

(a:1,(b:1,c:1):1);

Code used:
----------------------------------------------------------------
use Bio::TreeIO;

my $in = new Bio::TreeIO(-file => $ARGV[0], -format => 'newick');
my $tree = $in->next_tree();
foreach my $n ($tree->get_nodes()) {
    if (!($n->is_Leaf())) {
        $n->bootstrap(int(rand(100)));
    }
}
my $out = new Bio::TreeIO(-format => 'newick');
$out->write_tree($tree);
----------------------------------------------------------------

The tree created was:

((a:1,(b:1,c:1)56:1)93);

I then read the tree in again and tried to print the bootstrap values
using the code:

----------------------------------------------------------------
use Bio::TreeIO;

my $in = new Bio::TreeIO(-file => $ARGV[0], -format => 'newick');
my $tree = $in->next_tree();
foreach my $n ($tree->get_nodes()) {
    if (!($n->is_Leaf())) {
        print $n->bootstrap(),"\n";
    }
}
----------------------------------------------------------------

and it printed blank lines ...

I guess, it is either printing wrong format trees or parsing them incorrectly.
Any suggestions?

Thanks,
Vamsi



More information about the Bioperl-l mailing list