Hi all,

I have been using R to create and manipulate phylogenetic trees for a while, but I was wondering what the differences are between the rooting functions in different packages, `ape::root`, `ggtree::reroot` and `phytools::reroot`.

I have attached an example. Every tree looks slightly different, and the tree created by `ggtree::reroot` seems best to me. Could anyone explain the differences?

    tree <- read.tree(text = "(t6:0.3806255851,(t7:0.5440872659,(t5:0.6203179485,t1:0.7089423968):0.3421749519):0.2618428892,((t4:0.5886056426,t3:0.8614832051):0.09094934678,(t8:0.6766210056,t2:0.1412485428):0.4451906278):0.2356684168);")
    
    par(mfcol=c(2,2), mar=c(0.5,0.5,1.3,0.5))
    
    plot(tree)
    nodelabels()
    title("original")
    
    tree1 <- ape::root(tree, node = 11)
    plot(tree1)
    nodelabels()
    title("ape::root")
    
    tree2 <- ggtree::reroot(tree, 11)
    plot(tree2)
    nodelabels()
    title("ggtree::reroot")
    
    tree3 <- phytools::reroot(tree, 11)
    plot(tree3)
    nodelabels()
    title("phytools::reroot")

![Example][1]

Any explanation would be greatly appreciated.


Best wishes,

Michael


  [1]: https://i.imgur.com/WM5XPgf.png
ggtree::reroot is *not* re-rooting the tree at node 11, but on the edge connecting nodes 10 & 11, so is incorrect since the position used along this edge (its midpoint?) is arbitrary. If desired this can be done using phytools::reroot by specifying the position at which the tree should be re-rooted. (I suspect it can also now be done by ape::root.)