Hello,
I am trying to root a tree in a specific position with dendropy, but the resulting tree has the support values misplaced. I tried all different methods with reroot_at_edge, reroot_at_node, seed_at etc.
I have read other posts about similar issues, but they couldn't resolve it. I am also aware about issues with rooting unrooted trees, but I would like to do this for this tree anyway.
Any help is appreciated! Below is my current script, an alternative that works partially, and a test tree attached (you can see the misplacement by checking the branch taking the support value 89 close to the base of the tree).
THIS PUTS SUPPORT IN WRONG PLACES:
import dendropy
tree = dendropy.Tree.get(schema='newick', path="input.tre", preserve_underscores=True, rooting="force-rooted")
for leaf in tree.leaf_node_iter():
if leaf.taxon.label == 'Chol':
break
tree.reroot_at_edge(leaf.edge, length1=leaf.edge.length/2, length2=leaf.edge.length/2, update_bipartitions=True, suppress_unifurcations=False)
tree.ladderize(ascending=True)
tree.write(schema='newick', path="output.tre")
THIS ROOTS THE TREE AND MAINTAINS SUPPORT, BUT ROOT IS NOT WHAT I WANT:
edge = tree.seed_node.child_edges()[0]
# edge = tree.leaf_edges()[0] # This also works only for [0], any other edge gives wrong support locations
tree.reroot_at_edge(edge, length1 = edge.length/2, length2 = edge.length/2, update_bipartitions=True, suppress_unifurcations=False)
Overall, I find the behavior of changing the position of the data very weird. In the past I manage to avoid some issues by trying all possible combinations of True/False for update_bipartitions and suppress_unifurcations, but it seems crazy to me that a simple thing like rerooting could cause something like that so easily as the default. I noticed the problem with the support in the new tree, but I imagine people dealing with many trees at once wouldn't be able to see this happening.
Thanks!