markerSim: Marker simulation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/markerSim.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
markerSim(
  x,
  N = 1,
  ids = NULL,
  alleles = NULL,
  afreq = NULL,
  mutmod = NULL,
  rate = NULL,
  partialmarker = NULL,
  loopBreakers = NULL,
  eliminate = 0,
  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().

eliminate

A non-negative integer, indicating the number of iterations in the internal genotype-compatibility algorithm. Positive values can save time if partialmarker is non-NULL and the number of alleles is large.

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

1
2
3
4
5
6
7
8
9
x = nuclearPed(2)

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

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

forrel documentation built on March 14, 2021, 1:06 a.m.