[Bioperl-l] remove_Node leaves parenthesis after deleting internal leaf

Jason Stajich jason.stajich at duke.edu
Thu Sep 29 15:04:03 EDT 2005


I replied to the bug - this should be already fixed.  Can you try  
with Bioperl 1.5.1-RC3?

http://bioperl.org/DIST/bioperl-1.5.1-rc3.tar.gz
http://bioperl.org/DIST/bioperl-1.5.1-rc3.zip

-jason
On Sep 28, 2005, at 3:38 PM, Kevin Beckmann wrote:

> This bug is listed as Bug 1870 under Bugzilla:
>
> I've come across a bug in TreeIO:
> Using this as a model tree (file is named "model_tree.phy"):
> (Arabidopsis,(BNGI,(PPLGI,(csa,(GMGI,MTGI)))));
>
> I run this script:
>
> #!/usr/bin/perl -w
> ### remove_Node_bug.pl ###
> # Created: Wed Sep 28 13:10:00 EDT 2005
> # creator- Kevin Beckmann
>
> use strict;
> use Bio::TreeIO;
>
> my $file = "model_tree.phy";
>
> my $treein = new Bio::TreeIO(-file => $file, -format => "newick");
> my $tree = $treein->next_tree();
> my $treestart = new Bio::TreeIO(-format => 'tabtree');
> print "Starting tree:\n";
> $treestart->write_tree($tree);
>
> foreach my $node ( $tree->get_leaf_nodes() ) {
>         my $leaf_id = $node->id();
>         next if ($leaf_id ne "csa");
>
>         $tree->remove_Node($node);
> }
>
> my $treeout = new Bio::TreeIO(-format => 'tabtree');
> print "Tree w/ deleted node:\n";
> $treeout->write_tree($tree);
>
> $treeout = new Bio::TreeIO(-format => 'newick');
> print "Extra set of parentheses:\n";
> $treeout->write_tree($tree);
> print "\n";
> exit;
> ##########
>
> The script searches through the leaf nodes of the tree to delete  
> the node
> labelled "csa".
> When it does so, it leaves in the parenthesis that surround that  
> node and
> produces a tree:
> (Arabidopsis,(BNGI,(PPLGI,((GMGI,MTGI)))));
> instead of a tree:
> (Arabidopsis,(BNGI,(PPLGI,(GMGI,MTGI))));
> <model_tree.phy>
> <remove_Node_bug.pl>
> _______________________________________________
> 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