You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great phangorn package. I'm having some trouble using this with binary data and wonder why this is.
I have two issues:
Using my data I get the following error when I try to use modelTest to determine the optimal model:
Error in as.vector(x, "character") :
cannot coerce type 'closure' to vector of type 'character'
Using my data I get the following "warning message" when I use optim.pml to fit a JC model.
Warning message:
In QM[lower.tri(QM)] <- x$Q :
number of items to replace is not a multiple of replacement length
Here is a toy example I generated that reproduces the first issue and generates an error (rather than a warning) when trying to fit a JC model. Unfortunately I was not able to reproduce the warning message above using toy data. Nevertheless, using my actual data it seems to output a model with an improved log-likelihood, so perhaps I can ignore the warning message?
library(ape)
library(phangorn)
## Generate 10 taxa with 1000 binary (0/1) characters each
m <- sapply(sprintf("taxon%s",1:10), function(taxon) round(runif(1000, 0, 1)))
rownames(m) <- sprintf("char%s",1:nrow(m))
d <- dist(t(m), method = "binary")
tre <- bionj(d)
## Convert to phangorn format
mphy <- as.phyDat(t(m), type = "USER", levels = c(0,1))
## This fails with the error above (issue 1)
modelTest(mphy)
## Works fine
fit <- pml(tre, mphy)
## Generates error below, different from the warning in issue 2
fitJC <- optim.pml(fit, TRUE)
The error when trying to fit the JC model on the toy data is as follows:
Error in if (!any(betahat < 0)) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In if (!is.binary(tree)) tree <- multi2di(tree) :
the condition has length > 1 and only the first element will be used
The text was updated successfully, but these errors were encountered:
Hi there!
Thanks for the great phangorn package. I'm having some trouble using this with binary data and wonder why this is.
I have two issues:
modelTest
to determine the optimal model:optim.pml
to fit a JC model.Here is a toy example I generated that reproduces the first issue and generates an error (rather than a warning) when trying to fit a JC model. Unfortunately I was not able to reproduce the warning message above using toy data. Nevertheless, using my actual data it seems to output a model with an improved log-likelihood, so perhaps I can ignore the warning message?
The error when trying to fit the JC model on the toy data is as follows:
The text was updated successfully, but these errors were encountered: