ibdsim: IBD simulation

Description Usage Arguments Details Value References Examples

View source: R/ibdsim.R

Description

This is the main function of the package, simulating the recombination process in each meioses of a pedigree. The output summarises the IBD segments between all or a subset of individuals.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ibdsim(
  x,
  N = 1,
  ids = labels(x),
  map = "decode",
  model = c("chi", "haldane"),
  skipRecomb = NULL,
  seed = NULL,
  verbose = TRUE
)

Arguments

x

A pedtools::ped() object.

N

A positive integer indicating the number of simulations.

ids

A subset of pedigree members whose IBD sharing should be analysed. If NULL, all members are included.

map

The genetic map to be used in the simulations: Allowed values are:

  • a genomeMap object, typically produced by loadMap()

  • a single chromMap object, for instance as produced by uniformMap()

  • a character, which is passed on to loadMap() with default parameters. Currently the only valid option is "decode19" (or abbreviations of this).

Default: "decode19".

model

Either "chi" or "haldane", indicating the statistical model for recombination (see details). Default: "chi".

skipRecomb

A vector of ID labels indicating individuals whose meioses should be simulated without recombination. (Each child will then receive a random strand of each chromosome.) The default action is to skip recombination in founders who are uninformative for IBD sharing in the ids individuals.

seed

An integer to be passed on to set.seed()).

verbose

A logical.

Details

Each simulation starts by unique alleles (labelled 1, 2, ...) being distributed to the pedigree founders. In each meiosis, homologue chromosomes are made to recombine according to the value of model:

Recombination rates along each chromosome are determined by the map parameter. The default value ("decode19") loads a thinned version of the recombination map of the human genome published by Halldorsson et al (2019).

In many applications, the fine-scale default map is not necessary, and should be replaced by simpler maps with constant recombination rates. See uniformMap() and loadMap() for ways to produce such maps.

Value

A list of N objects of class genomeSim.

A genomeSim object is essentially a numerical matrix describing the allele flow through the pedigree in a single simulated. Each row corresponds to a chromosomal segment. The first 4 columns describe the segment (chromosome, start, end, length), and are followed by two columns (paternal allele, maternal allele) for each of the ids individuals.

If ids has length 1, a column named "Aut" is added, whose entries are 1 for autozygous segments and 0 otherwise.

If ids has length 2, two columns are added:

References

Halldorsson et al. Characterizing mutagenic effects of recombination through a sequence-level genetic map. Science 363, no. 6425 (2019).

Examples

1
2
3
4
5
6
7
8
hs = halfSibPed()
ibdsim(hs, N = 2, map = uniformMap(M = 1), ids = 4:5)

# Full sib mating: all 9 states are possible
x = fullSibMating(1)
sim = ibdsim(x, N = 1, ids = 5:6, map = uniformMap(M = 10), seed = 1)
s = sim[[1]]
stopifnot(setequal(s[, 'Sigma'], 1:9))

ibdsim2 documentation built on Nov. 13, 2020, 5:06 p.m.