[Bioperl-l] delete some nodes in a Bio::Tree

Jason Stajich jason.stajich at duke.edu
Wed Sep 7 11:46:32 EDT 2005


Don't forget to look at the HOWTO:
  http://bioperl.org/HOWTOs/html/Trees.html

There is a remove_Node function for Bio::Tree objects in  
Bio::Tree::TreeFunctionI module.
You use it like:
   $tree->remove_Node($node);

So for example to remove all the nodes (presumably terminal taxa)  
which start with 'hsap':
for my $node ( $tree->get_nodes ) {
   if( $node->id =~ /^hsap/ ) {
    $tree->remove_Node($node);
   }
}

I've just fixed a small bug when a node is last in a clade so you'd  
do best to grab the code from CVS , at least the Bio/Tree and Bio/ 
TreeIO directories.
http://cvs.open-bio.org/

-jason
On Sep 7, 2005, at 11:15 AM, Filipe Garrett wrote:

> Hi all,
>
> I have been looking at Bio::Tree and I would like to ask if there is a
> way to delete the nodes that don't match with the names in a list.
>
> The idea would be to delete some nodes in a Bio::Tree object.
>
> Any idea about how I could do that?
>
> Thanks in advance,
>
> Bests,
>
>    Filipe.
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12




More information about the Bioperl-l mailing list