vignettes/Staph.Rmd
Staph.Rmd
In this vignette we demonstrate the usage of BactDating on a dataset of Staphylococcus aureus ST239 published by Harris et al (2010). The data for this example can be loaded using the command data(staph)
. This will load in your environment the object staph
which is made of two parts. The first part, staph$tree
, is a phylogenetic tree class phylo
from the ape
package. The second part, staph$dates
, is a vector containing the dates of isolations of the genomes. Note that this vector is in the same order as the tips of the tree listed in staph$tree$tip.label
.
Let’s do a root-to-tip regression analysis:
res=roottotip(staph$tree,staph$dates)
We can run BactDating as follows. Note that here we only perform 1000 iterations of the MCMC to keep to building time of this vignette low, but in practice you should run the MCMC for as long as possible.
We can see what the MCMC traces look like:
plot(res,'trace')
Let’s see where the root is likely to be:
plot(res,'treeRoot',show.tip.label=F)
You can extract and plot a sample of trees as follows: