Thursday, December 1, 2022

SLiM 4: Multispecies eco-evolutionary modeling (a personal history)

Once upon a time, I did my PhD with Andrew Hendry at McGill.  My PhD involved writing individual-based evolutionary models of various sorts, to look at things like local adaptation, adaptive divergence between environments, and speciation.  Each model I wrote for my PhD was bespoke – a custom model, with custom C code to simulate what I wanted to look at for a given project.  (I did write a general-purpose modeling environment within which I implemented each of these bespoke models, which provided graphical visualization of the running models for me; but the models themselves were each coded by hand.)  Each model would have its own parameters, governing things like population sizes and migration rates; each would have its own implementation of some sort of genetic architecture; each would have its own approach to selection and fitness.

But now and then, Andrew would get a gleam in his eye, akin to the gleam in Gandalf's eye when he smoked his pipe and talked of strange lands and great heroes.

Gandalf's gleam in the eye

Of course Andrew would be sipping whiskey, not smoking a pipe!  And when Andrew was lost in these distant thoughts, he would sometimes speak of "One Model to rule them all".  One Model to rule them all, One Model to find them, One Model to bring them all, and in the cluster... simulate them.

The One Ring Model

What he meant, of course, was that it would be great not to need to write each new model from scratch; it would be great to have one "uber-model" which could do everything, and then each particular model that one wanted to explore would just be a particular parameterization of that uber-model.  Concepts like "migration", "selection", "population structure", and "genetic architecture" are – one could argue – general concepts that you would like to be able to code once and reuse, over and over.  Once the uber-model was written, you would never need to write a model again.

In its pure form, this idea is obviously a pipe dream; one could never write an uber-model that is so flexible, so general-purpose, so Platonic, that every other model one could imagine is just a shadow cast by the uber-model upon the cave wall.  It's an attractive vision, but there's no way it could ever be real.

And yet the idea stayed with me.  Perhaps not an uber-model, as such... but perhaps a modeling framework.  Perhaps one could write a modeling framework that would provide lots of tools and utilities, building blocks for model-building.  Writing any particular model could then just be a matter of glueing together the provided building blocks.

After my PhD, I started working with Philipp Messer at Cornell University.  Philipp had written a population-genetics simulator that he named SLiM, and he wanted somebody to improve it and maintain it.  Since 2015, I've been chugging away at improving SLiM, step by step.  It now provides a cornucopia of building blocks, for everything from genetics to spatial modeling; it provides a scripting language called Eidos with which you can glue those building blocks together in whatever way you wish; and it provides a graphical modeling environment in which you can write your Eidos scripts, run them, and see the resulting evolutionary dynamics visually as the model runs.  It's pretty widely used in population genetics (SLiM 3, SLiM 2, SLiM 1), and has enabled a lot of cool research.

SLiM's icon, with a tip of the hat to Piet Mondrian

But SLiM hasn't really been used as much as it could by people interested in evolutionary ecology, in eco-evolutionary dynamics, in predator–prey systems and host–parasite systems and things of that sort.  The reason is that SLiM didn't really have much ecology.  It started out as a population-genetics simulator and it stayed in that world for a long time.  You could simulate a biological system from the level of mutations, to genes, to chromosomes, to individuals, to subpopulations, to a whole species; but you couldn't really model more than one species, and the interactions between those species, and the coevolutionary feedbacks driven by those interactions.  So it remained a tool mostly for population genetics.

I am very pleased to announce that that era is over!  SLiM can now model evolutionary ecology: multiple species, interspecies interactions, coevolutionary dynamics, and eco-evolutionary dynamics.  It now spans the biological hierarchy from individual mutations up to not just a species, but a whole ecosystem or even a community.  I'm really, really excited to see what folks do with this; for me, this is the realization of more than a decade of dreams.

Support for multiple species was added to SLiM 4, which was released on 12 August 2022, so it has actually been available for a little while now.  I put off writing a blog post about it here until the corresponding paper was in the publication pipeline... and now it is, in the American Naturalist.  The title is "SLiM 4: Multispecies eco-evolutionary modeling".  At present you can download the paper in its "just accepted" form; it hasn't been typeset yet.  Here's the DOI:

I'm not going to say anything more about SLiM 4 and multispecies modeling, because, well, that's what the paper is for.  Of course this is not the end of the journey.  I'm sure there are lots more building blocks that will need to be written to make multispecies modeling as flexible and general as we want it to be; and there are lots of other projects too, from improving and generalizing SLiM's genetics to making SLiM run faster by utilizing multiple processors.  But ever since I started working on SLiM, my primary end goal for it has been to turn it into an ecosystem simulator – really, to try to bridge the gap between population genetics and evolutionary ecology by making it possible to simulate both in the same model.

And if this obsession with the dream of the One Model has consumed my life a bit, and turned me into a troglodyte that flinches away from the sun, well... it has all been worth it for my preciousss.

The author, with a fish.

No comments:

Post a Comment

A 25-year quest for the Holy Grail of evolutionary biology

When I started my postdoc in 1998, I think it is safe to say that the Holy Grail (or maybe Rosetta Stone) for many evolutionary biologists w...