-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Pyslim can decode tree-seq mutations from SLiM to provide the metadata for each of the stacked mutations at a site, which are all lumped together into a single "derived state" and considered to be a single mutation by the tree sequence. This decoding is useful, but could go further to provide quite a bit of extra utility.
(1) A given mutation ID might exist in several different "derived states", stacked in different ways with other mutations. When you flip through mutations with ts.mutations(), you may therefore see the same mutation ID referenced multiple times. This makes it difficult to tally up information about mutations – to assess the mean selection coefficient, say – because you first have to do a merge and unique on mutation ID. It would be great if pyslim provided a method like ts.slim_mutations() that would return a list of uniqued mutation records, one per SLiM mutation, just as one would get from sim.mutations in Eidos. One could then loop through that, each element being the metadata for that mutation. (The metadata is given again each time a mutation is listed in a derived state, by the way, and it does not have to be the same in each case, since it is just a snapshot of the state of the mutation at the moment that derived state was constructed; for the purposes proposed here, the most recent metadata for a given mutation ID ought to be provided.)
(2) If this facility were implemented, a really nice extension of it would by for pyslim to provide a frequency count for each mutation, across all extant genomes. Analysis will often want to know about mutation frequency, and figuring that out from the tree sequence in Python would be rather an adventure – requiring use of a vargen_t and then decoding derived states to extract mutation IDs and tallying up the counts for each uniqued mutation.
(3) If (2) is implemented, then one could then provide ts.slim_fixed_mutations() and ts.slim_segregating_mutations() calls, if one wished. :->
Activity