Initialisation

library(BactDating)
library(ape)
set.seed(0)

Data

A ClonalFrameML output can be read using:

t=loadCFML(prefix='cfml-output')

A Gubbins output can be read using:

t=loadGubbins(prefix='gubbins-output')

Instead, for the purpose of making this vignette self-contained, we will simulate an output from a recombination analysis. This is just an object of class phylo, unrooted and with the added field unrec representing the proportion that is unrecombined for each branch.

dates=1990:2010
truetree=simcoaltree(dates)
t=unroot(simobsphy(truetree))
t$unrec=runif(length(t$edge.length))
plot(t)
axisPhylo(backward = F)
edgelabels(round(100*t$unrec))

Analysis

We run BactDating as follows:

res=bactdate(t,dates,useRec=T)
plot(res,'treeCI')

We can compare with the correct tree:

plot(truetree)
axisPhylo(backward = F)

We can see what the MCMC traces look like:

plot(res,'trace')


xavierdidelot/BactDating documentation built on Nov. 23, 2023, 1:32 a.m.