Neutral mutations during a simulation#

Note

The lists of objects described here are passed to the nregions and rates parameters when initializing instances of fwdpy11.ModelParams.

Normally, there is no need to simulate neutral mutations during a simulation. Because we record the ancestry using tree sequence recording, it is much more efficient in general to add neutral mutations when the simulation is complete. See here.

The reasons to simulate neutral variants during a simulation include:

  • Wanting to track their frequencies over time.

  • Wanting neutral mutation rates to vary along the genome. (This is only necessary due to a current limitation of fwdpy11.infinite_sites().)

The procedure is relatively simple. Variation in the neutral mutation rate is specified by different weights in instances of fwdpy11.Region.

For example, to have two regions of the same size, but the second having twice as many mutations as the first:

import fwdpy11

nregions = [fwdpy11.Region(beg=0.0, end=5.0, weight=1.0),
            fwdpy11.Region(beg=5.0, end=10.0, weight=2.0)
           ]

To specify the total mutation rate to neutral mutations, pass a non-negative float as the first element of rates. (See fwdpy11.ModelParams.)

To see neutral mutations during a simulation in action, check out this vignette.