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 when specifying isolation date intervals #60

Closed acrespo-virevol closed 1 year ago

acrespo-virevol commented 1 year ago

Hi,

I am attempting to specify a date of isolation interval for my samples like so:

 dates= c(2009,2002,1997,2007,2013,2000,2017,2002,1995,2012,1995,2014,2002,

          2001,1996)

 d= cbind(dates, dates+1)

But when I run the initRoot command I get the following error:

 #optimal root
 rooted= initRoot(tree, d)

 **Error in cor(date, ys, use = "complete.obs") : incompatible dimensions**

Would you be able to help with this?

Thanks!

xavierdidelot commented 1 year ago

The initRoot function uses a single date estimate instead of a range. So you could use: rooted=initRoot(tree, rowMeans(d))