-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restarting simulations in SLiM engine (community.allScriptBlocks.active property) #1558
Comments
Thanks for the very thorough bug report @jmurga! @petrelharp do you see any potential issues with the solution above? e.g. do we need to handle back-compatibility with earlier slim versions? |
Looking at the help (in SLiMgui), the documentation says:
... so, it looks like the type got changed to allow more behavior (in particular, using But - I don't see any problem with this solution, no. Thanks very much for the report! |
From the 4.2 release notes:
It broke a few patterns like this; but |
Hi all, first, I want to congratulate you on such a fantastic project you're working on.
I've been using Stdpopsim to automatize sweep simulations given the time (t) at which beneficial mutation arises, the final frequency (f), and the selection coefficient (s) range that can produce such a sweep. In my approach, I solved the Otto and Whitelock 2013 Eq. 5 to approximate the time of fixation or the desired final frequency to obtain proper t and s combinations producing the expected sweep. Because SLiM + Stdpopsim restarts the simulation as much as needed, such an approximation works well (I've tested constant population size and OutOfAfrica_2T12 demography models).
I was using SLiM 4.0.1, and everything worked fine. Today, I upgraded SLiM to version 4.2.1, and the simulations don't work. I dumped the SLiM recipe and tested it in different environments in addition to trying to debug it in SLiMgui. Nonetheless, it does not work on SLiM 4.2.1 but still works on 4.0.1.
The error I obtained is the following one:
I checked the SLiM manual, and now the
community.allScriptBlocks.active
property is defined as an integer. The problem should be related to assigning a boolean value instead of an integer.I changed the line
sb[sb.type == "late"].active = F;
to sb[sb.type == "late"].active = 0;` and tested in SLiM and SLiMgui, and it works now as expected. There is no error, and I tracked the mutation frequency over time using the SLiMgui, and the beneficial mutation reached the proper frequency.How to reproduce the problem:
I am attaching a piece of code to simulate a sweep with constant population size and uniform recombination rate in a 1.2MB region. Timing, selection coefficient, and initial and final frequency are defined to produce an ongoing sweep that started ~1300 generations ago and reaches a final frequency in the range [0.8,0.9].
Suggested fixes:
The
community.allScriptBlocks.active
property seems unable to deal with boolean values now. Using 0 values asFalse
solves the problem. So, changing line 219 onslim_engine.py
is a potential solution in case I am not doing anything wrong.Best,
Jesús Murga-Moreno
The text was updated successfully, but these errors were encountered: