relatednessCoeff: Relatedness coefficients

relatednessCoeffR Documentation

Relatedness coefficients

Description

Computes inbreeding coefficients for all pedigree members, and Jacquard's condensed identity coefficients for any pair of members. These are simple wrappers for functions in other packages or external programs.

Usage

inbreeding(x)

kinship_coefs(x, ids = NULL)

jacquard(x, ids)

jacquard2(x, ids, verbose = FALSE, cleanup = TRUE)

Arguments

x

a linkdat object.

ids

a integer vector of length 2.

verbose

a logical, indicating if messages from IdCoefs should be printed.

cleanup

a logical: If TRUE, the pedfile and sample file created for the IdCoefs run are deleted automatically.

Details

Both inbreeding and kinship_coefs are thin wrappers of kinship. jacquard2, executes an external call to the C program IdCoefs (Abney, 2009). For this to function, IdCoefs must be installed on the computer (see link in the References section below) and the executable placed in a folder included in the PATH variable. The jacquard2 wrapper works by writing the necessary files to disk and calling IdCoefs via system.

Value

For inbreeding, a numerical vector with the inbreeding coefficients, with names according to the ID labels x$orig.ids.
For kinship_coefs, either a single numeric (if ids is a pair of pedigree members) or the whole kinship matrix, with x$orig.ids as dimnames.
For jaquard and jaquard2, a numerical vector of length 9 (in the standard order of Jacquard's condensed identity coefficients).

References

The IdCoefs program: Abney, Mark (2009). A graphical algorithm for fast computation of identity coefficients and generalized kinship coefficients. Bioinformatics, 25, 1561-1563. http://home.uchicago.edu/~abney/abney_web/Software.html

See Also

kinship

Examples


# Offspring of first cousins
x = cousinsPed(1, child=TRUE)
inb = inbreeding(x)
stopifnot(inb[9] == 1/16)

# if ID labels are not 1:9, care must be taken in extracting correct elements.
set.seed(1357)
y = relabel(x, sample(1:9))
child = leaves(y)
inbreeding(y)[child] #wrong
inb = inbreeding(y)[as.character(child)] #correct
inb
# the inbreeding coeff of the child equals the kinship coeff of parents
kin = kinship_coefs(y, parents(y, child))
stopifnot(inb==kin, inb==1/16)


paramlink documentation built on April 15, 2022, 9:06 a.m.