mutationModel {pedmut} | R Documentation |
Mutation models
Description
Constructor for the class mutationModel
. An object of this class is
essentially a list of two mutation matrices, named "female" and "male".
Usage
mutationModel(
model,
alleles = NULL,
afreq = NULL,
matrix = NULL,
rate = NULL,
rate2 = NULL,
range = NULL,
seed = NULL,
validate = TRUE
)
validateMutationModel(mutmod, alleles = NULL)
sexEqual(mutmod)
Arguments
model |
Either:
|
alleles |
A character vector with allele labels; passed on to
|
afreq |
A numeric vector of allele frequencies; passed on to
|
matrix |
A matrix, or a list of two (named "female" and "male") |
rate |
A numeric mutation rate, or a list of two (named "female" and "male") |
rate2 |
A numeric mutation rate, or a list of two (named "female" and
"male"). Required in the "stepwise" model; see |
range |
A positive number, or a list of two (named "female" and "male").
Required in the "stepwise" model; see |
seed |
An integer, or a list of two (named "female" and "male"). |
validate |
A logical, by default TRUE. |
mutmod |
A |
Value
An object of class mutationModel
. This is a list of two
mutationMatrix
objects, named "female" and "male", and the following
attributes:
-
sexEqual
: TRUE if both genders have identical models, otherwise FALSE -
alwaysLumpable
: TRUE if both genders have models that are lumpable for any allele subset, otherwise FALSE
Examples
# "Equal" model, same parameters for both genders
M1 = mutationModel("eq", alleles = 1:2, rate = 0.1)
M1
# Different mutation rates
M2 = mutationModel("eq", alleles = 1:2, rate = list(male = 0.1, female = 0.01))
M2
stopifnot(identical(M1$male, M1$female), identical(M2$male, M1$male))
# A custom mutation matrix:
mat = matrix(c(0,0,1,1), ncol = 2, dimnames = list(1:2, 1:2))
M3 = mutationModel(model = "custom", matrix = mat)
# Under the hood arguments are passed to `mutationMatrix()`.
# Alternatively, this can be done explicitly in the `model` argument
M4 = mutationModel(model = mutationMatrix("custom", matrix = mat))
stopifnot(identical(M3, M4))
# The latter strategy is needed e.g. in pedtools::marker(), which gives the
# user access to `model`, but not `matrix`.