-
Notifications
You must be signed in to change notification settings - Fork 11
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
is.ultrametric unexpected behavior #122
Comments
Dear Pedro, Thanks for your appreciation (always appreciated!) I run the following code (using i <- 0
repeat {
i <- i + 1
trees <- replicate(1000, rcoal(10), FALSE)
class(trees) <- "multiPhylo"
stopifnot(all(is.ultrametric(trees)))
stopifnot(all(sapply(trees, is.ultrametric)))
stopifnot(all(unlist(purrr::map(trees, is.ultrametric))))
} Just in case: you can change the argument
Best, Emmanuel |
Dear Emmanuel, Thanks for the quick response! After running the same code you provided on my notebook, i wondered if that could be somehow related to how i am importing the tree files into R. I am importing BEAST2 trees using Here's a reproducible example using your code.
I wonder why |
Dear Emmanuel, here's another example of the same behavior after saving trees in nexus format and then reading back to R.
Also, when comparing different
Edit: Just found a workaround checking
|
Dear Pedro, I think there are several issues behind these results.
R> as.numeric(sprintf("%.16f", pi)) == pi
[1] TRUE
R> as.numeric(sprintf("%.10f", pi)) == pi
[1] FALSE
If you just need to save trees to use them later in R/ape, my recommendation is to use
R> tr <- rcoal(10)
R> is.ultrametric(tr, options = 1)
[1] TRUE
R> is.ultrametric(tr, options = 2)
[1] TRUE
R> ts <- read.tree(text = write.tree(tr, digits = 6))
R> is.ultrametric(ts, option = 1)
[1] FALSE
R> is.ultrametric(ts, option = 2)
[1] TRUE Best, Emmanuel |
Dear Emmanuel,
first of all, thanks for this amazing package.
I just found an unexpected behavior when i was trying to run
splits::gmyc()
over a set of post-burnin files from BEAST2 usingpurrr::map()
, which is the tidyverse'slapply()
function.The problem seems to be in the
is.ultrametric()
evaluation made prior to the analysis. For example, running over a set of 1000 ultrametric trees generated using BEAST2:Evaluating a multiPhylo object using
is.ultrametric()
:[1] TRUE
Evaluating a multiPhylo object using
is.ultrametric()
insidelapply()
:[1] TRUE
Evaluating a multiPhylo object using
is.ultrametric()
insidepurrr::map()
:[1] FALSE
I really don't understand what's going on here. Any ideas?
The text was updated successfully, but these errors were encountered: