sim_from_pedigree: Simulate genotypes for pedigree

View source: R/sim_from_pedigree.R

sim_from_pedigreeR Documentation

Simulate genotypes for pedigree

Description

Simulate genotypes along one chromosome for a pedigree

Usage

sim_from_pedigree(
  pedigree,
  L = 100,
  xchr = FALSE,
  m = 10,
  p = 0,
  obligate_chiasma = FALSE
)

Arguments

pedigree

Matrix or data frame describing a pedigree, with first four columns being individual ID, mom ID, dad ID, and sex (female as 0, male as 1).

L

Length of chromosome in cM (or a vector of chromosome lengths)

xchr

If TRUE, simulate X chromosome. (If L is a vector, this should be a vector of TRUE/FALSE values, of the same length as L, or a character string with the name of the X chromosome, in L.)

m

Crossover interference parameter, for chi-square model (m=0 corresponds to no interference).

p

proportion of crossovers coming from no-interference process

obligate_chiasma

If TRUE, require an obligate chiasma on the 4-strand bundle at meiosis.

Value

A list with each component being the data for one individual, as produced by the cross() function. Those results are a list with two components, corresponding to the maternal and paternal chromosomes. The chromosomes are represented as lists with two components: an integer vector of alleles in chromosome intervals, and a numeric vector of locations of the right-endpoints of those intervals; these two vectors should have the same length.

If the input L is a vector, in order to simulate multiple chromosomes at once, then the output will be a list with length length(L), each component being a chromosome and having the form described above.

See Also

check_pedigree(), sim_ril_pedigree(), sim_ail_pedigree(), sim_from_pedigree_allchr()

Examples

# simulate AIL pedigree
tab <- sim_ail_pedigree(12, 30)
# simulate data from that pedigree
dat <- sim_from_pedigree(tab)
# simulate multiple chromosomes
dat <- sim_from_pedigree(tab, c("1"=100, "2"=75, "X"=100), xchr="X")

simcross documentation built on May 29, 2024, 2:41 a.m.