[Bioperl-l] Query on tree bootstrap values

Himanshu Ardawatia himanshu.ardawatia at bccs.uib.no
Fri Oct 27 01:54:36 UTC 2006


Hi,

2 questions :

1. I have a phylogenetic tree and I wish to set (or modify or query)
bootstrap values for all internal nodes. How do I do that using BioPerl ?

2. I tried the example script attached below for general purpose for the
example newick tree with bootstrap values (also attached below) and It gives
strange results even for branch length. It shows Parent ID as 0.71 which
actually is the bootstrap value for the last ancestral node for human and
chimp and It shows the Child node ID as 'Human' ! Am I missing something in
the tree formatting ? Results also attached below. Also how to extract /
modify/ add bootstrap values in this tree ?

Thanks
Himanshu

EXAMPLE TREE (Newick with bootstrap values and branch lengths) :
#################################
(
  ('Chimp'  : 0.052,
   'Human'  : 0.042) 0.71 : 0.007,
  'Gorilla'  : 0.060,
  ('Gibbon'  : 0.124,
   'Orangutan'  : 0.0971) 1 : 0.038
);
#################################

EXAMPLE SCRIPT:

#################################
#!/usr/bin/perl -w

use Bio::Seq;
# use Bio::TreeIO;
use Bio::Tree::TreeI;

# get a Tree::NodeI somehow
    # like from a TreeIO
    use Bio::TreeIO;
    # read in a clustalw NJ in phylip/newick format
    my $treeio = new Bio::TreeIO(-format => 'newick', -file =>
'example_newick_tree.newick');

    my $tree = $treeio->next_tree; # we'll assume it worked for demo
purposes
                                   # you might want to test that it was
defined

    my $rootnode = $tree->get_root_node;

    # process just the next generation
    foreach my $node ( $rootnode->each_Descendent() ) {
        print "branch len is ", $node->branch_length, "\n";
    }

    # process all the children
    my $example_leaf_node;
    foreach my $node ( $rootnode->get_Descendents() ) {
        if( $node->is_Leaf ) {
            print "node is a leaf ... ";
            # for example use below
            $example_leaf_node = $node unless defined $example_leaf_node;
        }
        print "branch len is ", $node->branch_length, "\n";
    }

    # The ancestor() method points to the parent of a node
    # A node can only have one parent

    my $parent = $example_leaf_node->ancestor;

    # parent won't likely have an description because it is an internal node
    # but child will because it is a leaf

    print "Parent id: ", $parent->id," child id: ",
          $example_leaf_node->id, "\n";

##########################################

RESULTS:
branch len is  0.007
branch len is  0.060
branch len is  0.038
node is a leaf ... branch len is  0.042
node is a leaf ... branch len is  0.052
branch len is  0.007
node is a leaf ... branch len is  0.060
node is a leaf ... branch len is  0.0971
node is a leaf ... branch len is  0.124
branch len is  0.038
Parent id: _0.71_ child id: ___'Human'__



More information about the Bioperl-l mailing list