[Bioperl-l] Bio::TreeIO

Jason Stajich jason at bioperl.org
Tue Jan 25 21:46:16 UTC 2011


Hi Komal -

You would just iterate over all the nodes, unset the bootstrap value if 
it is < that your cutoff.

  for my $node ( $tree->get_nodes ) {
   if($node->bootstrap < $CUTOFF ){
    $node->bootstrap('');
    }
  }

The subtly between whether values get moved to boostrap value or just as 
an id can be set when you do Bio::TreeIO reading in, you can also call
$tree->move_id_to_bootstrap
which moves them over to the bootstrap slot.

Alternatively you can just know that ids for internal nodes are for 
boostraps and use that field, e.g.
for my $node ( $tree->get_nodes ) {
   if(! $node->is_Leaf && $node->id < $CUTOFF ){
    $node->id('');
    }
  }

And write the tree back out. The HOWTO on Trees shows I/O for trees in 
more detail.

Best wishes.


Komal Jain wrote:
> Dear Jason,
>
>
>
> I went through the documentation of the Bio::Tree module and it is a very
> useful tool. I would like to know from you if it is possible to remove the
> bootstrap values smaller than a cutoff from the newick tree.
>
>
>
> Thanks in advance for your reply,
>
> Komal.
>

-- 
Jason Stajich
jason at bioperl.org
http://bioperl.org/wiki




More information about the Bioperl-l mailing list