I have an MCC tree generated from a BEAST discrete phylogeographic reconstruction that I'd like to create a nextstrain build for. The tree contains annotations for a state Location which represent countries. However, when I run augur import an error is thrown:
importing from BEAST MCC tree test3.nexus
Traceback (most recent call last):
File "/PHShome/nm104/mambaforge/envs/augur/lib/python3.11/site-packages/augur/__init__.py", line 66, in run
return args.__command__.run(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/PHShome/nm104/mambaforge/envs/augur/lib/python3.11/site-packages/augur/import_/beast.py", line 576, in run
tree = parse_nexus(tree_path=args.mcc, verbose=args.verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/PHShome/nm104/mambaforge/envs/augur/lib/python3.11/site-packages/augur/import_/beast.py", line 247, in parse_nexus
tree=parse_beast_tree(l[treeString_start:], tipMap=tips, verbose=verbose) ## parse tree string
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/PHShome/nm104/mambaforge/envs/augur/lib/python3.11/site-packages/augur/import_/beast.py", line 67, in parse_beast_tree
assert (stored_i != i),'\nTree string unparseable\nStopped at >>%s<<\nstring region looks like this: %s'%(data[i],data[i:i+5000]) ## make sure that you've actually parsed something last time, if not - there's something unexpected in the tree string
^^^^^^^^^^^^^
AssertionError:
Tree string unparseable
Stopped at >>[<<
string region looks like this: [&length_range={0.010170443818125818,1.7464687269575236},Location.rate_range={0.028493514353019125,0.04797808897564314},length=0.2887516853367578,height_median=1.067228397834242,Location.rate_median=0.037565189497614344,length_median=0.23607735067664493,height=1.0672283978342434,Location.set={"South Africa"},Location.rate_95%_HPD={0.031829954286163115,0.043070637603575365},Location.set.prob={1.0},length_95%_HPD={0.010170443818125818,0.632844821823312},Location.rate=0.037676329696073374,height_range={1.0672283978341852,1.067228397834299},height_95%_HPD={1.0672283978342065,1.0672283978342776},Location.prob=1.0,Location=South Africa],(262:1.4489318641792317[&length_range={4.752335998290391E-4,1.8686795032363648},Location.rate_range={0.028493514353019125,0.04797808897564314},length=0.18733452288388458,height_median=1.0809270279712564,Location.rate_median=0.037565189497614344,length_median=0.129779633094806,height=1.0809270279712568,Location.set.prob={1.0},length_95%_HPD={0.0016279204453866214,0.5156044101195221},Location.set={"South Africa"},Location.rate_95%_HPD={0.031829954286163115,0.043070637603575365},Location.rate=0.037676329696073374,height_range={1.0809270279711995,1.0809270279713132},height_95%_HPD={1.0809270279712209,1.080927027971292},Location.prob=1.0,Location=South Africa],159:1.027128211211194[&length_range={1.5062414930611112E-4,2.0613382799290747},length=0.15777544977668267,Location.rate_range={0.028493514353019125,0.04797808897564314},height_median=1.502730680939294,Location.rate_median=0.037565189497614344,length_median=0.0967724434649071,height=1.5027306809392946,Location.set={"Malawi"},Location.rate_95%_HPD={0.031829954286163115,0.043070637603575365},Location.set.prob={1.0},length_95%_HPD={1.5062414930611112E-4,0.5151183892097251},Location.rate=0.037676329696073374,height_range={1.502730680939223,1.5027306809393508},height_95%_HPD={1.5027306809392584,1.5027306809393295},Location.prob=1.0,Location=Malawi]):0.036433399942128464[&length_range={0.01865710541090948,0.04484597995643469},length_95%_HPD={0.01865710541090948,0.04484597995643469},posterior=0.011098779134295227,Location.rate_95%_HPD={0.03367974716898626,0.04787219117030854},Location.rate=0.038810993214068265,height_range={1.5228394357722408,1.654304420504019},height_95%_HPD={1.5228394357722408,1.654304420504019},Location.prob=0.9,Location=Malawi,length=0.038894810003274924,Location.set.prob={0.9,0.1},Location.set={"Malawi","South Africa"},Location.rate_range={0.03367974716898626,0.04787219117030854},height_median=1.5366633136685053,Location.rate_median=0.03812776355179876,length_median=0.04484597995643469,height=1.5588091472459815]):0.13562180296137294[&Location.set.prob={0.8333333333333334,0.16666666666666666},length=0.1701208445462079,Location.set={"Malawi","South Africa"},Location.rate_range={0.03367974716898626,0.04787219117030854},height_median=1.58150929362494,Location.rate_median=0.03778472933010993,length_median=0.23362148778620195,height=1.5621968423356254,length_range={0.015799791796027307,0.23362148778620195},posterior=0.013318534961154272,length_95%_HPD={0.015799791796027307,0.23362148778620195},Location.rate_95%_HPD={0.03367974716898626,0.04472892269292055},Location.rate=0.038926988492366456,height_range={1.5185153905008804,1.58150929362494},height_95%_HPD={1.5273722418891822,1.58150929362494},Location.prob=0.8333333333333334,Location=Malawi],34:1.2402793045257388[&length_range={0.010074120914381979,3.0264324211322418},Location.rate_range={0.028493514353019125,0.04797808897564314},length=0.46156460325203263,height_median=1.461634790528251,Location.rate_median=0.037565189497614344,length_median=0.29987661940706545,height=1.4616347905282512,Location.set.prob={1.0},length_95%_HPD={0.010074120914381979,1.6145045857046085},Location.set={"Mozambique"},Location.rate_95%_HPD={0.031829954286163115,0.043070637603575365},Location.rate=0.037676329696073374,height_range={1.4616347905281941,1.4616347905283007},height_95%_HPD={1.4616347905282154,1.4616347905282865},Location.prob=1.0,Location=Mozambique]):1.0673256961552195[&length_range={0.01747145697181196,0.20601793184891903},posterior=0.01220865704772475,length_95%_HPD={0.01747145697181196,0.20601793184891903},Location.rate_95%_HPD={0.03367974716898626,0.04072490543068871},Location.rate=0.03839414457047175,height_range={1.667266895919255,1.815130781411142},height_95%_HPD={1.667266895919255,1.815130781411142},Location.prob=0.8181818181818182,Location=Malawi,Location.set.prob={0.8181818181818182,0.18181818181818182},length=0.1715961540940534,Location.set={"Malawi","South Africa"},Location.rate_range={0.03367974716898626,0.04787219117030854},height_median=1.815130781411142,Location.rate_median=0.03765105704318339,length_median=0.20601793184891903,height=1.7665014946814106],(((38:0.5663518964309713[&Location.set.prob={1.0},length_95%_HPD={1.4914824525646964E-4,0.4150922749241204},Location.set={"Mozambique"},Location.rate_95%_HPD={0.031829954286163115,0.043070637603575365},Location.rate=0.
The parser appears to be unable to recognize the next node comment, which is unique in that its the first node assigned a Location state of South Africa. The augur import command completes successfully if I either replace South Africa values with SouthAfrica, or if I add a space to the regexes found in augur/import_/beast.py for comments, strings in comments, and sets in comments.
How to reproduce
Steps to reproduce the current behavior:
I'm attaching a subtree from the MCC tree: test3.nexus.zip
Using attached tree, run augur import: augur import beast --mcc test3.nexus --most-recent-tip-date 2024.4 --output-tree test3.tree --output-node-data test3.json
See error
Possible solution
Add spaces to relevant regexes in augur/import_/beast.py. I will submit a PR for these changes.
Your environment: if running Nextstrain locally
Operating system: linux-gnu
Version (e.g. auspice 2.7.0): augur 25.2.0, python 3.11
Current Behavior
I have an MCC tree generated from a BEAST discrete phylogeographic reconstruction that I'd like to create a nextstrain build for. The tree contains annotations for a state
Location
which represent countries. However, when I runaugur import
an error is thrown:The parser appears to be unable to recognize the next node comment, which is unique in that its the first node assigned a Location state of
South Africa
. The augur import command completes successfully if I either replaceSouth Africa
values withSouthAfrica
, or if I add a space to the regexes found inaugur/import_/beast.py
for comments, strings in comments, and sets in comments.How to reproduce
Steps to reproduce the current behavior: I'm attaching a subtree from the MCC tree: test3.nexus.zip
augur import beast --mcc test3.nexus --most-recent-tip-date 2024.4 --output-tree test3.tree --output-node-data test3.json
Possible solution
Add spaces to relevant regexes in
augur/import_/beast.py
. I will submit a PR for these changes.Your environment: if running Nextstrain locally
auspice 2.7.0
): augur 25.2.0, python 3.11Additional context
Add any other context about the problem here.