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:
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);
—
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