Recording mutation frequencies through time #3337
Replies: 3 comments
-
Depends what you mean here. If you mean "Is there a way to find mutation frequencies at every generation?", the answer is "no", because you've simplified, as you suspect. The way I'd do this is not by avoiding simplifying, but by Remembering all individuals alive at the times you want the frequencies at. |
Beta Was this translation helpful? Give feedback.
-
|
That answer was helpful, thank you! I will share the code I used for tracking frequencies after making the changes you suggested (although it's probably not the most efficient way). I did have a second question that arose from this one (and this may warrant a new discussion post, which I can do separately if needed). I noticed that calculating frequencies as shown below no longer works when the simulated individuals have overlapping generations. It seems that the number of samples in the tree at each generation is not straightforward if individuals are older than one generation. I found some resources for dealing with non-WF models on the tskit dev pages, but I did not see anything specifically addressing this. My follow-up question: Is it still possible to do mutation frequency calculation (per generation) for trees with overlapping generations? |
Beta Was this translation helpful? Give feedback.
-
|
I've not read your code in detail, but from what you say it sounds like a job for .... and okay, now I've read your code. I don't know what we get to assume about SLiM having put in the tree sequence enough to understand it. Have you seen the code in this thread? For instance, if there was only one mutation per site (or you were interested in only the "total derived allele frequency" per site) you could use this modified function (I think! not checked!!), for instance: It sounds like you're already doing some independent checking that you're getting the right answer. That's good, you'll need to do that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working with simplified trees generated by SLiM. I have also overlaid neutral mutations using
msprime.SLiMMutationModel.I have been able to use the Python API to find the frequencies of mutations at the final generation (i.e., the time at which the tree was recorded):
Question: Is there a way to find mutation frequencies at every generation in tree?
From what I could find in similar posts, I wonder if I might need to avoid simplifying trees in SLiM. However, I also noticed that the above code no longer returns correct frequencies when trees are not simplified, so I will have to make some adjustments. (Also, to clarify, "correct" frequencies are validated from mutation frequencies tracked during the SLiM simulation for non-neutral mutations.)
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions