external_coefs: Relatedness coefficients by other programs

external_coefsR Documentation

Relatedness coefficients by other programs

Description

Wrappers for functions in other packages or external programs.

Usage

kinship2_kinship(x, ids = NULL, Xchrom = FALSE)

kinship2_inbreeding(x, Xchrom = FALSE)

Arguments

x

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

ids

A integer vector of length 2.

Xchrom

A logical, indicating if the autosomal (default) or X-chromosomal coefficients should be computed.

Details

kinship2_kinship() and kinship2_inbreeding() both wrap kinship2::kinship().

Value

For kinship2_inbreeding(), a numerical vector with inbreeding coefficients, named with ID labels.

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

See Also

kinship2::kinship()

Examples

# A random pedigree with 7 individuals
p = randomPed(n = 7, seed = 123)

### Kinship matrix

# Autosomal: Check that ribd agrees with kinship2
stopifnot(identical(
  kinship(p),          # ribd
  kinship2_kinship(p)  # kinship2
))

# X chromosomal kinship
stopifnot(identical(
  kinship(p, Xchrom = TRUE),          # ribd
  kinship2_kinship(p, Xchrom = TRUE)  # kinship2
))


### Inbreeding coefficients

# Autosomal
stopifnot(identical(
  inbreeding(p),          # ribd
  kinship2_inbreeding(p)  # kinship2
))

# X chromosomal
stopifnot(identical(
  inbreeding(p, Xchrom = TRUE),          # ribd
  kinship2_inbreeding(p, Xchrom = TRUE)  # kinship2
))



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