markerSim: Marker simulation

View source: R/markerSim.R

markerSimR Documentation

Marker simulation

Description

Simulates marker genotypes conditional on the pedigree structure and known genotypes. Note: This function simulates independent realisations at a single locus. Equivalently, it can be thought of as independent simulations of identical, unlinked markers. For simulations of a set of markers, see profileSim().

Usage

markerSim(
  x,
  N = 1,
  ids = NULL,
  alleles = NULL,
  afreq = NULL,
  mutmod = NULL,
  rate = NULL,
  partialmarker = NULL,
  loopBreakers = NULL,
  seed = NULL,
  verbose = TRUE
)

Arguments

x

A ped object or a list of such.

N

A positive integer: the number of (independent) markers to be simulated.

ids

A vector containing ID labels of those pedigree members whose genotypes should be simulated. By default, all individuals are included.

alleles

(Only if partialmarker is NULL.) A vector with allele labels. If NULL, the following are tried in order:

  • names(afreq)

  • ‘seq_along(afreq)’

  • 1:2 (Fallback if both alleles and afreq are NULL.)

afreq

(Only if partialmarker is NULL.) A numeric vector with allele frequencies, possibly named with allele labels.

mutmod, rate

Arguments specifying a mutation model, passed on to pedtools::marker() (see there for explanations).

partialmarker

Either NULL (resulting in unconditional simulation), a marker object (on which the simulation should be conditioned) or the name (or index) of a marker attached to x.

loopBreakers

A numeric containing IDs of individuals to be used as loop breakers. Relevant only if the pedigree has loops, and only if partialmarker is non-NULL. See pedtools::breakLoops().

seed

An integer seed for the random number generator (optional).

verbose

A logical.

Details

This implements (with various time savers) the algorithm used in SLINK of the LINKAGE/FASTLINK suite. If partialmarker is NULL, genotypes are simulated by simple gene dropping, using simpleSim().

Value

A ped object equal to x except its MARKERS entry, which consists of the N simulated markers.

Author(s)

Magnus Dehli Vigeland

References

G. M. Lathrop, J.-M. Lalouel, C. Julier, and J. Ott, Strategies for Multilocus Analysis in Humans, PNAS 81(1984), pp. 3443-3446.

See Also

profileSim(), simpleSim()

Examples

x = nuclearPed(2)

# Unconditional simulation
markerSim(x, N = 2, alleles = 1:3)

# Conditional on one child being homozygous 1/1
x = addMarker(x, "3" = "1/1", alleles = 1:3)
markerSim(x, N = 2, partialmarker = 1)
markerSim(x, N = 1, ids = 4, partialmarker = 1, verbose = FALSE)


forrel documentation built on Sept. 11, 2024, 9:15 p.m.