msprime icon indicating copy to clipboard operation
msprime copied to clipboard

add `stack_policy` argument to `SLiMMutationModel`

Open petrelharp opened this issue 3 years ago • 3 comments

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:

  1. just trust the user to not actually put new mutations on regions having existing mutations
  2. do not add mutations to any site with existing mutations
  3. always have existing mutations take precedence

petrelharp avatar Sep 30 '22 04:09 petrelharp

(1) seems like the simplest and most consistent with existing models, but whatever makes most sense implementation wise is good by me.

jeromekelleher avatar Sep 30 '22 10:09 jeromekelleher

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.

petrelharp avatar Sep 30 '22 22:09 petrelharp

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.

petrelharp avatar Sep 30 '22 22:09 petrelharp