d_ibd {ibdsegments}R Documentation

Compute probability of IBD for pedigree members

Description

The d_ibd function computes the likelihood of IBD for one position or multiple linked markers on the same chromosome.

Usage

d_ibd(
  ibd,
  pedigree,
  ids = pedtools::leaves(pedigree),
  recombination_rate_by_locus = numeric(),
  states = "ibd",
  log10 = FALSE
)

Arguments

ibd

Integer vector. Taking values 0, 1, 2 for states = "ibd" or states = "kappa", 1, ..., 9 for states="identity" and 1, ..., 15 for states = "detailed".

pedigree

Pedigree in pedtools::ped form.

ids

Ids for which IBD is observed. Defaults to pedtools::leaves(pedigree).

recombination_rate_by_locus

Numeric vector with length one shorter than ibd.

states

One of "ibd" (default), "kappa", "identity" or "detailed".

log10

Should the log10 likelihood be returned? Default is FALSE.

Value

Numeric

Examples

# Compute kappa0, kappa1, kappa2 for full siblings
ped_fs <- pedtools::nuclearPed(nch = 2)

k0 <- d_ibd(ibd = 0, pedigree = ped_fs)
k1 <- d_ibd(ibd = 1, pedigree = ped_fs)
k2 <- d_ibd(ibd = 2, pedigree = ped_fs)
c(k0, k1, k2)

stopifnot(identical(c(k0, k1, k2), c(0.25, 0.5, 0.25)))

# Compute kappa00 for two tightly linked loci
d_ibd(c(0,0), pedigree = ped_fs,
       recombination_rate_by_locus = c(0.01))

# or 100 tightly linked loci
d_ibd(rep(0, 100), pedigree = ped_fs,
               recombination_rate_by_locus = c(rep(0.01, 99)))

# Jacquard's 9 condensed and 15 detailed identity coefficients
ped_fs_mating <- pedtools::fullSibMating(1)

sapply(1:9, d_ibd, pedigree = ped_fs_mating, states = "identity")
sapply(1:15, d_ibd, pedigree = ped_fs_mating, states = "detailed")

[Package ibdsegments version 1.0.1 Index]