Learn R Programming

ribd (version 1.1.0)

external_coefs: Relatedness coefficients by other programs

Description

Wrappers for functions in other packages or external programs, computing various relatedness coefficients.

Usage

kinship2_kinship(x, ids = NULL)

kinship2_kinshipX(x, ids = NULL)

kinship2_inbreeding(x)

kinship2_inbreedingX(x)

idcoefs(x, ids)

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

Arguments

x

A pedigree, in the form of a pedtools::ped 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 kinship2_inbreeding() and kinship2_inbreedingX(), a named numerical vector with the inbreeding coefficients and ID labels as names.

For kinship2_kinship() and kinship2_kinshipX(), either a single numeric (if ids is a pair of pedigree members) or the whole kinship matrix, with the ID labels as dimnames.

For jaquard() and jaquard2(), a numerical vector of length 9 (in the standard order of Jacquard's condensed identity coefficients).

Details

kinship2_inbreeding() and kinship2_kinship() are wrappers of kinship2::kinship() with the parameter chrtype = "autosome".

Similarly ,kinship2_inbreedingX() and kinship2_kinshipX() wrap kinship2::kinship() using chrtype = "x".

idcoefs() wraps identity::identity.coefs(), which is an R interface for the C program IdCoefs written by Mark Abney (2009). The identity.coefs() function sometimes causes R to crash, hence I have provided an alternative wrapper, idcoefs2, which executes an external call to the original C program IdCoefs (version 2.1.1). For this to work, 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 idcoefs2() wrapper works by writing the necessary files to disk and calling IdCoefs via system().

References

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

kinship2::kinship(), identity::identity.coefs()

Examples

Run this code
# NOT RUN {
# A random pedigree with 2 founders and 5 matings
p = pedtools::randomPed(g = 5, founders = 2, seed = 111)

# Check that ribd agrees with kinship2 package
kinship_k2 = kinship2_kinship(p)
kinship_ribd = kinship(p)
stopifnot(identical(kinship_k2, kinship_ribd))

# Check on X also
kinshipX_k2 = kinship2_kinshipX(p)
kinshipX_ribd = kinshipX(p)
stopifnot(identical(kinshipX_k2, kinshipX_ribd))

# }

Run the code above in your browser using DataLab