kappaIBD | R Documentation |
Computes the three IBD coefficients summarising the relationship between two
non-inbred individuals. Both autosomal and X chromosomal versions are
implemented. The pedigree founders (other than the individuals in question)
are allowed to be inbred; see pedtools::founderInbreeding()
for how to set
this up, and see Examples below.
kappaIBD(x, ids = labels(x), inbredAction = 1, simplify = TRUE, Xchrom = 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. |
inbredAction |
An integer telling the program what to do if either of
the |
simplify |
Simplify the output (to a numeric of length 3) if |
Xchrom |
A logical, indicating if the autosomal (default) or X-chromosomal kappa coefficients should be computed. |
For non-inbred individuals a and b, their autosomal IBD coefficients
(\kappa0, \kappa1, \kappa2)
are defined as follows:
\kappa_i =
P(a and b share exactly i alleles IBD at a random autosomal locus)
The autosomal kappa coefficients are computed from the kinship coefficients. When a and b are both nonfounders, the following formulas hold:
\kappa2 = \phi_MM * \phi_FF + \phi_MF * \phi_FM
\kappa1 = 4 * \phi_ab - 2 * \kappa2
\kappa0 = 1 - \kappa1 - \kappa2
Here \phi_MM
denotes the kinship coefficient between the mothers of a
and b, and so on. If either a or b is a founder, then \kappa2 = 0
,
while the other two formulas remain as above.
The X-chromosomal IBD coefficients are defined similarly to the autosomal
case. Here \kappa2
is undefined when one or both individuals are male,
which greatly simplifies the calculations when males are involved. The
formulas are (with \phi_ab
referring to the X-chromosomal kinship
coefficient):
Both male: (\kappa0, \kappa1, \kappa2) = (1-\phi_ab, \phi_ab, NA)
One male, one female: (\kappa0, \kappa1, \kappa2) = (1-2*\phi_ab,
2*\phi_ab, NA)
Two females: Similar formulas as in the autosomal case.
If ids
has length 2 and simplify = TRUE
: A numeric vector of
length 3: (\kappa0, \kappa1, \kappa2)
.
Otherwise: A data frame with one row for each pair of individuals, and 5 columns. The first two columns contain the ID labels, and columns 3-5 contain the IBD coefficients.
Unless inbredAction = 2
, the coefficients of pairs involving inbred
individuals (X-inbred females if Xchrom = T
) are reported as NA.
Furthermore, the X-chromosomal \kappa2
is NA whenever at least one of
the two individuals is male.
kinship()
, identityCoefs()
### Siblings
x = nuclearPed(2)
kappaIBD(x)
k = kappaIBD(x, 3:4)
stopifnot(identical(k, c(.25, .5, .25)))
### Quad half first cousins
x = quadHalfFirstCousins()
k = kappaIBD(x, ids = leaves(x))
stopifnot(identical(k, c(17/32, 14/32, 1/32)))
### Paternal half brothers with 100% inbred father
# Genetically indistinguishable from an (outbred) father-son relationship
x = halfSibPed()
ids = 4:5
# Set founder inbreeding
fou = commonAncestors(x, ids) # robust to label change
founderInbreeding(x, fou) = 1
k = kappaIBD(x, ids)
stopifnot(identical(k, c(0, 1, 0)))
### X-chromosomal kappa
y = nuclearPed(2, sex = 2)
kappaIBD(y, Xchrom = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.