pr_all_genes_survive {ibdsegments}R Documentation

Probability of passing down all autosomal genes to offspring

Description

Donnelly (1983) presents a way to efficiently calculate the probability of passing down all genes to the next generation. This includes both the paternally and maternally inherited genes, so at least two offspring are needed for this probability to be non-zero.

Usage

pr_all_genes_survive(
  number_of_children,
  chromosome_length = 267.66,
  log10 = FALSE
)

Arguments

number_of_children

How many offspring? Result is vectorised over this parameter.

chromosome_length

Default is 267.77 cM (an estimate of the length of chromosome 1). length(chromosome_length)>1, the probability of passing down all chromosomes will be computed.

log10

Should the log10 probability be returned? Default is FALSE.

Value

Numeric

References

Donnelly K. P. (1983). The probability that related individuals share some section of genome identical by descent. Theoretical population biology, 23(1), 34–63. https://doi.org/10.1016/0040-5809(83)90004-7

Examples

## Example from Donnelly (1983)
# (historic) chromosome lengths (cM) used in Donnelly (1983)
L <- 33 * c(9.12, 8.53, 7.16, 6.59, 6.15, 5.87, 5.31, 4.92, 4.81, 4.71, 4.60,
            4.47, 3.56, 3.60, 3.40, 3.20, 3.12, 2.72, 2.48, 2.27, 1.77, 1.64)

# Reproduce the "Offspring" column in Table 1
number_of_children <- 1:16
pr_survival <- pr_all_genes_survive(number_of_children, chromosome_length = L)

# Plot the results (compare to Fig. 10)
plot(number_of_children, pr_survival)

# Add the Poisson approximation
k <- 2:17 - 1
lines(k+1, exp(-k*33 / (2^k)), lty=2)

## Example using general purpose methods
# The probability of passing down all genes to k offspring is equal to the
# probability that the joint IBD state of k half siblings is 0 everywhere -
# there is no point where they all inherited the same DNA from the common
# parent.

# Define a function to create a pedigree of half siblings
ped_halfsibs <- function(number_of_half_sibs){
  ped <- pedtools::nuclearPed(nch = 1)
  for (k in 2:number_of_half_sibs) {
    ped <- pedtools::addChild(ped, parents = c(1), verbose = FALSE)
  }
  ped
}

# Compute the probability that a chromosome of length 100 cm survives
# if the next generation consists of 5 children
p1 <- pr_all_genes_survive(number_of_children = 5L, chromosome_length = 100)
p2 <- d_cibd(x = 100, ibd = 0, pedigree = ped_halfsibs(5))

p1
p2
stopifnot(all.equal(p1, p2))

# If you have five children, which fraction of chromosome 1
# is passed down to the next generation? Assume a length of 268 cM

# Pr. of passing down the complete grand-maternal and grand-paternal parts
# is 42%
pr_all_genes_survive(number_of_children = 5L, chromosome_length = 268)

# The distribution of the fraction that is passed down has a point
# mass of 0.42 at 100% and has a continuous density with weight 0.58
dist <- total_ibd_dist(ped_halfsibs(5), ibd_state = 0,
chromosome_length = 267, fraction = TRUE)
dist

plot(dist)

[Package ibdsegments version 1.0.1 Index]