-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tree with root node #103
Comments
Hi @KlausVigo, Thanks a lot for reporting this since, I think, it can help to clarify a point on the structure and manipulation of "phylo" objects. The
When plotted, they look identical (unless the internal nodes are visualized explicitly). Only the 2nd one has a R> mytree <- read.tree(text = "((a:1,b:1):1);")
R> is.rooted(unroot(mytree))
[1] TRUE
Correct! Let's take a more extreme example: R> mytree2 <- read.tree(text = "((((((((((a:1,b:1))))))))));")
R> is.rooted(unroot(unroot(unroot(unroot(unroot(mytree2))))))
[1] TRUE You can call R> mytree3 <- mytree2 # keep the original tree
R> while (is.rooted(mytree3)) mytree3 <- unroot(mytree3)
Erreur dans .unroot_ape(phy, length(phy$tip.label)) :
cannot unroot a tree with less than three edges. Same thing if you call
That seems a very good idea which will require a new option to To summarize, the changes needed are:
Cheers, |
Hi @emmanuelparadis,
Might worth fixing, too. Cheers, |
Hi @KlausVigo, I've pushed a new version with an improved version of
The first one needs to be switched to TRUE to have a completely unrooted tree. I prefer to keep the default FALSE to agree with the current behaviour of the function. More tests welcome! Cheers, |
Hi @emmanuelparadis,
Regards, |
Hi Klaus, |
Hi @emmanuelparadis,
I got a bug report which contained this tree
If you plot this tree
you will see that the tree has a root node (n1 to n2) and I quite like that it is possible to plot a tree like that.
I think the tree is stored quite elegant, but one need to check for the root edge and in many wants cases remove it.
However this tree comes with side effects and can cause problems afterwards.
As you can see
unroot
removes the root edge, but leaves the tree rooted. So one would have to callunroot
twice to unroot the tree.collapse.singles
removes the singleton (node n24) and also the root node and solved the bug.So these kind of edges can cause quite some problems and the behaviour is often random.
There might be even cases where one want to treat the root (with an root edge) as tip after unrooting.
Cheers,
Klaus
The text was updated successfully, but these errors were encountered: