Abstract
The advent of genomic data from densely sampled bacterial populations has created a need for flexible simulators by which models and hypotheses can be efficiently investigated in the light of empirical observations. Bacmeta provides fast stochastic simulation of neutral evolution within a large collection of interconnected bacterial populations with completely adjustable connectivity network. Stochastic events of mutations, recombinations, insertions/deletions, migrations and microepidemics can be simulated in discrete non-overlapping generations with a Wright-Fisher model that operates on explicit sequence data of any desired genome length. Each model component, including locus, bacterial strain, population, and ultimately the whole metapopulation, is efficiently simulated using C++ objects, and detailed metadata from each level of the simulation can be acquired. The software can be executed in a cluster environment using simple textual input files, enabling, e.g., large-scale simulations and likelihood-free inference. Bacmeta is implemented with C++ for Linux, Mac and Windows. It is available at https://bitbucket.org/aleksisipola/bacmeta under the BSD 3-clause license.
Introduction
As genomic sequencing becomes cheaper and more pervasive, researchers are increasingly working with data from densely sampled bacterial populations. To interpret these patterns of genetic diversity, simulators are required to test evolutionary hypotheses: determining which processes likely produced observed real-world patterns.
Traditional simulators often rely on "coalescent" models that work backward from the present to a common ancestor. While computationally efficient, these models struggle with bacteria because frequent recombination—the swapping of DNA between strains—shuffles genetic material so thoroughly that the assumption of a single ancestral tree often breaks down. Furthermore, bacteria typically exist in "metapopulations" (e.g., across different hospitals or hosts) with complex migration patterns that are difficult to model retrospectively. Bacmeta addresses these issues by providing a flexible, forward-in-time simulation framework.
Methods
Bacmeta implements a forward-in-time Wright-Fisher model. Unlike coalescent methods, it maintains a population of individuals and simulates them moving forward through discrete, non-overlapping generations. This approach allows for the recording of every evolutionary event, providing a perfect "ground truth" for validating genomic analysis tools.
Key Technical Features
- Explicit Sequence Data: The simulator operates on actual DNA sequences rather than abstract markers, supporting any desired genome length.
- Comprehensive Event Suite: It simulates mutations (with user-defined weights), recombinations, insertions/deletions (indels), migrations between populations, and "microepidemics."
- Flexible Connectivity: Users can define custom network graphs to represent how different populations are interconnected.
- C++ Optimization: The software utilizes C++ objects and shared pointers to minimize memory usage and maximize execution speed, making it suitable for high-performance computing clusters.
Results and Discussion
The utility of Bacmeta was demonstrated through a case study involving a metapopulation of three interconnected groups over 20,000 generations.
Computational Efficiency
Simulating 20,000 generations for a metapopulation of three groups (each containing thousands of bacteria) took only 35–50 seconds on a standard single-core laptop CPU (Intel Core i5-7200U). This speed makes the tool ideal for Approximate Bayesian Computation (ABC), where thousands of simulations are run with varying parameters to find those that best match empirical data.
Biological Realism
The simulation successfully demonstrated that higher migration rates ($\lambda$) lead to markedly lower pairwise genetic distances between populations. The constant "mixing" reduces the opportunity for populations to diverge into distinct lineages, a fundamental principle of population genetics that Bacmeta captures accurately.
Limitations and Future Work
Current development focuses on neutral evolution, meaning natural selection and the fitness of specific mutations are not explicitly modeled. Future iterations may include selection to better model antibiotic resistance or vaccine escape. Additionally, while the discrete-generation Wright-Fisher model is a powerful approximation, continuous growth cycles may be explored for more dynamic environmental modeling.
Availability: Bacmeta is open-source (BSD 3-clause license) and available for Linux, Mac, and Windows at https://bitbucket.org/aleksisipola/bacmeta.
Summary updated