SLiM 3.5 released

Skip to first unread message

Ben Haller

Dec 8, 2020, 2:02:27 AM12/8/20
to slim-announce
We have just released SLiM 3.5.  This is a major release, probably the biggest since 3.0.  It breaks backward compatibility/reproducibility in several ways, to allow forward progress, but the changes needed to your scripts, if any, will be extremely minimal.  Please read the following abbreviated release notes carefully; complete release notes are in the manual, chapter 29.

SLiM now provides installers for conda, for Linux platforms based on Fedora (including CentOS and RedHat Enterprise), and for the Linux platform Arch, in addition to the macOS installer.  Instructions for using all of these installers are provided in chapter 2 of the manual.  An installer for Debian-based platforms, including Ubuntu, does not yet exist as that is apparently more complex; if you know how to do that, please contribute to GitHub issue #121.  Thanks to Bryce Carson, Graham Gower, Jerome Kelleher, and Ian Caldas for help with the various installers.

In this release, the new cross-platform SLiMgui app based on the Qt framework is fully public, and is named SLiMgui on all platforms; it runs on macOS, Linux, and Windows under the WSL (thanks to Bernard Kim for figuring out the latter).  The old Cocoa-based SLiMgui app is now called SLiMguiLegacy, and is not included in the macOS installer; if you need to use it you can build it in Xcode on macOS, but it is no longer supported.  The macOS builds of the slim and eidos command-line tools in the installer are now Universal, i.e., are native on the new Apple Silicon machines as well as on Intel machines (but SLiMgui is not, since Qt has not yet been ported).

New Eidos features: tabulate() and quantile() functions similar to R; a colors() function for various color palettes; paste() / paste0() now take multiple arguments to avoid the evil paste(c(...)) pattern, but this breaks backward compatibility since sep= must now be specified as a named argument, like paste(a, b, c, sep=" "); a new Image class can read PNG images for easy spatial map creation; a new Dictionary class encapsulates SLiM's setValue()/getValue() semantics into a standalone object class (from which SLiM classes inherit to get their dictionary-like behavior); defineGlobal() allows global variables to be defined; match() is dramatically faster for large vectors; sample() is much faster for shuffles and large N, but this breaks backward reproducibility for models using sample().

New SLiM features: mutation() callbacks can now return an existing mutation for easy uniquing of mutations; a SLiMSim subsetMutations() method for fast lookup of mutations by criteria; tskit 0.3.0 integration featuring faster simplification, retention of individuals referenced by retained nodes; defineSpatialMap() now requires a matrix, and gridSize is removed, and matrices are interpreted differently (better) to match the new Image class, but all this breaks backward compatibility if you are using spatial maps; you can now keep long-term references to some SLiM classes (Chromosome & Mutation) with defineConstant(), defineGlobal(), or setValue(), and new recipes 9.9 and 9.10 show the utility of this; new LogFile class makes writing out CSV/TSV log files easy, as new recipe 4.2.5 demonstrates; pop-gen summary statistics functions calcFST(), calcVA(), calcHeterozygosity(), calcPairHeterozygosity(), calcWattersonsTheta() added; Genome methods mutationCountsInGenomes() and mutationFrequenciesInGenomes() added for easy calculation of counts/frequencies within any sample of genomes; reproductive output tracking now included when "pedigree tracking" is enabled, with new reproductiveOutput (Individual) and lifetimeReproductiveOutput (Subpopulation) properties; codonsToAminoAcids() can now return integer amino acid codes; outputFull() can now save pedigree IDs, and readFromPopulationFile can read them.

New SLiMgui features: new plots for 1D/2D SFS, 2D frequency spectrum, age distribution, population/subpop fitness distributions, population size ~ time; optional (in prefs) line numbers, current line highlighting; Jump pop-up button for quick navigation of large models; full script relayout by holding down alt/option when you click the pretty print button; automatic tree-seq simplification is now a separate category in SLiMgui profiles; optional autosave on recycle (off by default, in prefs); the Step button can now be held down to step repeatedly.

Policy changes that might break existing models: mutations can no longer be added to individuals of age > 0, to prevent internal inconsistencies; when generating gametes, mutation positions are now uniqued so you never get two new mutations at the same position in the same gamete, but this breaks backward reproducibility for almost all models; the originGeneration property of Mutation can no longer be used by models as scratch space, it must be the actual generation of origin; problems encountered during writeFile() are now errors, not warnings.

Major bug fix: the treatment of NAN values (not-a-number floating point values) in Eidos functions and comparison operators has been normalized and debugged to comply with IEEE rules and better match R's behavior.  There are a great many changes in behavior as a result, and these break backward compatibility.  If your model relied upon the behavior of NANs in Eidos you should re-validate it.  Models that do not encounter NANs should be unchanged.

Major bug fix: the precedence of operator ^ has been fixed to be higher than that of unary minus, following standard mathematical convention so that -2^2 is evaluated as (-2)^2 rather than -(2^2).  If your model relied upon the incorrect operator precedence, this breaks backward compatibility.

New recipes (besides those mentioned above): 18.4 demonstrates mutation uniquing for identity-by-state instead of identity-by-descent; 10.6 II demonstrates a second technique for varying dominance coefficients; 16.19 demonstrates range expansion into empty subpopulations in a stepping-stone model; 16.20 demonstrates logistic population growth with the Beverton-Holt model.

Revised recipes (see release notes): 5.4 (an extensive revamp of the Gravel model recipe by Chase Nelson), 13.5, 14.7, 14.8, 15.10, 15.11, 17.2, 17.4, 17.5, 17.7, 17.9, 18.13.

These notes are not comprehensive (see the manual and the GitHub history for more detail), but they provide the highlights.  This release is recommended for all users; however, since it does break backward compatibility/reproducibility in several ways, use caution when upgrading.  Look at your output files for new warnings from SLiM; re-run all runs from scratch since the results from a given random number seed may change; re-validate your model's behavior in whatever way you previously did.

You can obtain SLiM 3.5 from the SLiM home page at; note that the manuals, recipes, and reference sheets have also undergone revisions.

If you're a beginner in SLiM, you might want to check out our recent paper "Evolutionary modeling in SLiM 3 for beginners" (  Beyond that, a complete SLiM Workshop is available online at, and is highly recommended for new users.

If you have any questions, comments, etc., please use the slim-discuss group for that.  Thanks, and happy modeling!

Benjamin C. Haller
Messer Lab
Cornell University
Reply all
Reply to author
0 new messages