xavierdidelot / BactDating

Bayesian inference of ancestral dates on bacterial phylogenetic trees
https://xavierdidelot.github.io/BactDating
MIT License
80 stars 15 forks source link

Error in if (log(runif(1)) < l2 - l + pratio + qratio) { : missing value where TRUE/FALSE needed #27

Closed nbawe closed 4 years ago

nbawe commented 4 years ago

Hi when running following command I get the error:

t=loadCFML("/Users/cfml_output") and dates as an intervals

res=bactdate(t,d,initMu=32.6,updateMu=F,nbIts=1000000, useRec=T, showProgress=T)

ERROR:

Error in if (log(runif(1)) < l2 - l + pratio + qratio) { : 
  missing value where TRUE/FALSE needed

When using single dates set to equal to estimate divergence same error occurres:

t=loadCFML("/Users/cfml_output") and dates forced equal

res=bactdate(t,d,initMu=32.6,updateMu=F,nbIts=1000000, useRec=T, showProgress=T)

ERROR:

Error in if (log(runif(1)) < l2 - l + pratio + qratio) { : 
  missing value where TRUE/FALSE needed

Using BactDating v1.0.8

Do you have any idea what it could be?

xavierdidelot commented 4 years ago

After the loadCFML command, could you check if any of the t$unrec is negative or undefined?

nbawe commented 4 years ago

No negatives and no undefined values.

xavierdidelot commented 4 years ago

Are all values in t$unrec between 0 and 1 ?

nbawe commented 4 years ago

Yes:

min = 0,95099521 max = 0,99999355

xavierdidelot commented 4 years ago

Ok there's really nothing wrong with that then. 1) Does it work with unrec=F instead of unrec=T? 2) Does it work if you add model=relaxedgamma ? 3) Does it work if you add model=strictgamma ?

nbawe commented 4 years ago

Well that is more than wierd, just ran the same script again that I used and everything works as intended.

I have ran this script before many times and the error was printed.

Thanks for the help and sorry for the confusion.

xavierdidelot commented 4 years ago

The only explanation I see is that there was something wrong previously in your t$unrec, but I'm glad this is now solved for you!