Description of problem: phytools::fastAnc seems to call the function root, which appears to typically be resolved to ape::root.phylo. However, the package treeio (now necessary for using ggtree) now defines its own function root.phylo which is not compatible, and which fails if the new root is equal to ((# tips) + 1). fastAnc therefore throws a non-intuitive error if treeio is loaded. Ironically, treeio:::root.phylo actually wraps phytools::reroot, but because phytools::reroot also calls root with no scoping, it ends up circling back to treeio:::root.phylo.
Things I've tried: Manually setting root.phylo <- ape::root.phylo doesn't seem to override what happens when I call fastAnc. Loading treeio first also doesn't work.
Workaround: I don't have a good one, other than redefining fastAnc in my own package and changing the scoping.
Suggested fix: replace root with ape::root.phylo in fastAnc and reroot (and ideally also wherever else is appropriate in phytools).
Thanks very much for your work on this package!
Description of problem:
phytools::fastAnc
seems to call the functionroot
, which appears to typically be resolved toape::root.phylo
. However, the packagetreeio
(now necessary for usingggtree
) now defines its own functionroot.phylo
which is not compatible, and which fails if the new root is equal to ((# tips) + 1).fastAnc
therefore throws a non-intuitive error iftreeio
is loaded. Ironically,treeio:::root.phylo
actually wrapsphytools::reroot
, but becausephytools::reroot
also callsroot
with no scoping, it ends up circling back totreeio:::root.phylo
.Things I've tried: Manually setting
root.phylo <- ape::root.phylo
doesn't seem to override what happens when I callfastAnc
. Loadingtreeio
first also doesn't work.Workaround: I don't have a good one, other than redefining fastAnc in my own package and changing the scoping.
Suggested fix: replace
root
withape::root.phylo
infastAnc
andreroot
(and ideally also wherever else is appropriate inphytools
).