rambaut / Seq-Gen

Sequence simulator
51 stars 17 forks source link

"Error reading tree number 1: Closing bracket missing" #9

Closed niemasd closed 7 years ago

niemasd commented 7 years ago

I'm getting the error Error reading tree number 1: Closing bracket missing, but the Newick tree I'm feeding Seq-Gen seems like a valid tree (I ran it through nw_distance to get branch lengths just to make sure it works, and nw_distance parsed it just fine). Can you help me find my issue? Here are the contents of the file I'm trying:

1 900
N2 AGGGCCAACGTGGACTGCTTGCTATGGAGGGTGTGTCGACTCCGAGTTCACCGCCTAGTCGCTTTCCTTCCCAAGGTCAGCTTCACACAATCGGGCTATAGGGAATGCCGATTTAAAAGTGGCACGTACCGCACTGGACGCTTACTTGTCTACACATTCCACACGACAAAAGGACCGTGTTGCTTTAAACTTCGTCCAGTCGGCCCCCCGTGTCATGAAGCTCGCCAATCATTGGAGGCTCAGTCGTATGCCAGTGCTTTTCTAACTCTGGTAGCATCTCTGGGATTTATTCGCGCGCCGGATCTAGACATTACCCAAAATAACGCCCACCAGAAGTCAAGGCGCATTGAGCTGGCGTGCAATTGGTATGGCCCTTATTTTAGGCTTTTAGCGCTCAGCCTAAGAGGAGGGCGTACGGTAATATATCAGCGTGGCCAATGGGTCAATGATCTGGTGCAAGGTCCGGCGGCCCAATCTCCAGCCATGGGAAAGGCGGATCGTATGGGAATATATCGCCGATGTAGCACACAGGTGGGACGACGTAGAAGACAGGTTCGGGTGCATAGGTCCGTGAACGCACAGTGTGCACCATTACGAGTACCGCTACGCGGCGTCGTTAGATACAAACTTCCTAGGGGGCCCGAAGCCAAGGGCAGTAAGTCAAGACTAAACATCGCTACAGAAGTTCCGCTTAAGAATACTGTGACGACGACCACCCTCCTATCCCTACATGCGTCGTCGCGACTAAAGATAACGCAGCTACTACTCGGGTACATCTTGCCTGCCGTTAGAATTTTGGTACCGTACAATGCAAGCCTAGCTACCTACGAGAGAATTGGAACAGTCTTGCTACTATCAAGTGGCAAACAACAACCAAGCATTTGGTACGCTTCTTATCGG
1
(((((((N10094|53|3.387644573626598:0.000000,N1335|53|3.4648137547803013:0.385846)N10093|53|3.387644573626598:2.843726,(N10096|53|3.387644573626598:0.000000,(N10098|53|6.290898771186661:0.000000,N1550|53|6.5055189042327735:1.073101)N10097|53|6.290898771186661:14.516271)N10095|53|3.387644573626598:2.843726)N1329|53|2.818899456866464:0.028835,((N1338|53|3.9619077297964496:2.390328,N10086|53|3.4838422003374294:0.000000)N10085|53|3.4838422003374294:0.527812,(N10088|53|3.387644573626598:0.000000,((N1536|53|6.545552153111298:1.273267,N10090|53|6.290898771186661:0.000000)N10089|53|6.290898771186661:12.535181,(N1610|53|6.525077022435883:1.170891,N10092|53|6.290898771186661:0.000000)N10091|53|6.290898771186661:12.535181)N1337|53|3.78386254970119:1.981090)N10087|53|3.387644573626598:0.046824)N1330|53|3.3782797020259157:2.825736)N1328|53|2.8131325115826025:3.249158,((N10082|53|3.4838422003374294:0.000000,N1333|53|4.51547779079867:5.158178)N10081|53|3.4838422003374294:4.890211,(N10084|53|3.4838422003374294:0.000000,N1325|53|5.335201493819431:9.256796)N10083|53|3.4838422003374294:4.890211)N1324|53|2.5057999939750486:1.712496)N10|53|2.1633008480336615:0.918445,(((((N10138|76|7.136413093174793:0.000000,N739|76|7.20349385579528:0.335404)N10137|76|7.136413093174793:14.832736,(N725|76|6.440686534739932:4.398717,(N770|76|7.098571866123575:3.289427,N10140|76|6.440686534739932:0.000000)N10139|76|6.440686534739932:4.398717)N719|76|5.5609431071049045:6.955386)N704|76|4.169865967577531:1.007382,(N762|76|7.136413093174793:5.185240,(N10132|63|7.026520998197115:0.000000,(N10134|63|7.678036911951752:0.000000,(N10136|63|7.750248481326306:0.000000,N746|63|7.759424299384176:0.045879)N10135|63|7.750248481326306:0.361058)N10133|63|7.678036911951752:3.257580)N10131|63|7.026520998197115:4.635779)N735|76|6.099365107581146:10.654877)N18|76|3.968389650172391:6.202349,(N833|76|6.440686534739932:13.568654,N10142|76|3.7269556498970466:0.000000)N10141|76|3.7269556498970466:4.995179)N16|76|2.727919813583346:0.975411,(((N10130|38|4.384954202491446:0.000000,N7703|38|7.692601176576037:16.538235)N10129|38|4.384954202491446:4.099248,(((N10124|38|4.710728536659602:0.000000,N7302|38|6.745072582849662:10.171720)N10123|38|4.710728536659602:3.871776,(N10126|38|4.710728536659602:0.000000,N7543|38|5.168418140802194:2.288448)N10125|38|4.710728536659602:3.871776)N35|38|3.936373278607399:1.326461,(N32|38|5.848390579996254:7.317182,N10128|38|4.384954202491446:0.000000)N10127|38|4.384954202491446:3.569366)N26|38|3.671081001320573:0.529882)N21|38|3.5651046749252604:1.548266,(((((((N10114|35|6.109433810752977:0.000000,(N7721|35|6.68314747809591:1.384597,N10116|35|6.406228150861876:0.000000)N10115|35|6.406228150861876:1.483972)N10113|35|6.109433810752977:0.793526,N7722|35|6.109433810752977:0.793526)N7717|35|5.950728531832838:2.905630,(N10112|35|6.406228150861876:0.000000,N7718|35|6.83715584702786:2.154638)N10111|35|6.406228150861876:5.183128)N7715|35|5.369602522730817:0.276969,N10110|35|5.314208700660342:0.000000)N10109|35|5.314208700660342:0.313356,(N10104|35|5.314208700660342:0.000000,((N10106|35|6.406228150861876:0.000000,N7725|35|7.415432613936449:5.046022)N10105|35|6.406228150861876:4.617694,(N7723|35|6.542907099066029:2.167366,N10108|35|6.109433810752977:0.000000)N10107|35|6.109433810752977:3.133722)N7716|35|5.482689326353514:0.842403)N10103|35|5.314208700660342:0.313356)N42|35|5.251537410866491:1.257687,(((N1313|79|7.394220575611178:3.002561,(N1309|79|7.898448763109277:5.303604,(N10120|79|7.394220575611178:0.000000,N1315|79|7.898448763109277:2.521141)N10119|79|7.394220575611178:2.782463)N1306|79|6.837728031727479:0.220098)N1304|79|6.793708375375154:4.812583,(N10122|79|7.394220575611178:0.000000,N1322|79|7.898448763109277:2.521141)N10121|79|7.394220575611178:7.815144)N41|79|5.831191817063941:2.217568,N10118|79|5.387678251235054:0.000000)N10117|79|5.387678251235054:1.938391)N34|35|5.0:7.804189,((N7261|38|7.760882722187589:0.341408,N10102|38|7.692601176576037:0.000000)N10101|38|7.692601176576037:20.276384,(N7338|38|4.384954202491446:2.374260,((N10100|38|4.710728536659602:0.000000,N7045|38|5.479073165297347:3.841723)N10099|38|4.710728536659602:0.829614,N7125|38|7.692601176576037:15.738977)N37|38|4.544805745499566:3.173517)N29|38|3.910102255157772:1.363889)N23|38|3.6373244314426554:0.990811)N22|38|3.4391622608511176:0.918554)N15|38|3.2554514626661493:3.613069)N13|76|2.5328376431325754:2.766129)N8|76|1.979611885156058:3.104836,(((N10080|76|3.7269556498970466:0.000000,N20|76|4.41755168315786:3.452980)N10079|76|3.7269556498970466:4.622154,N921|76|7.136413093174793:21.669442)N11|76|2.8025247719501962:4.061246,(N12|76|5.480171134108298:8.766077,N10078|76|3.7269556498970466:0.000000)N10077|76|3.7269556498970466:8.683401)N7|76|1.9902755489963695:3.158154)N3|76|1.3586447399943462:6.610871,((N10074|21|2.0361489799714976:0.000000,(N7755|21|4.546571082984857:0.325177,N10076|21|4.481535604876424:0.000000)N10075|21|4.481535604876424:12.226933)N10073|21|2.0361489799714976:8.236285,((((N10064|21|6.427776507669709:0.000000,N8423|21|7.801600945082707:6.869122)N10063|21|6.427776507669709:17.695347,((N10066|21|4.481535604876424:0.000000,(N8217|21|6.6360575289254715:1.041405,N10068|21|6.427776507669709:0.000000)N10067|21|6.427776507669709:9.731205)N10065|21|4.481535604876424:6.404303,(N10070|21|6.427776507669709:0.000000,N8142|21|6.574277590049945:0.732505)N10069|21|6.427776507669709:16.135508)N8109|21|3.2006749810166126:1.559840)N8104|21|2.8887070425746124:5.667660,(N10072|21|2.0361489799714976:0.000000,N8099|21|2.334175756485804:1.490134)N10071|21|2.0361489799714976:1.404870)N8098|21|1.7551749986922354:1.117354,(N10060|21|2.0361489799714976:0.000000,(N8147|21|5.723852597930773:6.211585,N10062|21|4.481535604876424:0.000000)N10061|21|4.481535604876424:12.226933)N10059|21|2.0361489799714976:2.522224)N6|21|1.531704112895537:5.714061)N4|21|0.38889192335194406:1.762107)N2|21|0.036470598824739756:0.182353;
rambaut commented 7 years ago

I suspect the issue is that this tree has node labels, i.e., ')N10093|53|3.387644573626598:2.843726'.

rambaut commented 7 years ago

A regex replace using /)[^:]*:/):/ would probably fix it. Results in:

1 900
N2 AGGGCCAACGTGGACTGCTTGCTATGGAGGGTGTGTCGACTCCGAGTTCACCGCCTAGTCGCTTTCCTTCCCAAGGTCAGCTTCACACAATCGGGCTATAGGGAATGCCGATTTAAAAGTGGCACGTACCGCACTGGACGCTTACTTGTCTACACATTCCACACGACAAAAGGACCGTGTTGCTTTAAACTTCGTCCAGTCGGCCCCCCGTGTCATGAAGCTCGCCAATCATTGGAGGCTCAGTCGTATGCCAGTGCTTTTCTAACTCTGGTAGCATCTCTGGGATTTATTCGCGCGCCGGATCTAGACATTACCCAAAATAACGCCCACCAGAAGTCAAGGCGCATTGAGCTGGCGTGCAATTGGTATGGCCCTTATTTTAGGCTTTTAGCGCTCAGCCTAAGAGGAGGGCGTACGGTAATATATCAGCGTGGCCAATGGGTCAATGATCTGGTGCAAGGTCCGGCGGCCCAATCTCCAGCCATGGGAAAGGCGGATCGTATGGGAATATATCGCCGATGTAGCACACAGGTGGGACGACGTAGAAGACAGGTTCGGGTGCATAGGTCCGTGAACGCACAGTGTGCACCATTACGAGTACCGCTACGCGGCGTCGTTAGATACAAACTTCCTAGGGGGCCCGAAGCCAAGGGCAGTAAGTCAAGACTAAACATCGCTACAGAAGTTCCGCTTAAGAATACTGTGACGACGACCACCCTCCTATCCCTACATGCGTCGTCGCGACTAAAGATAACGCAGCTACTACTCGGGTACATCTTGCCTGCCGTTAGAATTTTGGTACCGTACAATGCAAGCCTAGCTACCTACGAGAGAATTGGAACAGTCTTGCTACTATCAAGTGGCAAACAACAACCAAGCATTTGGTACGCTTCTTATCGG
1
(((((((N10094|53|3.387644573626598:0.000000,N1335|53|3.4648137547803013:0.385846):2.843726,(N10096|53|3.387644573626598:0.000000,(N10098|53|6.290898771186661:0.000000,N1550|53|6.5055189042327735:1.073101):14.516271):2.843726):0.028835,((N1338|53|3.9619077297964496:2.390328,N10086|53|3.4838422003374294:0.000000):0.527812,(N10088|53|3.387644573626598:0.000000,((N1536|53|6.545552153111298:1.273267,N10090|53|6.290898771186661:0.000000):12.535181,(N1610|53|6.525077022435883:1.170891,N10092|53|6.290898771186661:0.000000):12.535181):1.981090):0.046824):2.825736):3.249158,((N10082|53|3.4838422003374294:0.000000,N1333|53|4.51547779079867:5.158178):4.890211,(N10084|53|3.4838422003374294:0.000000,N1325|53|5.335201493819431:9.256796):4.890211):1.712496):0.918445,(((((N10138|76|7.136413093174793:0.000000,N739|76|7.20349385579528:0.335404):14.832736,(N725|76|6.440686534739932:4.398717,(N770|76|7.098571866123575:3.289427,N10140|76|6.440686534739932:0.000000):4.398717):6.955386):1.007382,(N762|76|7.136413093174793:5.185240,(N10132|63|7.026520998197115:0.000000,(N10134|63|7.678036911951752:0.000000,(N10136|63|7.750248481326306:0.000000,N746|63|7.759424299384176:0.045879):0.361058):3.257580):4.635779):10.654877):6.202349,(N833|76|6.440686534739932:13.568654,N10142|76|3.7269556498970466:0.000000):4.995179):0.975411,(((N10130|38|4.384954202491446:0.000000,N7703|38|7.692601176576037:16.538235):4.099248,(((N10124|38|4.710728536659602:0.000000,N7302|38|6.745072582849662:10.171720):3.871776,(N10126|38|4.710728536659602:0.000000,N7543|38|5.168418140802194:2.288448):3.871776):1.326461,(N32|38|5.848390579996254:7.317182,N10128|38|4.384954202491446:0.000000):3.569366):0.529882):1.548266,(((((((N10114|35|6.109433810752977:0.000000,(N7721|35|6.68314747809591:1.384597,N10116|35|6.406228150861876:0.000000):1.483972):0.793526,N7722|35|6.109433810752977:0.793526):2.905630,(N10112|35|6.406228150861876:0.000000,N7718|35|6.83715584702786:2.154638):5.183128):0.276969,N10110|35|5.314208700660342:0.000000):0.313356,(N10104|35|5.314208700660342:0.000000,((N10106|35|6.406228150861876:0.000000,N7725|35|7.415432613936449:5.046022):4.617694,(N7723|35|6.542907099066029:2.167366,N10108|35|6.109433810752977:0.000000):3.133722):0.842403):0.313356):1.257687,(((N1313|79|7.394220575611178:3.002561,(N1309|79|7.898448763109277:5.303604,(N10120|79|7.394220575611178:0.000000,N1315|79|7.898448763109277:2.521141):2.782463):0.220098):4.812583,(N10122|79|7.394220575611178:0.000000,N1322|79|7.898448763109277:2.521141):7.815144):2.217568,N10118|79|5.387678251235054:0.000000):1.938391):7.804189,((N7261|38|7.760882722187589:0.341408,N10102|38|7.692601176576037:0.000000):20.276384,(N7338|38|4.384954202491446:2.374260,((N10100|38|4.710728536659602:0.000000,N7045|38|5.479073165297347:3.841723):0.829614,N7125|38|7.692601176576037:15.738977):3.173517):1.363889):0.990811):0.918554):3.613069):2.766129):3.104836,(((N10080|76|3.7269556498970466:0.000000,N20|76|4.41755168315786:3.452980):4.622154,N921|76|7.136413093174793:21.669442):4.061246,(N12|76|5.480171134108298:8.766077,N10078|76|3.7269556498970466:0.000000):8.683401):3.158154):6.610871,((N10074|21|2.0361489799714976:0.000000,(N7755|21|4.546571082984857:0.325177,N10076|21|4.481535604876424:0.000000):12.226933):8.236285,((((N10064|21|6.427776507669709:0.000000,N8423|21|7.801600945082707:6.869122):17.695347,((N10066|21|4.481535604876424:0.000000,(N8217|21|6.6360575289254715:1.041405,N10068|21|6.427776507669709:0.000000):9.731205):6.404303,(N10070|21|6.427776507669709:0.000000,N8142|21|6.574277590049945:0.732505):16.135508):1.559840):5.667660,(N10072|21|2.0361489799714976:0.000000,N8099|21|2.334175756485804:1.490134):1.404870):1.117354,(N10060|21|2.0361489799714976:0.000000,(N8147|21|5.723852597930773:6.211585,N10062|21|4.481535604876424:0.000000):12.226933):2.522224):5.714061):1.762107):0.182353;

This now loads in seq-gen.

niemasd commented 7 years ago

You are correct: it seems as though internal node labels were triggering the error. Without the internal node labels, it works properly. Thanks for the prompt response!