Closed babarlelephant closed 2 years ago
Calling augur ancestral on the BEAST tree should work with the following caveats. Firstly, the internal nodes will have to be named on the input newick (either via script, or running augur refine
without asking it to compute a time tree). Secondly, the tree will be constrained to the BEAST tree, so your not inferring a divergence tree per se; you will need to write a small script to convert the output from augur ancestral
into a count of mutations which augur export v2
will assign to div
if you want to see it in auspice (see the node-data JSON output of a typical augur refine
command to check the expected format). Finally, given a tree as above with long branches from the root, the way mutations are assigned to these two long branches is a bit strange; using an outgroup to root the tree and then pruning it out should help here.
I thought BEAST had a model which could export nucleotide mutations on each branch, but it's been a while. You may want to try asking on a BEAST forum about this?
If you want to persue this approach using augur, could you transfer this to discussion.nextstrain.org & hopefully others can comment as well 😄
Closing this issue, but please feel free to continue on discussion.nextstrain.org!
Hi, long question on how would you compute the divergence tree/branch lengths from a (BEAST) timetree?
I found a way that works for MonkeyPox but I am not sure if it will stay correct with other datasets.
The input is a BEAST maximum clade credibility timetree
called fromBeast.tree.mcc, and the alignment used to make it.
Timetrees are hard to read alone, so I also want to have the divergence tree and the mutations appearing on the branches, as in any nextstrain tree.
Solution with iqtree2 -te
Which seems to work reasonably well, at least on this particular case.
beastTree.nwk is a labeled newick, it has some NODE_0000001 attributes in internal nodes, iqtree2 -te optimizes the branch lengths and its output still contains these node names, though a few nodes are removed, augur ancestral assigns ancestral sequences and mutations to these labeled internal nodes, so they can be added to the auspice json by augur export, Finally writeDivToAuspiceJson.py counts the mutations in the branches of the auspice json and writes it to ["node_attrs"]["div"]
Calling TreeTime directly
Otherwise I tried to call treetime directly, feeding the
dates
parameter with the internal nodes' dates exported by augur import beastbut the result is surprising
Calling augur ancestral directly on the timetree exported by augur import beast
The first thing I tried, but it failed (the obtained divergence tree starts with two long branches, which are wrong, but when clicking on the subtrees it looks as expected)
Thanks.