ip_Fij: Partial inbreeding coefficient

View source: R/partial.R

ip_FijR Documentation

Partial inbreeding coefficient

Description

Computes partial inbreeding coefficients, Fi(j). A coefficient Fi(j) can be read as the probability of individual i being homozygous for alleles derived from ancestor j. It is calculated following the tabular method described by Gulisija & Crow (2007). Optionally, it can be estimated via genedrop simulation.

Usage

ip_Fij(
  ped,
  mode = "founders",
  ancestors = NULL,
  Fcol = NULL,
  genedrop = 0,
  seed = NULL,
  ncores = 1L
)

Arguments

ped

A dataframe containing the pedigree. Individual (id), maternal (dam), and paternal (sire) identities are mandatory columns.

mode

Defines the set of ancestors considered when computing partial inbreeding. It can be set as: "founder" for inbreeding conditional to founders only (default), "all" for all individuals in the pedigree (it may take long to compute in large pedigrees), and "custom" for individuals identities given in a integer vector (see 'ancestors' argument).

ancestors

Under the "custom" run mode, it defines a vector of ancestors that will be considered when computing partial inbreeding values.

Fcol

Name of column with inbreeding coefficient values. If none is used, inbreeding will be computed.

genedrop

Number of genedrop iterations to run. If set to zero (as default), exact coefficients are computed.

seed

Sets a seed for the random number generator (only if genedrop is enabled).

ncores

Number of cores to use for parallel computing (default = 1)

Value

A matrix of partial inbreeding coefficients. Fi(j) values can thus be read from row i and column j. In the resultant matrix, there are as many rows as individuals in the pedigree, and as many columns as ancestors used. Columns will be named and sorted by ancestor identity.

References

  • Gulisija D, Crow JF. 2007. Inferring purging from pedigree data. Evolution 61(5): 1043-1051.

See Also

ip_F

Examples

# Original pedigree file in Gulisija & Crow (2007)
pedigree <- tibble::tibble(
  id = c("M", "K", "J", "a", "c", "b", "e", "d", "I"),
  dam = c("0", "0", "0", "K", "M", "a", "c", "c", "e"),
  sire = c("0", "0", "0", "J", "a", "J", "b", "b", "d")
)
pedigree <- purgeR::ped_rename(pedigree, keep_names = TRUE)

# Partial inbreeding relative to founder ancestors
m <- ip_Fij(pedigree)
# Note that in the example above, the sum of the values in
# rows will equal the vector of inbreeding coefficients
# i.e. base::rowSums(m) equals purgeR::ip_F(pedigree)$Fi

# Compute partial inbreeding relative to an arbitrary ancestor
# with id = 3 (i.e. individual named "J")
anc <- as.integer(c(3))
m <- ip_Fij(pedigree, mode = "custom", ancestors = anc)

purgeR documentation built on Aug. 16, 2023, 9:07 a.m.