Compute the matrix of kinship coefficients (autosomal or X) of all members of
a pedigree. The founders may be inbred; see pedtools::founderInbreeding()
for how to set this up.
kinship(x, ids = NULL)kinshipX(x, ids = NULL)
A pedigree, in the form of a pedtools::ped
object.
Either a character of length 2, or NULL. In the former case, it
must contain the ID labels of two members of x
, and the function will return
their kinship coefficient as a single number. If ids
is NULL (this is the
default), the output is the complete kinship matrix.
If ids = NULL
, a symmetric matrix containing all pairwise kinship coefficients in
x
.
If ids
has length 2, the function returns a single number.
For two (not necessarily distinct) members A, B of a pedigree, their autosomal (resp. X) kinship coefficient is defined as the probability that random alleles sampled from A and B at the same autosomal (resp. X) locus, are identical by descent relative to the pedigree.
# NOT RUN {
# Kinship coefficients in a nuclear family with two children
x = nuclearPed(2)
kinship(x)
# X chromosomal kinship coefficients in the same family
kinshipX(x)
# Recalculate the autosomal kinships if the father is 100% inbred
founderInbreeding(x, 1) = 1
kinship(x)
# }
Run the code above in your browser using DataLab