View source: R/twoLocusKinship.R
twoLocusKinship | R Documentation |
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 |
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
\phi_{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 = avuncularPed(half = TRUE)
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))
)
twoLocusPlot(peds, coeff = "kinship", lty = 1:4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.