Mirroring Sequence of Events in an Evolve and Resequence Experiment

31 views
Skip to first unread message

Nathan Anderson

unread,
Jul 5, 2021, 3:03:36 PM7/5/21
to slim-discuss
Hi Ben

I am attempting to simulate a null model for an evolve and re sequence experiment. In this experiment the population was genotyped at generation 0 (before selection regimes start) and at generation 6 and 10. I am having trouble wrapping my head around which generation number in SLiM corresponds to what generation in the actual experiment.

In SLiM, I am initializing standing genetic variation in generation 1 late(), (reading in a csv of snp frequencies and selection coefficients then adding these mutations to the population using addNewMutation()). So, generation 1 in SLiM corresponds to generation 0 in the E&R. The snp frequencies match and selection has not acted yet. 

Here is where I am getting confused. If I understand correctly, the new mutations added will not influence the generation of generation 2. Generation 3 is the first born under the influence of the the selected snps added in generation 1. 

In this case, generation 3 in SLiM corresponds with generation 1 in the E&R (the first generation born under the selection regime). And there is a generation of drift (generation 2 in SLiM) between when the SNPs are added and when they are selected on? Or do the snp frequencies not change between generation 1 and 2 because they were added in a late() event, after "Offspring become parents" in the WF sequence of events.

Also, should snp frequencies be output in the early() or late() event? If generation 3 is the first generation born under selection, I would want to output in generation 8 to capture the snp frequencies after 6 generations of the selection regime. I would want to output this during an early() event, before the offspring from generation 8 are generated, correct?

Can you help me wrap my head around this?
Nathan 

Ben Haller

unread,
Jul 6, 2021, 9:53:42 AM7/6/21
to slim-discuss
Hi Nathan!  OK, so, I take it this is a WF model, since you refer to "the WF sequence of events".  I don't know anything about E&R experiment design, so I'm not going to make any reference to that at all (for fear of saying something incorrect), but I'll try to clarify SLiM's behavior.

So, the reference for WF models is the generation cycle diagram in chapter 22.  If you create and initialize a subpopulation in generation 1 late(), you can see that the very next thing to happen is calculation of fitnesses; so the standing genetic variation that you set up will affect the fitness values of individuals at that point.  Then generation 1 ends.  In generation 2 in SLiM, you will then get early() events, and then generation of offspring following the Wright-Fisher model's procedure (detailed in section 22.2), using the fitness values calculated at the end of generation 1.  So at early() event time in generation 2, you still have the same initial individuals that you created initially; at late() event time in generation 2, reproduction has occurred, the parental generation has died, and the child generation has taken its place, generated under the influence of the fitness effects calculated initially. Then, after late() events in generation 2, the fitness values of those new offspring are calculated, ready for the next round of reproduction in generation 3.

So when you write that "If I understand correctly, the new mutations added will not influence the generation of generation 2. Generation 3 is the first born under the influence of the the selected snps added in generation 1.", that is not correct.  Similarly, "generation 3 in SLiM corresponds with generation 1 in the E&R" does not seem correct, nor "And there is a generation of drift (generation 2 in SLiM) between when the SNPs are added and when they are selected on".  I'm not sure what gave this impression that there would be a generation of drift; please let me know if there's an error in the manual or the workshop somewhere that needs to be corrected.  (If you create your initial subpop in a WF model in an *early()* event, then – as the generation cycle diagram shows – you *do* get one round of reproduction before fitness values are ever recalculated.  Creating a non-neutral initial generation in an early() event in a WF model is therefore bad practice, and ought to result in a warning message from SLiM.)

This should also make clear when you want to output SNP frequencies.  If you do it in an early() event, then the generation 2 early() event would output SNPs from the initial population, prior to reproduction.  If you do it in a late() event, then the generation 2 late() event would output SNPs from the next generation, after the initial population has reproduced.  Which of those you want is up to you.  :->  (Maybe it's also worth nothing that if you do it as a late() event without a 2: late() declaration, that event will also run in generation 1; whether it runs before the initial subpopulation is even created, or immediately after it is created, is a matter of what order the events are declared in your script.)

In general, the generation cycle diagrams in chapters 22 and 23 are your friend.  :->  They tell you exactly what happens when, in what order, so if you ever have questions like this you should be able to consult the diagram for your model type to figure it out.  :->  Good luck!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Nathan Anderson

unread,
Jul 7, 2021, 6:54:53 PM7/7/21
to slim-discuss
Hi Ben 

Thank you for your quick response. 

I do not think that you have any mistakes in the manual, rather I was confusing myself. 

I believe my confusion stemmed from "So at early() event time in generation 2, you still have the same initial individuals that you created initially [in late() generation 1]", I was under the impression that early() generation 2 would be the offspring of the initial population. This would have been a problem (if i were not mistaken) because these offspring would have been made during the offspring production phase in generation 1, prior to the selected SNPs being added.

Just to be clear, if I wanted to output the frequencies for the offspring of the initial population, I could either output during 2 late() or a 3 early() event? 

Thank you for your very detailed response to my rather silly question.
Nathan

Ben Haller

unread,
Jul 7, 2021, 11:04:33 PM7/7/21
to slim-discuss
Hi Nathan,

"This would have been a problem (if i were not mistaken) because these offspring would have been made during the offspring production phase in generation 1, prior to the selected SNPs being added."  As long as you are both creating the new subpop and adding the SNPs in a 1 late() event, there will be no offspring production phase in generation 1; that occurs before late() events execute, so there is not yet a subpop to reproduce.  If you created the new subpop in 1 early() and then added the SNPs in 1 late(), there would be a problem, of course; don't do that.  :->

"Just to be clear, if I wanted to output the frequencies for the offspring of the initial population, I could either output during 2 late() or a 3 early() event?"  In a Wright-Fisher type model in SLiM, the population state will be the same at both of those time points, assuming you're not doing other things in 2 late() or 3 early() that potentially modify that state in a way that matters.  You could generate output at either time.  The only difference is that in 2 late(), sim.generation will still equal 2, while in 3 early() it will equal 3.  I usually suggest doing output in a late() event, because I find it more conceptually coherent (it's weird to see the state of the second generation as a snapshot taken in generation *3*; that just leads to confusion); but you can do as you like.

Good luck!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


Nathan Anderson

unread,
Jul 13, 2021, 1:34:27 PM7/13/21
to slim-discuss
Hi Ben

I think I understand now, your explanations were very helpful.

Thanks for your help!
Nathan
Reply all
Reply to author
Forward
0 new messages