- A massive update introducing the possibility of simulating non-neutral slendr models with
slim()
has been introduced. This update is too big to describe in the changelog -- for more information and motivation, see the description in the associated PR, or the new extensive vignette on the topic. (PR #155)
Implementing changes for the v1.0 release (particularly the support for non-neutral models) required changing slendr internals at a very low level across the whole codebase. Feedback on this functionality, missing features, and bug reports are highly appreciated!
Other changes:
-
The behavior previously implemented via the
output =
andts =
arguments ofslim()
(andmsprime()
) has been changed to facilitate more straightforward handling of output paths in user-defined SLiM extensions and other packages leveraging slendr for inference. Theslim()
andmsprime()
function interfaces are now simplified in the following way:slim()
: thets
argument is now logical.TRUE
switches on tree-sequence recording,FALSE
switches it off. If tree-sequence recording is on (the default setting), the function automatically returns a tree-sequence R object. If users want to save it to a custom location, they should use the functionts_write()
on the returned tree-sequence object. If customized output files are to be produced via user-defined extension scripts, those scripts can use a slendr/SLiM constantPATH
, which is always available in the built-in SLiM script and which can be set from R viaslim(..., path = <path to a directory>)
. In that case, theslim()
function always returns that path back. Crucially, in this caseslim()
will not return a tree sequence object, but that object can be loaded byts_read("<path to a directory>/slim.trees")
. In other words, nothing changes for the usual SLiM-based slendr workflow, but for models generating custom output files, a small amount of work is needed to load the tree sequence -- the tree-sequence file outputs are therefore treated exactly the same way as non-tree-sequence user-defined output files. As a result of these changes,slim()
no longer accepts aload = TRUE|FALSE
argument.
The above is implemented in PR #157.
-
ts_genotypes()
now works even for non-slendr tree sequences, which do not have slendr individual names of samples in thets_nodes()
output. (#d348ec) -
Due to frequent issues with installation of Python dependencies of slendr in a completely platform independent way (in the latest instance this being conda installation of pyslim crashing on M-architecture Macs),
setup_env()
now only uses conda to install msprime and tskit -- pyslim and tspop are always installed via pip regardless of whethersetup_env(pip = FALSE)
(the default) orsetup_env(pip = TRUE)
is used. (#408948) -
A new function
extract_parameters()
can extract parameters of either a compiled slendr model object or a tree sequence simulated from a slendr model. This can be useful particularly for simulation-based inferences where model parameters are often drawn from random distributions and there's a need to know which parameters of a model (split times, gene-flow rates, etc.) have been drawn. (#3632bd0) -
compile_model()
now allows to specify a description of time units used while scheduling slendr model events. This has purely descriptive purpose -- in particular, these units are used in model plotting functions, etc. (#9b5b7ea0) -
The
slim_script
argument ofcompile_model()
has been replaced byextension
argument, which allows users to provide their custom-designed SLiM snippets for extending the behavior of slendr's SLiM simulation engine. (#d11ac7) -
The
sim_length
argument ofcompile_model()
has been removed following a long period of deprecatiaon. (#12da50) -
When a named list of samples is used as
X
input tots_f4ratio()
, the name of the element is used in theX
column of the resulting data frame. (#0571a6) -
ts_table()
can now extract the "sites" tskit table asts_table(ts, "sites")
. (#e708f2) -
When applied to slendr tree sequences,
ts_recapitate()
no longer issues the warning:TimeUnitsMismatchWarning: The initial_state has time_units=ticks but time is measured in generations in msprime. This may lead to significant discrepancies between the timescales. If you wish to suppress this warning, you can use, e.g., warnings.simplefilter('ignore', msprime.TimeUnitsMismatchWarning)
. For slendr tree sequences, ticks are the same thing as generations anyway. (#43c45083) -
Running
slim(..., method = "gui")
was broken due to recent changes to make slendr work on Windows. A path to a generated SLiM script executed in SLiMgui was incorrectly normalized. Non-SLiMgui runs were not affected. (#ccae1df)