Two-locus kinship coefficients
Computes the two-locus kinship coefficient of a pair of pedigree members, at a given recombination rate.
twoLocusKinship( x, ids, rho, recombinants = NULL, verbose = FALSE, debug = FALSE )
x |
A pedigree in the form of a |
ids |
A character (or coercible to character) containing ID labels of two or more pedigree members. |
rho |
A numeric vector of recombination rates; all entries must be in the interval [0, 0.5]. |
recombinants |
A logical of length 2, applicable only when |
verbose |
A logical. |
debug |
A logical. If TRUE, detailed messages are printed during the recursion process. |
Let A, B be two pedigree members, and L1, L2 two loci with a given recombination rate rho. The two-locus kinship coefficient φ_{AB}(rho) is defined as the probability that random gametes segregating from A and B has IBD alleles at both L1 and L2 simultaneously.
The implementation is based on the recursive algorithm described by Thompson (1988).
E. A. Thompson (1988). Two-locus and Three-locus Gene Identity by Descent in Pedigrees. IMA Journal of Mathematics Applied in Medicine & Biology, vol. 5.
######################
# Example 1: Full sibs
######################
x = nuclearPed(2)
k_0 = twoLocusKinship(x, ids = 3:4, rho = 0)
k_0.5 = twoLocusKinship(x, ids = 3:4, rho = 0.5)
stopifnot(k_0 == 1/4, k_0.5 == 1/16)
##################################################
# Example 2: Reproducing Fig. 3 in Thompson (1988)
# Note that in the article, curve (a) is wrong.
# See Erratum: https://doi.org/10.1093/imammb/6.1.1
##################################################
# Pedigrees (a) - (d)
ped.a = linearPed(3)
ped.b = halfCousinPed(0, removal = 1)
ped.c = cousinPed(1)
ped.d = doubleCousins(1, 1, half1 = TRUE, half2 = TRUE)
peds = list(
a = list(ped = ped.a, ids = c(1,7)),
b = list(ped = ped.b, ids = leaves(ped.b)),
c = list(ped = ped.c, ids = leaves(ped.c)),
d = list(ped = ped.d, ids = leaves(ped.d))
)
# Recombination values
rseq = seq(0, 0.5, length = 20)
# Compute two-locus kinship coefficients
kvals = sapply(peds, function(x) twoLocusKinship(x$ped, x$ids, rseq))
# Plot
matplot(rseq, kvals, type = "l", lwd = 2)
legend("topright", names(peds), col = 1:4, lty = 1:4, lwd = 2)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.