bioperl / bioperl-live-redmine

Legacy tickets migrated from the OBF Redmine issue tracker: http://redmine.open-bio.org
0 stars 0 forks source link

Bio::TreeIO::nhx cannot parse empty [&&NHX] + round-trip failure #73

Open cjfields opened 8 years ago

cjfields commented 8 years ago

Author Name: Philip Kensche (Philip Kensche) Original Redmine Issue: 3007, https://redmine.open-bio.org/issues/3007 Original Date: 2010-02-09 Original Assignee: Bioperl Guts


Reading the following tree

((x:0.05, y:0.06),a:0.1[&&NHX:G=dummy]);

and writing it back produces this tree:

((x:0.05,y:0.06)[&&NHX],a:0.1[&&NHX:G=dummy]);

An empty [&&NHX] field was is added in the subtree containing leaves x and y.

Reading this tree, with an empty NHX field, however, produces an error:

——————- EXCEPTION: Bio::Root::Exception ——————- MSG: Unrecognized, non &&NHX string: >>a<< STACK: Error::throw STACK: Bio::Root::Root::throw /data/work/local/lib64/perl5/site_perl/5.8.8/Bio/Root/Root.pm:359 STACK: Bio::TreeIO::nhx::next_tree /data/work/local/lib64/perl5/site_perl/5.8.8/Bio/TreeIO/nhx.pm:204 STACK: -e:1 —————————————————————————————-

I am not certain about the specification of the nhx format and whether this is rather a bug in the writing code than in the parser. I personally would prefer a robust parser that accepts empty [&&NHX] fields.

In any case, a round-trip test should not fail.

For completeness: I used this script: — use Bio::TreeIO; my $in = new Bio::TreeIO (-fh => *STDIN, -format => “nhx”); my $tree = $in->next_tree; my $out = new Bio::TreeIO (-fh => *STDOUT, format => “nhx”); $out>write_tree($tree); —

Greetings, Philip

cjfields commented 8 years ago

Original Redmine Comment Author Name: Philip Kensche Original Date: 2010-02-10T05:35:12Z


Bug 3008 has been marked as a duplicate of this bug.