xavierdidelot / BactDating

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

res$tree$root.time different from root date in print(res) #17

Closed fengyuchengdu closed 4 years ago

fengyuchengdu commented 4 years ago

Dear Xavier,

1) Is that normal these two values are different?

2) Should I use "useRec = T" to run bactdate when loading from gubbins?

Thanks,

Yu

xavierdidelot commented 4 years ago

Hi Yu,

  1. yes, this happens because res$tree$root.time is the mean when the root is on the branch shown in res$tree whereas in print(res) the root date is the mean when the root could be on any branch.

  2. yes you should.

Best wishes, Xavier

nbawe commented 4 years ago

Which one to is better to report - print(res) root time? I know the issue is closed, but when exporting tree to nex format and displaying node labels what's the difference in 1) length_0.95_HPD 2) height_0.95_HPD?

And how to calculate years from them?

xavierdidelot commented 4 years ago

I would say it is usually better to report the dates for the most likely root, which is what you get from res$tree$root.time and the credible interval is given by res$CI[Ntip(res$tree)+1,]

To make this simpler to report and avoid further confusion, I have just added a new line at the end of print(res) which contains these values.

I think it is better to report these dates because they are the ones shown in the dated phylogeny from plot(res,'tree') and/or plot(res,'treeCI')

There would usually not be too much difference anyway between these values conditioned on most likely root and the unconditioned dates. If you want to be really thorough you could report both.

length_0.95_HPD and height_0.95_HPD are essentially the same intervals measured differently, as needed for compatibility with ggtree.