sim.mutationFrequencies did not produce the output I expected for FST calculation

192 views
Skip to first unread message

Katie Lotterhos

unread,
Jun 27, 2016, 9:27:30 AM6/27/16
to slim-discuss

The sim.mutationFrequencies did not produce the output I expected.  In the mutations property of genomes, it is returning each mutation when it originates.  Some of these mutations are in the same position, so this should be considered when the allele frequencies are calculated.  However, the sim.mutationFrequencies appears to be calculate the frequency for every element in genome.mutations (meaning that mutations at the same position are treated separately for allele frequency calculation if they arose at different times in the simulation).  This didn’t make sense to me. I should think that allele frequency calculation should be based on position and when the mutation arose is irrelevant. Am I missing something?


The reason I worry is that on page 119 of the users manual, these frequencies are used in an example for calculating FST.  But this calculates FST for each independent mutation, even though some of these arose independently at the same position.  In "real" data, we would calculate FST based on the observed alleles at each position, and wouldn't know whether or not those arose independently.


Also, I think there is an error in the FST calculation on this page, I think it should be pq = p1_p * (1 - p1_p) * 0.5 + p2_p * (1 - p2_p) * 0.5;


Ben Haller

unread,
Jun 28, 2016, 7:20:53 PM6/28/16
to slim-discuss
Hi Katie.  Re: the error in the manual, you are correct; whoops!  I have fixed it, although it won't appear in the published manual PDF until we roll the next release of SLiM.  Thanks for catching that problem; I should have noticed that the FST values that code was producing were way too high!  :->

Regarding the rest of what you wrote, I think Philipp plans to write a response, since he's the hard-core population geneticist.  :->  So stay tuned.

Cheers,
-B.

Ben Haller
Messer Lab
Cornell University

Philipp Messer

unread,
Jun 28, 2016, 8:25:13 PM6/28/16
to slim-d...@googlegroups.com
Hi Katie,

Thanks for catching the error in the Fst formula. As Ben already mentioned, this will be corrected in the next version of the documentation that we will upload with version 2.1. The corrected code would be:

p1_p = sim.mutationFrequencies(p1);
p2_p = sim.mutationFrequencies(p2);
p_mean = (p1_p + p2_p) / 2.0;
H_T = p_mean * (1.0 - p_mean);
H_S = 0.5 * p1_p * (1.0 - p1_p) + 0.5 * p2_p * (1.0 - p2_p);
F_ST = (H_T - H_S) / H_T;

Regarding your question about several mutations being present at the same site, this is indeed possible in SLiM and a consequence of the way in which mutations are modeled in the simulation. SLiM does not use an explicit sequence-based model, in which every site of the genome can only be one of four states: A,C,T,G. Instead, mutations remain abstract entities and the simulation does not specify the actual nature of a mutation. Per default, every mutation event simply adds a new mutation, regardless of whether there is already a mutation present in that genome at that same site (similar in spirit to an infinite sites model). You can switch this off and disregard mutations occurring when there is already a mutation present by changing the "mutationStackPolicy", as described on the bottom of page 164 in the documentation. Hope this helps.

Cheers,
Philipp

--
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 post to this group, send email to slim-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/slim-discuss/f5481869-ce3b-49d2-ada1-93fa7737a2d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Philipp W. Messer
Assistant Professor
Department of Biological Statistics and Computational Biology
Cornell University
102J Weill Hall, Ithaca, NY 14853
mes...@cornell.edu | 408-636-8701
http://messerlab.org
Reply all
Reply to author
Forward
0 new messages