xavierdidelot / BactDating

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

t$unrec values are negative or larger than 1 #58

Closed drxilu closed 2 years ago

drxilu commented 2 years ago

Dear Xavier,

When I use loadGubbins() to get a phylogeny, and then unroot() and initRoot() it, then use bactdate() function with useRes=T, to obtain bactdating analysis. Unfortunately, it got stuck at the last step and kept receiving errors like Error in if (log(runif(1)) < l2 - l + dgamma(mu2, shape = 0.001, scale = 1000, : missing value where TRUE/FALSE needed.

After running some debugs and tracing back to the phylogeny after using loadGubbins(), t$unrec values are not always between 0 and 1, which I believe should be a problem.

spn_uk_gps.gubbins_initrootrec[["unrec"]] [1] -5891.0 1589.5 11352.5 -4862.5 4864.5 1.0 1.0 1.0 -2884.0 4864.5 1.0 1.0 [13] -8104.0 5221.0 -5247.0 8134.0 1.0 1.0 8134.0 2886.0 -52800.0 28102.0 60907.0 1.0 [25] -2884.0 1.0 -29919.0 1.0 2886.0 -40105.5 2886.0 1.0 1.0 1.0 1.0 1.0 [37] 1.0 1.0 1.0 -2884.0 2886.0 1.0 1.0 1.0 1.0 1.0 1.0 -2884.0 [49] 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2886.0 1.0 1.0 1.0 1.0 ...... max(spn_uk_gps.gubbins_initrootrec[["unrec"]]) [1] 73244 min(spn_uk_gps.gubbins_initrootrec[["unrec"]]) [1] -70357

I wonder if you have experienced similar situations or have some suggestions. Appreciate any help!

Best, Xi

xavierdidelot commented 2 years ago

Hi Xi,

This problem is caused by a change in output format in the latest version of Gubbins. I think I've fixed it earlier today in BactDating version 1.1.1, could you please check and confirm?

Best wishes, Xavier

drxilu commented 2 years ago

Hi Xavier,

Thanks for your reply and fix on adapting the change from the latest version of Gubbins.

I checked and can confirm that BactDating is now working well with changes.

Appreciate your help.

Best, Xi