kappaIBD {ribd} | R Documentation |
IBD (kappa) coefficients
Description
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.
Usage
kappaIBD(x, ids = labels(x), inbredAction = 1, simplify = TRUE, Xchrom = FALSE)
Arguments
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. |
Details
For non-inbred individuals a and b, their autosomal IBD coefficients
are defined as follows:
The autosomal kappa coefficients are computed from the kinship coefficients. When a and b are both nonfounders, the following formulas hold:
Here denotes the kinship coefficient between the
mother of a and the father of b, etc. If either a or b is a founder,
then
, while the other two formulas remain as before.
The X-chromosomal IBD coefficients are defined similarly to the autosomal
case. Here is undefined when one or both individuals are male,
which greatly simplifies the calculations when males are involved. The
formulas are (with
now referring to the X-chromosomal
kinship coefficient):
Both male:
One male, one female:
Two females: Similar formulas as in the autosomal case.
Value
If ids
has length 2 and simplify = TRUE
: A numeric vector of
length 3: .
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.
Kappa coefficients of inbred individuals (meaning X-inbred females if
Xchrom = T
) are reported as NA, unless inbredAction = 2
.
The X-chromosomal is NA whenever at least one of the two
individuals is male.
See Also
kinship()
, identityCoefs()
for coefficients allowing inbreeding,
showInTriangle()
for plotting kappa coefficients in the IBD triangle.
Examples
### 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() |> setFounderInbreeding(ids = 2, value = 1)
plot(x, hatched = 4:5)
k = kappaIBD(x, 4:5)
stopifnot(identical(k, c(0, 1, 0)))
### X-chromosomal kappa
y = nuclearPed(2, sex = 2)
kappaIBD(y, Xchrom = TRUE)