emmanuelparadis / ape

analysis of phylogenetics and evolution
http://ape-package.ird.fr/
GNU General Public License v2.0
52 stars 11 forks source link

Bug fix in .write.tree2 #60

Closed KlausVigo closed 2 years ago

KlausVigo commented 2 years ago

Hello Emmanuel,

I found a bug in .write.tree2, which appears if one rotates some edges:

> library(ape)
> set.seed(42)
> tree1 <- rcoal(5)
> tree2 <- rotate(tree1, 7)
> tree2 <- rotate(tree2, 8)
> tree3 <- read.tree(text=write.tree(tree2))
> all.equal(tree1, tree2)
[1] TRUE
> all.equal(tree1, tree3)
[1] FALSE
> all.equal(tree2, tree3)
[1] FALSE

This pull request should fix the bug.

Cheers, Klaus

emmanuelparadis commented 2 years ago

Thanks!