Skip to content

Advanced Simulated Tutorial

Ciara Judge edited this page May 31, 2024 · 9 revisions

In this tutorial we will go through the process of starting with a time-scaled phylogenetic tree (with dated tips) and case incidence data, and creating an XML file to run an EpiFusion analysis. We'll start with a basic parameterisation, before doing up a more advanced parameterisation to better reflect what we know about how the data was collected. All the 'coding' will be done in R, and you can follow the steps of the Rmd script in the Tutorial_2 folder, however we outline the key steps here too.

The Data

Below data from a simulated outbreak, beginning on January 1st 2020. In this simulated outbreak, sampling of both genomic sequences and cases was very low for the first 5 weeks, followed by a dramatic scale up in sampling.

Step 1: Prep Tree and Incidence for EpiFusion

First we'll prep the data to into EpiFusion friendly format using a helpful EpiFusionUtilities function.

Load in tree

There is a time rooted phylogenetic tree provided in the Tutorial_2 folder that looks like a typical ML or MCC tree. The internal nodes are unlabelled, and the tips are labelled with format 'SeqX|YYYY-MM-DD' where X is the sequence ID (not particularly important) and sampling dates in format YYYY-MM-DD. It looks like this:

(((Seq1|2020-02-07:25.34019121,Seq2|2020-02-12:30.56422482):7.515626746,((((((Seq3|2020-02-01:16.2353651,Seq4|2020-02-16:31.70226578):2.518250603,Seq5|2020-02-20:37.88079282):1.343266022,(Seq6|2020-02-22:37.3726347,(Seq7|2020-02-28:12.91947166,Seq8|2020-03-12:25.94635638):30.33429383):3.920902379):4.563183615,(Seq9|2020-01-11:0,((Seq10|2020-02-05:0.4225899411,Seq11|2020-02-20:14.77410099):24.86331921,(Seq12|2020-02-26:42.49685008,Seq13|2020-02-11:27.62558968):3.903345901):0.006298130304):3.645164922):0.02948172163,((Seq14|2020-02-08:19.80166567,Seq15|2020-01-25:6.171737902):10.55094651,(Seq16|2020-02-12:34.60040577,(((Seq17|2020-02-06:22.43605672,Seq18|2020-02-21:36.89169839):3.731958734,(Seq19|2020-02-12:16.49290413,Seq20|2020-02-08:12.50041318):15.39079419):2.450596343,((Seq21|2020-02-07:19.89420939,Seq22|2020-02-16:29.07676624):8.998463766,(((Seq23|2020-02-08:25.36490093,(Seq24|2020-02-29:43.3264945,Seq25|2020-02-08:22.72759973):2.631670094):2.114989324,(Seq26|2020-02-06:22.35227106,((Seq27|2020-02-06:18.55289678,Seq28|2020-02-11:24.36873786):1.086449185,((Seq29|2020-02-04:13.76423454,Seq30|2020-02-06:16.0006945):2.76984888,Seq31|2020-02-07:19.37946622):1.429631184):2.596182675):2.534875909):0.8934760909,(Seq32|2020-01-21:2.733129672,(Seq33|2020-02-07:19.87979926,Seq34|2020-03-02:43.73363691):0.04720411632):7.243216409):1.53832954):0.6606277884):0.0543886042):0.3898333738):1.036273744):2.023598229,((Seq35|2020-02-05:20.07027504,Seq36|2020-02-15:30.32740053):6.888975159,Seq37|2020-02-22:43.45783263):4.080866793):0.1463448774):0.8123819103,(((((((Seq38|2020-01-31:12.01566709,Seq39|2020-02-11:23.70868393):3.030920977,(Seq40|2020-02-20:32.01873615,Seq41|2020-02-08:20.2539901):3.393518456):2.239708888,(Seq42|2020-02-09:25.91926248,Seq43|2020-02-11:28.00921421):0.2040004541):2.365457875,Seq44|2020-02-11:30.74357405):3.347717922,(Seq45|2020-02-29:50.06735253,Seq46|2020-02-03:24.86231466):1.731135717):1.411181299,(((((Seq47|2020-02-05:19.49432901,Seq48|2020-02-01:15.33765255):4.361557771,(Seq49|2020-02-06:24.23096877,(Seq50|2020-02-05:14.166047,Seq51|2020-02-10:19.62115193):8.796866701):0.6305453344):1.848752408,(Seq52|2020-02-06:27.0575273,(Seq53|2020-02-08:21.91561109,Seq54|2020-02-06:20.24537853):6.266060267):0.1275729896):0.28583537,(Seq55|2020-02-16:35.7862266,(Seq56|2020-02-12:27.33219992,Seq57|2020-02-06:21.05633759):4.096235287):1.532845276):3.510461857,((Seq58|2020-02-05:22.38349413,Seq59|2020-02-08:25.85484596):4.114340035,(((Seq60|2020-02-23:27.60288855,Seq61|2020-02-24:28.94842794):12.90869,Seq62|2020-02-11:29.32904824):3.261122955,(Seq63|2020-02-25:44.54816924,(Seq64|2020-02-12:27.69553666,Seq65|2020-03-21:65.70139064):4.020074872):1.732033531):0.4419218986):2.877410112):0.06098655677):0.02283696186,((Seq66|2020-02-09:11.30328503,Seq67|2020-02-10:12.45718306):18.1585782,(Seq68|2020-02-16:35.78310167,((Seq69|2020-01-30:17.59111522,(Seq70|2020-01-23:3.604807511,Seq71|2020-02-08:19.6335634):6.32472833):1.193684908,(Seq72|2020-01-29:17.33246977,(Seq73|2020-02-06:22.87107127,(Seq74|2020-02-02:12.94699776,Seq75|2020-02-20:31.23877592):6.366885112):2.386667031):0.08049274066):0.1077390956):1.14295854):3.811410345):2.126531831):3.716150826;

Clone this wiki locally