Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

relatednessCoeff

Relatedness 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)

## S3 method for class 'coeff'
kinship(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.coeff are thin wrappers of 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.

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).

Author(s)

Magnus Dehli Vigeland

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

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.coeff(y, parents(y, child))
stopifnot(inb==kin, inb==1/16)

paramlink

Parametric Linkage and Other Pedigree Analysis in R

v1.1-2
GPL (>= 2)
Authors
Magnus Dehli Vigeland [aut, cre], Thore Egeland [ctb], Guro Doerum [ctb]
Initial release
2018-01-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.