etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
768 stars 216 forks source link

Bug in `get_distance()` with flag `topology_only=True` in ete3 #740

Open lenacoll opened 5 months ago

lenacoll commented 5 months ago

tree.get_distance(target, target2, topology_only=True) should (according to the documentation) return the number of nodes connecting target and target2. It does not correctly do this, as shown in this example:

tree = Tree("((A,B), C);")
node2 = tree.get_common_ancestor("A", "B")

Then:

tree.get_distance(tree, node2, topology_only=True)

1.0

tree.get_distance(node2, tree, topology_only=True)

0.0