View source: R/lumpMutSpecial.R
lumpMutSpecial | R Documentation |
This function implements methods for special, or pedigree-aware, allele
lumping. This is typically attempted if the model is not generally lumpable
as determined by alwaysLumpable()
. Note that the resulting lumped model is
tailor-made for a specific likelihood calculation, and may violate the
properties of a well-defined mutation model.
lumpMutSpecial(mut, lump, uSign, afreq = NULL, verbose = TRUE)
mut |
A square mutation matrix; typically a |
lump |
A vector containing the alleles to be lumped together. |
uSign |
The U-signature of the pedigree for which lumping is attempted. See Details. |
afreq |
A vector with allele frequencies, of the same length as the size
of |
verbose |
A logical. |
The lumping procedure depends on the location of untyped individuals in the pedigree, summarised by the so-called U-signature:
F-depth: The length of the longest chain of untyped, starting with a founder
F-width: The maximum number of children of an untyped founder
N-depth: The length of the longest chain of untyped, starting with a nonfounder
N-width: The maximum number of children of an untyped nonfounder
A reduced mutation model, if lumping was possible, otherwise the original model is returned unchanged.
lumpedModel()
.
af = rep(0.05, 20)
names(af) = 1:20
m = mutationMatrix("random", afreq = af, rate = 0.1, seed = 1)
# Degree 1 lumping
mL = lumpMutSpecial(m, lump = 3:20, uSign = c(1,1,0,0))
mL
# Check
afL = attr(mL, "afreq")
stopifnot(sum(af * m[, 1]) == sum(afL * mL[, 1]))
# Degree 2
mL2 = lumpMutSpecial(m, lump = 3:20, uSign = c(1,2,0,0))
mL2
afL2 = attr(mL2, "afreq")
stopifnot(all.equal(af %*% m[, 1]^2, afL2 %*% mL2[, 1]^2),
all.equal(af %*% m[, 2]^2, afL2 %*% mL2[, 2]^2),
all.equal(af %*% ( m[, 1]*m[, 2]),
afL2 %*% (mL2[, 1]*mL2[, 2])))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.