### Example with two loci, each with two alleles ###
# Definition of the genome
DL <- list(dl = c("A", "a"))
HL <- list(hl = c("B", "b"))
genomeObj <- setGenome(listHapLoci = HL, listDipLoci = DL)
# Three ways to define the same mutation matrix associated with the
# genome defined above:
# 1) Mutation matrix from matrices
mutHapLoci <- list(matrix(c(0.99, 0.01, 0.01, 0.99), 2))
mutDipLoci <- list(matrix(c(0.99, 0.01, 0.01, 0.99), 2))
# One can then define the MutationMatrix class object:
setMutationMatrix(genomeObj,
mutHapLoci = mutHapLoci,
mutDipLoci = mutDipLoci
)
# 2) Mutation matrix from mutation rates
mutMatrixObj <- setMutationMatrix(genomeObj, forwardMut = 0.1)
# or by adding a backward mutation rate:
mutMatrixObj <- setMutationMatrix(genomeObj,
forwardMut = 1e-3,
backwardMut = 1e-4
)
# 3) Mutation matrix from single mutation definition
mutMatrixObj <- setMutationMatrix(genomeObj,
mutations = list(
mutation(from = "A", to = "a", rate = 0.1),
mutation(from = "B", to = "b", rate = 0.1)
)
)
Run the code above in your browser using DataLab