# slendr 0.1 (upcoming first public release)

## New functionality

• Geographic landscapes and coordinate systems are no longer tied to a geographic location on Earth and can be fully abstract (including completely arbitrary shapes of the “continents”, geographic barriers etc.).

• It is now possible to define models in forward or backwards direction, depending on what is more convenient for the user and the scenario that is being modeled. The direction of time is automatically detected and translated to SLiM’s units of generations in the forward direction.

• Spatial interaction distances (translated to maxDistance on the SLiM side) as well as offspring distances from parents (i.e. the standard deviations of their normal distributions) can now be specified for each population individually. The users can still provide default values for all populations (or just those which did not have their own dedicated parameter values) in the main compile() call. These parameters can also change dynamically over time by calling the dispersal() function.

• Sampling (“remembering”) of individuals for tree-sequence recording can now be scheduled with the sampling() function.

• A basic interface to tskit has been implemented: loading, recapitating, and simplifying tree-sequence data, conversion to genotype file formats such as EIGENSTRAT (ts_eigenstrat()) and VCF (ts_vcf()), a couple of population genetics statistical functions (all with the ts_* prefix) such as ts_f3(), etc. have also been implemented. More is to come, but the goal here is to focus only on loading tree-sequences and calculating population genetics statistics on simulated tree-sequence data, nothing more. Only the things desirable (and sensible) to do within R and its limitations will be implemented. All of the tskit/pyslim functionality is accessed via the reticulate package. See a dedicated vignette for an example of the tree-sequence functionality in slendr.

• New set operations for manipulating spatial regions: join(), overlap(), subtract(). These can be used to build more complex population boundaries and geographic regions from smaller ones.

• New shiny-based interactive exploration “app”: explore(). The functions accepts a compiled slendr_model object (i.e. a formal configuration of spatial population dynamics and gene flow events) and the package will spawn a browser app with a time slider. This can be used to inspect the model spatial dynamics interactively before they are sent over to the SLiM side.

• New functions distance() (for computing distances between geographic objects), dimension() (which calculates the dimension of the world map in the “real” projected units), and area() (for calculating the geographic area covered by any spatial object) have been added.

• Simulations of marine species are now possible. This required adding a single argument aquatic = TRUE to the population() call which instructs the population range rendering procedure during compilation to "invert’ intersection with landscape features (subtracting land instead of water, which is done for terrestrial species).

• A function resize() for scheduling changes in population size (in a single step, or as an exponential growth/shrinking) is implemented.

• A new shrink() function (analogous to expand()) is implemented.

• Five new vignettes have been added (available under “Articles” at the project website.

## Nonspatial simulations

• slendr can now simulate “normal” nonspatial models. This is triggered by leaving the map = FALSE in the population() “constructor” function call. All populations descending from that population will then be nonspatial, and the whole compiled model will be run in the nonspatial model on the SLiM side. A short example vignette demonstrating this feature has been added.

## Changes to the R interface

• Renamed admixture() to geneflow().

• The number of intermediate “spatial snapshots” generated by move() and expand()/shrink() is now determined iteratively instead of forcing the user to specify this by themselves (which is something they would have to do manually anyway and was very annoying to deal with). If the user specifies the integer parameter snapshots, the search is not performed and the specified value is used to generate intermediate spatial maps.

## Changes to the SLiM backend

• Significant overhaul of the entire SLiM layer. Most importantly, complex and ugly hacks approximating dataframe behavior using SLiM matrices and custom functions are completely replaced by Dictionaries. The intention of the SLiM backend is to be as easy to understand as possible and as transparent as possible. If something could be written more elegantly or in a simpler way, please file a GitHub issue as I considered this a bug.

## Other changes

• Almost two hundred new unit tests checking the consistency of the R interface (misspecified event times, etc.) as well as the correctness of the SLiM simulation runs programmed by slendr.