twoLocusKinship: Two-locus kinship coefficients

View source: R/twoLocusKinship.R

twoLocusKinshipR Documentation

Two-locus kinship coefficients

Description

Computes the two-locus kinship coefficient of a pair of pedigree members, at a given recombination rate.

Usage

twoLocusKinship(
  x,
  ids,
  rho,
  recombinants = NULL,
  verbose = FALSE,
  debug = FALSE
)

Arguments

x

A pedigree in the form of a pedtools::ped object.

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 ids has length 2. When given, it indicates whether each of the two gametes is a recombinant or non-recombinant. This parameter is mainly used by twoLocusIBD().

verbose

A logical.

debug

A logical. If TRUE, detailed messages are printed during the recursion process.

Details

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).

References

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.

Examples

######################
# 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)


magnusdv/ribd documentation built on March 29, 2024, 5:20 a.m.