Creating Multiple Subpopulations w/ For Loop from 2 Initial Populations

27 views
Skip to first unread message

Maeve-Darly Domond

unread,
Jul 28, 2022, 1:43:56 PM7/28/22
to slim-discuss
Hello everyone,

I'm new to bioinformatics/coding and the SLiM3 software. I have used SLiM to successfully establish 2 populations that have had beneficial mutations with zero migration over thousands of generations to model isolated species. 

In my next step, after having only beneficial mutations and zero migration for generations, I have been trying to create 100 subpopulations from both of the original two populations-50 from each-now allowing migration using the for loop in the stepping stone model in section 5.3.1 in the SLiM manual. However, I'm running into errors with the for loop mechanism saying that I cannot create other subpopulations because p1 and p2 have been established. 

Therefore, I thought the splitting subpopulations method in section 5.2.3 of the SLiM manual would be helpful because I don't run into that error but writing out the migration patterns for each of the 100 subpopulations into each other would be tedious. Is there any type of function or loop to do this? Also, because I am interested in the stepping-stone population I want to set different migration levels based on the distance between the stepping stones. Where adjacent stones have a high level of migration, skipping 1 stone has a slightly lower level of migration, and skipping two stones has the lowest level of migration. 

Ben Haller

unread,
Jul 28, 2022, 3:31:25 PM7/28/22
to Maeve-Darly Domond, slim-discuss
Hi!  You should certainly be able to do all of these sorts of things.  If you want help with a specific model or error message, it is best to post that model and error message; it's hard to guess what exactly you might have tried and what error message you might have gotten.  It sounds like most of what you're dealing with is trying to adapt the recipes in the manual to your specific situation.  That's really a programming problem, not a SLiM problem; in other words, the difficulty is not with this or that feature of SLiM, but with how to write a program (in this case in Eidos) that does what you want it to do, if I understand correctly.  To get more familiar with Eidos and how to use it, the best place to start is the SLiM Workshop, which is available for free online at http://benhaller.com/workshops/workshops.html.  I would recommend that you work through that, which should take perhaps 3-5 days of work, and then try to re-approach your problem.  Hopefully it will be much more clear how to do what you want to do.  If not, please feel free to ask again on this list (with a specific script and error message that we can start from).  Good luck, and happy modeling!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Maeve-Darly Domond wrote on 7/28/22 1:43 PM:
--
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/ae669a74-0d11-4f0b-a629-d8d76857a212n%40googlegroups.com.

Maeve-Darly Domond

unread,
Jul 28, 2022, 3:50:35 PM7/28/22
to slim-discuss
Hi Ben,

Thank you so much! I do think I am struggling with how to adapt the models to my specific situation so I will definitely look into the link you have provided. If I have any more questions, I'll make sure to post my code and error messages here. 

Best,
Maeve

Ben Haller

unread,
Jul 28, 2022, 4:04:43 PM7/28/22
to Maeve-Darly Domond, slim-discuss
Hi Maeve,

One followup note.  Depending on how new you are to programming (I notice you wrote below that you are "new to bioinformatics/coding" – does that mean you haven't done it at all before, or you just haven't done it in the context of bioinformatics?), you might want to even take a step back from SLiM and do some kind of introductory programming class or something first.  Eidos is a lot simpler than most programming languages, but programming is a strange and difficult enterprise even when using a fairly simple language.  :->  I'm not sure what sort of intro to recommend, though.  Eidos is most similar to R, really (by design), but most "intro to R" books will teach you how to do stats in R without teaching you much about programming in R.  I don't know.  The Eidos manual is written (by me) with the goal of being reasonably accessible and instructional, but it's not really an "introduction to programming" course.  Anyhow, food for thought.  I think I would recommend that you start with the SLiM workshop as I said, and if you find that it does not help you on the programming aspect of things as much as you need, then think about what other resources might be available.  Maybe the best thing would really be to find somebody else, in your lab or your department, who has substantial experience with programming and can help you when you get stuck on a programming problem; my goal on this list is to be helpful, but I can't really provide the kind of detailed assistance that might be needed to help someone who has never programmed before learn how.  (Of course, please forgive me if I have misunderstood and that is not, in fact, your situation.)  In fact, if there's somebody else who might like to do the SLiM Workshop together with you, and who has coded before, that would be ideal!  Anyhow, best of luck.  Once you get into it, it turns out to be quite fun, in my opinion, so stick with it.  :->


Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Maeve-Darly Domond wrote on 7/28/22 3:50 PM:

Maeve-Darly Domond

unread,
Aug 8, 2022, 12:09:17 AM8/8/22
to slim-discuss
Hello Dr. Haller,

Thank you for your help and assistance since I'm new to both coding and the SLiM bioinformatics environment. I had a quick question but couldn't find functions in the manual that did this: after using the "initializeMutationRate(1e-5)" in the initialize phase can you alter the mutation rate to have a different value with a code such as, "modifyMutationRate(1e-7)", or something like this?

Best,
Maeve-Darly Domond

Ben Haller

unread,
Aug 8, 2022, 7:26:46 AM8/8/22
to Maeve-Darly Domond, slim-discuss
Hi Maeve!

You want the setMutationRate() method of Chromosome.  In practice:

sim.chromosome.setMutationRate(1e-7);

See section 24.2.2 of the manual, p. 568 I believe in the SLiM 3.7.1 manual.  If you want the mutation rate to vary among individuals, depending perhaps upon their genetics, you can use a mutation() callback to achieve effects like that (or you can generate mutations yourself in particular individuals as desired), but it sounds like those approaches would be overkill for what you're trying to do.  :->  Happy modeling!


Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Maeve-Darly Domond wrote on 8/8/22 12:09 AM:

Maeve-Darly Domond

unread,
Aug 8, 2022, 1:04:22 PM8/8/22
to slim-discuss
Hi,

Thank you Dr. Haller for the assistance! That makes sense.

Best,
Maeve-Darly Domond

Reply all
Reply to author
Forward
0 new messages