Learn R Programming

jaatha (version 2.7.0)

dm.addMutation: Adds mutations to a demographic model

Description

This functions adds the assumption to the model that neutral mutations occur in the genomes at a constant rate. The rate is quantified through a parameter usually named theta in population genetics. It equals 4*N0*mu, where N0 is the effective diploid population size of population one at the time of sampling and mu is the neutral mutation rate for an entire locus.

Usage

dm.addMutation(dm, lower.range, upper.range, fixed.value, par.new = T,
  new.par.name = "theta", parameter, group = 0, variance = 0)

Arguments

dm
The demographic model to which mutations should be added
lower.range
If you want to estimate the mutation rate, this will be used as the smallest possible value.
upper.range
If you want to estimate the mutation rate, this will be used as the largest possible value.
fixed.value
If specified, the mutation rate will not be estimated, but assumed to be fixed at the given value.
par.new
If 'TRUE' a new parameter will be created using the arguments 'lower.range' and 'upper.range' or 'fixed.value'. It will be named 'new.par.name'. If 'FALSE' the argument 'parameter' will be evaluated instead.
new.par.name
The name for the new parameter.
parameter
Instead of creating a new parameter, you can also set the mutation rate to an expression based on existing parameters. For example setting this to "theta" will use an parameter with name theta that you have previously created. You can also use R expressio
group
Group of loci for with this feature is added. 0 means that the feature applies to all groups, and 1 is the default group. Set to 1 or an greater integer to set this feature only for the corresponding group of loci.
variance
Set to a value different from 0 to introduce variation in the the parameter value for different loci. The variation follows a gamma distribution with mean equal to the value provided as parameter, and variance as given here. Can also be set t

Value

  • The demographic model with mutation.

Examples

Run this code
# Create a new parameter
dm <- dm.createDemographicModel(c(25,25), 100)
dm <- dm.addSpeciationEvent(dm, 0.01, 5)
dm <- dm.addMutation(dm, 1, 20)

# Create a new fixed parameter
dm <- dm.createDemographicModel(c(25,25), 100)
dm <- dm.addSpeciationEvent(dm, 0.01,5)
dm <- dm.addMutation(dm, fixed.value=7)

# Use an existing parameter
dm <- dm.createDemographicModel(c(25,25), 100)
dm <- dm.addParameter(dm, "theta", 0.01, 5)
dm <- dm.addMutation(dm, par.new=FALSE, parameter="2*log(theta)+1")

Run the code above in your browser using DataLab