This repository contains the code and data used in the preprint:
A putative bacterial ecocline in Klebsiella pneumoniae
Siqi Liu, Sarah L. Svensson, Daniel Falush
bioRxiv (2025)
https://doi.org/10.1101/2025.01.20.633859
All simulations were implemented in SLiM v4.0.1 using a non-Wright–Fisher (nonWF) framework, as described in the Methods section of the preprint.
The repository contains four main simulation models corresponding to the scenarios analysed in the manuscript:
File: simu_Modeling clonal haploid bacteria with HGT
This model simulates a single panmictic population of clonal haploid bacteria evolving neutrally, with horizontal gene transfer (HGT) of varying tract lengths. It is used to characterize baseline genetic variation generated by mutation and recombination alone.
File: simu_A linear stepping-stone model
A spatially structured linear stepping-stone model with 10 subpopulations connected by nearest-neighbour migration. This model is used to examine how restricted gene flow along an ecological or geographical gradient generates population structure.
File: simupops_Unfitness_1kb.slim (and related files)
This model introduces diversifying selection on a quantitative trait derived from the difference between two mutation types. Fitness increases with distance from the population mean trait value, favouring individuals with extreme phenotypes.
File: simupops_Unfitness_gamma.slim
Extended genome version (5 Mb): simu_refinedselectivemodel.slim
Extended genome + multiple HGT events: simupops_5Mb.slim
This model extends the selective framework by assigning locus-specific selection coefficients drawn from a Gamma distribution, allowing heterogeneity in mutational effects. A 5 Mb genome version is used to better approximate the size and structure of a real Klebsiella pneumoniae genome.
Models exploring recombination-rate and mutation-rate heterogeneity across the genome are located in the revision/ directory.
These simulations are described in the Methods of the preprint.
The analyses and simulations in this repository were performed primarily using:
- SLiM v4.0.1 (non-Wright–Fisher framework)
- R (for PCA, variant loading calculations, and visualization)
All additional software tools and parameters used for genome processing, phylogenetic reconstruction, and population genomic analyses are described in detail in the Methods section of the preprint.