condensedIdentity: Condensed identity coefficients

View source: R/condensedIdentity.R

condensedIdentityR Documentation

Condensed identity coefficients

Description

Computes the 9 condensed identity coefficients of pairwise relationships in a pedigree. Founders of the pedigree may be inbred; use pedtools::founderInbreeding() to set this up.

Usage

condensedIdentity(
  x,
  ids,
  sparse = NA,
  simplify = TRUE,
  self = FALSE,
  verbose = FALSE
)

Arguments

x

A pedigree in the form of a pedtools::ped object

ids

A character (or coercible to character) containing ID labels of two or more pedigree members.

sparse

A positive integer, indicating the pedigree size limit for using sparse arrays (as implemented by the slam package) instead of ordinary arrays.

simplify

Simplify the output (to a numeric of length 9) if ids has length 2. Default: TRUE.

self

A logical indicating if self-relationships (i.e., between a pedigree member and itself) should be included. FALSE by default.

verbose

A logical

Details

The implementation is a modified version of Karigl's recursive algorithm (1981).

Value

If ids has length 2 and simplify = TRUE: A vector of length 9, containing the condensed identity coefficients.

Otherwise, a data frame with 11 columns and one row for each pair of individuals. The first two columns contain the ID labels, and columns 3-11 contain the condensed identity coefficients.

References

G. Karigl (1981). A recursive algorithm for the calculation of identity coefficients. Annals of Human Genetics, vol. 45.

See Also

kappa(), identityCoefs(), pedtools::founderInbreeding()

Examples

# One generation of full sib mating.
# (One of the simplest examples with all 9 coefficients nonzero.)
x = fullSibMating(1)
j1 = condensedIdentity(x, ids = 5:6)

stopifnot(all.equal(j1, c(2, 1,4, 1, 4, 1, 7, 10, 2)/32))

# Recalculate the coefficients when the founders are 100% inbred
founderInbreeding(x, 1:2) = 1
condensedIdentity(x, ids = 5:6)


magnusdv/ribd documentation built on March 29, 2024, 5:20 a.m.