reroot changes data structure / location of support values

8 views
Skip to first unread message

taua...@gmail.com

unread,
Sep 19, 2018, 11:49:27 AM9/19/18
to DendroPy Users
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!
input.tre

Jeet Sukumaran

unread,
Sep 22, 2018, 7:19:59 PM9/22/18
to dendrop...@googlegroups.com, taua...@gmail.com

Rooting an unrooted tree is a change in the model.

Rerooting a tree is also a change in the model.

These might be simple operations, but there are far from purely
cosmetic. Despite what pretty much most tree visualizers may mislead you
into thinking.

Rooting a tree creates a new split. This split was not there in the old
(unrooted) model. Therefore, no support value was mapped to it
originally and therefore no support value is going to be mapped to it
automatically in DendroPy, regardless of what you might expect given
most tree visualization programs.

Have a look here:

https://www.biorxiv.org/content/early/2015/12/25/035360

and discussion here:

https://github.com/jeetsukumaran/DendroPy/issues/53
> --
> You received this message because you are subscribed to the Google
> Groups "DendroPy Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to dendropy-user...@googlegroups.com
> <mailto:dendropy-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--

----------------------------------------------------
Jeet Sukumaran
----------------------------------------------------
Assistant Professor
Biology Department
San Diego State University
----------------------------------------------------
Lab:
https://sukumaranlab.org/
Blog:
https://jeetblogs.org/
Repositories:
https://github.com/jeetsukumaran
Photography:
https://www.flickr.com/photos/jeetsukumaran/
----------------------------------------------------
Email:
jsuku...@sdsu.edu (work)
jeetsu...@gmail.com (personal)
----------------------------------------------------
Mailing Address:
Biology Department, LS 262
San Diego State University
5500 Campanile Drive
San Diego, CA 92182-4614
----------------------------------------------------
Reply all
Reply to author
Forward
0 new messages