Learn R Programming

paramlink (version 1.1-0)

inbreeding: Inbreeding coefficients and Jacquard coefficients

Description

Computes inbreeding coefficients for all pedigree members, and Jaquard'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.coeff(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.

Value

For inbreeding, a numerical vector with the inbreeding coefficients, with names according to the ID labels x$orig.ids. For kinship.coeff, 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).

Details

Both inbreeding and kinship.coeff are thin wrappers of kinship2::kinship. Similarly, jacquard wraps identity::identity.coefs, which is an R implementation of the C program IdCoefs written by Mark Abney. The function identity::identity.coefs sometimes causes R to crash, hence as an alternative wrapper, jacquard2 executes an external call to the original C program IdCoefs (version 2.1.1). Of course, this requires IdCoefs to be installed on the computer (see link in the References section below) and the executable to be in a folder included in the PATH variable. The jacquard2 wrapper works by writing the necessary files to disk and calling IdCoefs via system.

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, identity::identity.coefs

Examples

Run this code
# NOT RUN {
# 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

# the inbreeding coeff of the child equals the kinship coeff of parents
kin = kinship.coeff(y, parents(y, child))
stopifnot(inb==kin, inb==1/16)
# }

Run the code above in your browser using DataLab