Abstract Details
Name
treeswithintrees: an R package for simulating transmission histories and virus phylogenies
Presenter
Art Poon, Western University
Co-Author(s)
Department of Pathology and Laboratory Medicine, Western University
Abstract Category
Discovering & Evolving
Abstract
The phylogenetic tree relating viral infections that have been sampled from different hosts bears an imprint of their transmission history. For rapidly-evolving viruses, the shape of this tree can provide useful insights into the past dynamics of an epidemic, i.e., phylodynamic inference. However, the virus phylogeny is not congruent to the transmission history, owing to biological processes such as superinfection and incomplete lineage sorting. Simulation models are an important resource to explore the impact of these factors on our ability to accurately estimate epidemiological parameters, e.g., the effective reproduction number. We have developed an R package (treeswithintrees, or twt) to simulate virus phylogenies for compartmental models of transmission and migration. We employ R6 classes to handle persistent objects such as host individuals. A model comprising parameters, compartments, and sampling methods is specified in a readable YAML file format. Rates are specified with basic R expressions, e.g., "beta*S*I". Population dynamics (compartment sizes) are propagated from initial sizes forward in time by exact stochastic simulation. Next, the transmission history is simulated from sampled hosts backwards in time; with superinfection, this yields a transmission graph instead of a tree. Finally, the virus phylogeny shaped by within-host evolution is generated by coalescent (reverse time) simulation within the transmission graph. We took a user interface-driven approach to package development, first designing an intuitive YAML model specification format before implementing the data structures and algorithms. This project currently comprises over 2,000 lines of code, released under the AGPL-3.0 free software license (https://github.com/PoonLab/twt).
Close