[Bioperl-l] TreeIO nexus file parsing issue (bug?)
kevin liu
kliu_cali at yahoo.com
Sat Sep 10 15:42:01 EDT 2005
Hi,
I'm posting a problem I ran across while using
Bio::TreeIO to convert trees from Nexus to Newick
format.
Line 150 in nexus.pm reads:
if( /^\s+(\S+)\s+([^\s\,\;]+)\s*([\,\;])?\s*$/ ) {
It should really at least be changed to:
if( /^\s*(\S+)\s+([^\s\,\;]+)\s*([\,\;])?\s*$/ ) {
Thus, nexus.pm expects at least one space in front
of each line in the Translate block of the Nexus tree
file.
Something like the sample Nexus tree file at
http://workshop.molecularevolution.org/resources/fileformats/tree_formats.php
doesn't work! This ate up a bunch of my time until I
went through Jason Stajich's nexus.pm code. (file
below)
#NEXUS
Begin trees; [Treefile saved Wed Jul 26 19:40:41
2000]
[output from your data run]
Translate 1 TRXEcoli, 2 TRXHomo, 3 TRXSacch, 4
erCaelA, 5 erCaelB, 6 erCaelC, 7 erHomoA, 8 erHomoB, 9
erHomoC, 10 erpCaelC ; tree PAUP_1 = [&U]
(1,((2,3),((((4,10),(5,8)),(6,9)),7))); End;
It needs to be something like:
#NEXUS
Begin trees; [Treefile saved Wed Jul 26 19:40:41
2000]
[output from your data run]
Translate
1 TRXEcoli,
2 TRXHomo,
3 TRXSacch,
4 erCaelA,
5 erCaelB,
6 erCaelC,
7 erHomoA,
8 erHomoB,
9 erHomoC,
10 erpCaelC ;
tree PAUP_1 = [&U]
(1,((2,3),((((4,10),(5,8)),(6,9)),7))); End;
That will parse.
What's annoying is that there aren't any error
messages in the event that there is a parse error - it
just fails silently, and then next_tree returns Undef
as if there were no tree. :(
- Kevin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Bioperl-l
mailing list