bioRxiv Science⌕ Search

bioRxiv · 10.64898/2025.12.18.694482

demografr: A toolkit for simulation-based inference in population genetics

Abstract

Simulation-based inference methods such as Approximate Bayesian Computation (ABC) are a popular class of techniques in evolutionary biology and population genetics. These methods are particularly useful for fitting complex models, as they can bypass the need to compute an exact likelihood function, instead relying on comparisons between observed and simulated summary statistics. However, numerous technical and practical hurdles often hinder the application of these methods to new modeling problems. They require the integration of disparate scripts and software for simulation, computing summary statistics, and inference into pipelines which have to be tailor-made for each specific research project. Moreover, computational costs of population genetic simulations can make inference laborious due to costly file format conversions throughout the entire procedure. Here we present a new R package called demografr (github.com/bodkan/demografr), which aims to alleviate most issues with traditional simulation-based inference workflows while facilitating their application to novel and complex modeling problems. First, demografr leverages the R simulation toolkit slendr for interactive, user-friendly encoding of complex demographic models. Second, demografr allows the user to set up parameter distributions and run simulations from them automatically, with built-in support for parallelization. For this purpose, automated inference routines for ABC or grid-based parameter exploration are provided, with individual components available for developing other simulation-based workflows in the future. Third, demografr allows a wide range of summary statistics to be efficiently computed directly in R, without any need for file conversion. In addition to the default slendr simulation engine, demografr also supports user-defined msprime and SLiM simulation scripts as well as entirely customizable summary statistic functions. We illustrate the features of demografr on examples which would traditionally require complex workflows with hundreds of lines of code: estimating parameters of a demographic model via coalescent simulations using ABC, exploring the influence of a set of parameters on summary statistics of interest using parameter grid search, and showcasing the ability to integrate fully customized simulation code written in pure Python or SLiM.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Petr, M., Pötzsch, I. M., Racimo, F.. 2025-12-18. demografr: A toolkit for simulation-based inference in population genetics. https://doi.org/10.64898/2025.12.18.694482

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related preprints

Isoform inflation and annotation heterogeneity can confound Kunitz-repertoire comparisons in blood-feeding animals: a gene-level reappraisal

Hematophagy has arisen independently many times across Metazoa, and recurrent anticoagulant protein families in blood-feeders are often read as convergent recruitment - the Kunitz/BPTI domain a paradigm case, with the leech an oft-cited low-Kunitz exception. We re-examine this at the gene level and ask whether a confirmatory cross-phylum test of this blood-feeding/anticoagulant association is feasible with public genomes. Applying an auditable gene-level protocol (one longest-isoform representative per gene; conservation-checked protein to gene mapping) to eight metazoan lineages, we find no consistent, universal elevation of whole-genome gene-level Kunitz-repertoire size in these blood-feeders (blood-feeder median 18 genes vs non-blood-feeder median 39; a descriptive comparison of non-independent taxa, not a formal test). Protein-entry counts inflate gene-level Kunitz counts by up to ~4.6x (mosquito 23 to 5), and neither this inflation nor proteome-wide isoform density (1.0-2.7x) tracks diet, so protein-entry comparisons are an unreliable basis for repertoire claims. Separately, deterministic bookkeeping under a fixed topology and a no-reversal rule counts 12 independent blood-feeding origins (11 if the ancestral lamprey is treated as parasitic with two losses); a non-exhaustive screen of annotated public genomes yielded only one candidate blood/non-blood pair (bedbug), and, under the pre-registered simulation scenario, only a cross-origin heterogeneity endpoint is attainable within a realistic origin ceiling, and only under strong heterogeneity (among-origin SD >= 3-4). An exploratory, feasibility-grade secretome-composition estimate did not meet the pre-registered criterion. We offer a gene-level, annotation-aware re-analysis, a caution about isoform/annotation bias in cross-phylum comparisons, and an account of what current data can and cannot support.

evolutionary biology↗

Denisovan introgression left differential selection regimes in Humans and Neanderthals on the SLC30A9 gene

Signals of positive selection around the SLC30A9 gene have been reported in human populations outside Africa. Selection likely acted on a highly differentiated single-nucleotide polymorphism, rs1047626, leading to a non-synonymous substitution in the encoded zinc transporter. Because of the striking similarity between the putatively selected SLC30A9 haplotype observed in several current human populations and the Denisovan individual, previous work has proposed adaptive introgression. Yet alternative explanations, including ancient human variation, and the precise archaic source -Neanderthal or Denisovan- remained unresolved. Considering the potentially complex evolution of SLC30A9, we applied Approximate Bayesian Computation (ABC) algorithms coupled to machine learning to investigate the most plausible evolutionary origin of this substitution. After modelling different evolutionary scenarios with forward-in-time simulations, our results highlight that the most probable scenario is a Denisovan origin of the rs1047626 polymorphism. However, the allele likely introgressed into Neanderthals first and was then passed into non-African modern humans. Moreover, the derived allele frequency for rs1047626 across several African populations is consistent with back-to-Africa migrations. Finally, our ABC analyses indicate strong positive selection in East Asian populations and other out-of-Africa populations, whereas in Neanderthal populations, the selection coefficient was probably neutral or slightly deleterious.

evolutionary biology↗

Distinct associative learning abilities for colour and odour in the flower-feeding Drosophila elegans and the fruit-feeding Drosophila melanogaster

Animal behaviour is both innately constrained and shaped by learning. This mosaic organization has evolved in response to species-specific ecological demands and may differ between sensory modalities. Flower-visiting animals are a particularly useful system for investigating the relationship between sensory ecology and learning because they rely on multiple floral cues, particularly odour and colour, to locate food sources. However, it remains largely unexplored whether specialization on floral resources entails divergence in learning abilities across sensory modalities. Drosophila elegans is a flower-feeding species that depends heavily on floral resources throughout its life; adults spend much of their time on flowers and larvae develop on fallen flower leaves. Here, we compared odour-reward and colour-reward associative learning between the flower-feeding D. elegans and the fruit-feeding D. melanogaster. We found that, under conditions of equilibrated motivation, odour- and colour-preference, and using the same sugar reward, D. elegans exhibited poorer odour-reward learning performance but better colour-reward learning performance than D. melanogaster. These results suggest that the modality-specific eligibility of sensory information to enter into associations, known as the 'Garcia-effect' in experimental psychology, can evolve oppositely between species. This highlights the relationship between ecological specialization and mnemonic processing, and shows that biological 'intelligence' is not general.

evolutionary biology↗