← Back to all sparks
S

slendr

INFRA · APIS
Velocity0.0

A Simulation Framework for Spatiotemporal Population Genetics

Population-genetic simulation in R, opened up to selection and finally easier to install.

population-geneticssimulationtree-sequencespython-interopinstallation
Current state
slendr specifies spatial and non-spatial population-genetic models in R and simulates them through SLiM or msprime, returning tree sequences that tskit then analyses. Two threads dominate the current releases: keeping in step with fast-moving backends, with SLiM 5.1, pyslim 1.1.0 and Python 3.13 now required, and reducing the setup burden that its Python dependency imposes. Version 1.5.0 adds ephemeral uv-based virtual environments, so init_env(uv = TRUE) can stand in for creating a permanent environment with setup_env().
Where it's heading
Since the 1.0.0 release added non-neutral simulation, the work has shifted from capability to friction. A large share of recent notes concerns Python environment handling, conda activation races on Windows, dependency pruning that made shiny optional, and argument names that misled users, as when gene_flow()'s rate argument turned out to mean total ancestry proportion rather than a rate. That is the profile of a package whose scientific surface is settled and whose remaining problems are the ones users actually hit.
Prediction
Expect the uv-based environment path to move from fallback to default once it has proven itself, given the notes already describe an environment variable for making it so. The deprecated rate argument in gene_flow() is explicitly slated for removal in a future major release, which is the clearest signal here of what a 2.0 would contain.

Recent moves

  1. 1mo ago

    Ephemeral uv Python environments remove the setup step

    Adds reticulate's uv-backed ephemeral virtual environments, so loading the package and calling init_env(uv = TRUE) is enough to get the msprime and tskit functionality working without first creating a permanent environment. Presented as a fallback for cases where the standard setup path causes trouble, which is the recurring complaint these releases keep circling.

    View source ↗
  2. 7mo ago

    gene_flow() separates migration rate from ancestry proportion

    Splits the ambiguous rate argument into migration_rate and proportion after it emerged that rate had always meant the total ancestry received over the gene-flow window, not a per-unit-time rate. Old code keeps working with a deprecation warning, but any published model that set rate under the previous reading was specifying something other than what its author intended.

    View source ↗
  3. 9mo ago

    shiny made optional; SLiM 5.1 and Python 3.13 required

    Moves shiny and shinyWidgets out of the default install, checking for them only when explore_model() is called, and raises the backend floor to SLiM 5.1 with a rebuilt Python environment. Plot_map() also gains an arrows option for dense spatial deme lattices where arrowheads obscure the layout.

    View source ↗
  4. 1y ago

    conda activation reverted to a slower but reliable path

    Backs out a faster environment activation approach after it began resolving to incorrect paths, accepting the slowdown and warning that heavily parallel simulations on Windows remain affected by a suspected conda race condition. Also allows individual samples to be recorded under unique names.

    View source ↗
  5. 1y ago

    Backends raised to SLiM 5.0, tskit 0.6.4 and msprime 1.3.4

    A version-alignment release keeping slendr usable against current backends, with the SLiM extension mechanism now requiring SLiM 5.0. Tract data frames gain the sample time and a haplotype number, small additions that make downstream ancestry analysis less manual.

    View source ↗
  6. 1y ago

    Non-neutral models arrive; slim() interface simplified

    ⚡ SPARK

    The release that took slendr beyond neutral demography into simulating selection, described by the maintainer as too large for the changelog and requiring low-level changes across the codebase. Everything in the four releases since has been consolidation on top of this, which is why the recent notes read as maintenance rather than expansion.

    View source ↗