iqtree / iqtree2

NEW location of IQ-TREE software for efficient phylogenomic software by maximum likelihood http://www.iqtree.org
GNU General Public License v2.0
231 stars 55 forks source link

Add option to force-unroot input trees #251

Open roblanf opened 2 months ago

roblanf commented 2 months ago

Some discussion required on details of course, but the particular use case I have in mind right now is in the gcf calculation.

In this thread: https://github.com/iqtree/iqtree2/discussions/248

@ryneches had a frustrating issue to do with attempting to use rooted trees as input for the --gcf flag. It could be relatively easily fixed with newick utils, but still an additional option like --force-unroot-input-trees (or something better named) would be really useful.

For my money, this should just apply to all trees read in by IQ-TREE, that way the implementation can go right into the function that reads in trees, and would just set all input trees to unrooted for a given analysis. I suspect this would solve 90% or more of the problems.

ryneches commented 2 months ago

For now, how about improving the error message? When this happens...

ERROR: Taxon not found in full tree: __root__

...maybe catch the special case where the taxon not found is __root__, and add some text that explains why rooting was inferred for the input trees? If that seems like a good idea, I can make a PR.

bqminh commented 2 months ago

Please try -rooted option, which on the opposite forces all trees to be rooted. If that existing option solves this problem, then let's go for it.

roblanf commented 2 months ago

I'm a bit concerned that in this case the (presumably, meaningless) position of the root adds an extra branch in each tree, including the reference tree. This should mean that the gCFs etc. become quite meaningless I think.

bqminh commented 2 months ago

For now, how about improving the error message? When this happens...

ERROR: Taxon not found in full tree: __root__

...maybe catch the special case where the taxon not found is __root__, and add some text that explains why rooting was inferred for the input trees? If that seems like a good idea, I can make a PR.

Yes, can you pls make pull request? Thanks