Existing alleles incompatible with mutation model alphabet #2089
-
After recapitating a slim-generated tree using pyslim, I use sim_mutations in msprime to map neutral mutations on the recapitated tree. The slim tree is generating binary 0/1 alleles at the site(s) undergoing selective sweep(s), and in most instances the following sequence of functions generates a plausible mutated tree sequence:
However, in some instances msprime.sim_mutations() returns the following error:
Strangely, in many cases executing the sim_mutations() code a second (or third) time resolves the problem and generates output. I can't discern any pattern for when it does and doesn't work, particularly since re-running it often creates output, and the fact that the pyslim output format is the same in all cases. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi, @mshpak76! This is because mutations generated by SLiM do not have 0/1 alleles - SLiM needs to store a lot more information about the mutations. This is covered, for instance, here. The reason you get the error only sometimes is that sometimes when you add mutations, no mutations land on previously-mutated sites, and so sim_mutations never notices that there's existing alleles it doesn't know how to make sense of. So, probably what you want to do is to add mutations using the SLiM Mutation Model. However, you should think carefully about what's going on here - if you add more mutations to an already-mutated site under selection, that means that there were neutral mutations at that same site as well that didn't affect the process of selection. This might confuse your downstream analysis. |
Beta Was this translation helpful? Give feedback.
Hi, @mshpak76! This is because mutations generated by SLiM do not have 0/1 alleles - SLiM needs to store a lot more information about the mutations. This is covered, for instance, here. The reason you get the error only sometimes is that sometimes when you add mutations, no mutations land on previously-mutated sites, and so sim_mutations never notices that there's existing alleles it doesn't know how to make sense of.
So, probably what you want to do is to add mutations using the SLiM Mutation Model. However, you should think carefully about what's going on here - if you add more mutations to an already-mutated site under selection, that means that there were neutral mutations at that sam…