mutationMatrix: Mutation matrix

View source: R/mutationMatrix.R

mutationMatrixR Documentation

Mutation matrix

Description

Construct mutation matrices for pedigree likelihood computations.

Usage

mutationMatrix(
  model = c("custom", "equal", "proportional", "random", "onestep", "stepwise",
    "trivial"),
  matrix = NULL,
  alleles = NULL,
  afreq = NULL,
  rate = NULL,
  seed = NULL,
  rate2 = NULL,
  range = NULL
)

validateMutationMatrix(mutmat, alleles = NULL)

Arguments

model

A string: either "custom", "equal", "proportional", "random", "stepwise" or "onestep".

matrix

When model is "custom", this must be a square matrix with nonnegative real entries and row sums equal to 1.

alleles

A character vector (or coercible to character) with allele labels. Required in all models, except "custom" if matrix has dimnames.

afreq

A numeric vector of allele frequencies. Required in model "proportional".

rate

A number between 0 and 1. Required in models "equal", "proportional", "stepwise" and "onestep".

seed

A single number. Optional parameter in the "random" model, passed on to set.seed().

rate2

A number between 0 and 1. The mutation rate between integer alleles and microvariants. Required in the "stepwise" model.

range

A positive number. The relative probability of mutating n+1 steps versus mutating n steps. Required in the "stepwise" model.

mutmat

An object of class mutationMatrix.

Details

Descriptions of the models:

  • custom : Allows any mutation matrix to be provided by the user, in the matrix parameter.

  • equal : All mutations equally likely; probability 1-rate of no mutation.

  • proportional : Mutation probabilities are proportional to the target allele frequencies.

  • random : This produces a matrix of random numbers, where each row is normalised so that it sums to 1.

  • onestep: A mutation model for microsatellite markers, allowing mutations only to the nearest neighbours in the allelic ladder. For example, '10' may mutate to either '9' or '11', unless '10' is the lowest allele, in which case '11' is the only option. This model is not applicable to loci with non-integral microvariants.

  • stepwise: A common model in forensic genetics, allowing different mutation rates between integer alleles (like '16') and non-integer "microvariants" like '9.3'). Mutations also depend on the size of the mutation if the parameter 'range' differs from 1.

  • trivial : The identity matrix; i.e. no mutations are possible.

Value

A square matrix with entries in ⁠[0, 1]⁠, with the allele labels as both colnames and rownames.

Examples

mutationMatrix(alleles = 1:3, model = "equal", rate = 0.05)


pedmut documentation built on Nov. 5, 2023, 1:10 a.m.