In this vignette we demonstrate the Bayesian inference of imports.

Initialisation

Simulation with no import

Let’s simulate a random tree with 500 leaves:

set.seed(0)
tree=rtree(500)
tree$root.time=2010
plot(tree,show.tip.label = F)
axisPhylo(backward = F)

Let’s detect the imports:

res=detectImports(tree)
plot(res)

We can see that no import was detected.

Simulation with a single import

Let’s consider that the local population started in 2020 and a single import occurred in 2020.25. 500 genomes were sampled between 2020 and 2021.

set.seed(1)
tree=simImports(localPopStart=2020,importDates=c(2020.25),
                samplingStartDate=2020,samplingEndDate=2021,samplingNumber=500,globalNeg = 0.01)
plot(tree,show.tip.label = F)
axisPhylo(backward = F)

Let’s detect the imports:

res=detectImports(tree)
plot(res)

We can see that the single import was correctly detected.