-
-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Labels
Description
Hi,
The unroot() doesn't preserve total branch lengths:
from ete3 import Tree
#rooted tree
tree_newick = '((161100:0.00956962,4472:0.0109621)1:0.00420709,(161105:0.00616437,(161099:0.010252,161106:0.0064157)1:0.0143586)1:0.00315984);'
rooted = Tree(tree_newick)
#sum of branch lengths
d_rooted = 0
for node in rooted.traverse():
d_rooted += node.dist
#unroot tree
unrooted = Tree(tree_newick)
unrooted.unroot()
#sum of branch lengths
d_unrooted = 0
for node in unrooted.traverse():
d_unrooted += node.dist
#comapre sums
print d_rooted == d_unrooted #false
thanks!
Nomi
Reactions are currently unavailable