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
797 stars 214 forks source link

robinson_foulds with 'unrooted_trees' and 'correct_by_polytomy_size' should probably not correct the root? #745

Open Gullumluvl opened 8 months ago

Gullumluvl commented 8 months ago

Hi,

I am currently using the version Ete3 but the current robinson_foulds source code from this repository is identical:

https://github.com/etetoolkit/ete/blob/0f986e0ed3f39a3ca3d421b061de7ebe6c03ff10/ete4/core/tree.pyx#L1286-L1288

I think that the root node should be handled specially in the polytomy size correction when using unrooted_trees=True.

Otherwise, despite having a tree that is fully bifurcating, except at the root because of the convention for unrooted trees, you get the following error:

TreeError: 'Both trees contain polytomies! Try expand_polytomies=True instead'

I think that an update could be to check that the root node degree is greater than 3 when unrooted_trees is activated.

Best,