msprime
msprime copied to clipboard
add `stack_policy` argument to `SLiMMutationModel`
Currently the SLiM mutation model always stacks mutations, i.e., adds them on to existing ones. Sometimes we'd like to do something different, e.g.,:
- have a "last" stacking policy (so, there's no stacked mutations, it's just the last one that applies)
- so we can add mutations like they are for nucleotide models
However, there's one tricky thing here (and the reason we didn't do this before): say we simulate selected mutations with SLiM, then want to add neutral ones. If we allow the neutral ones to 'overwrite' the existing selected mutations then we're changing the genotypes retroactively in a non-neutral way, which is not so good. Options to deal with this:
- just trust the user to not actually put new mutations on regions having existing mutations
- do not add mutations to any site with existing mutations
- always have existing mutations take precedence
(1) seems like the simplest and most consistent with existing models, but whatever makes most sense implementation wise is good by me.
I agree, but however (1) is not actually consistent with how we use it in stdpopsim, where we want to add both selected mutations to a region in SLiM and later add neutral ones to the same regions.
I'm not thinking of a good way to do this that doesn't lose information - I'm thinking that if we want this, it should be a post-processing method available in pyslim.