markerSimParametric: Simulate marker data given IBD coefficients

Description Usage Arguments Details Value Examples

View source: R/pairwiseSim.R

Description

This function simulates genotypes for two individuals given their IBD distribution, for N identical markers.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
markerSimParametric(
  kappa = NULL,
  delta = NULL,
  states = NULL,
  N = 1,
  alleles = NULL,
  afreq = NULL,
  seed = NULL,
  returnValue = c("singletons", "alleles", "genotypes", "internal")
)

Arguments

kappa

A probability vector of length 3, giving a set of realised kappa coefficients (between two noninbred individuals).

delta

A probability vector of length 9, giving a set of condensed identity coefficients (Jacquard coefficients).

states

An integer vector of length N, with entries in 1-9. Each entry gives the identity state of the corresponding marker. (See details.)

N

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

alleles

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

A numeric vector with allele frequencies, possibly named with allele labels.

seed

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

returnValue

Either "singleton" (default) or "alleles". (see Value).

Details

Exactly one of kappa, delta and states must be given; the other two should remain NULL.

If states is given, it explicitly determines the condensed identity state at each marker. The states are described by integers 1-9, using the tradition order introduced by Jacquard.

If kappa is given, the states are generated by the command states = sample(9:7, size = N, replace = TRUE, prob = kappa). (Note that identity states 9, 8, 7 correspond to IBD status 0, 1, 2, respectively.)

If delta is given, the states are generated by the command states = sample(1:9, size = N, replace = TRUE, prob = delta).

Value

The output depends on the value of the returnValue parameter:

Examples

1
2
3
4
5
6
7
8
# MZ twins
markerSimParametric(kappa = c(0,0,1), N = 5, alleles = 1:10)

# Equal distribution of states 1 and 2
markerSimParametric(delta = c(.5,.5,0,0,0,0,0,0,0), N = 5, alleles = 1:10)

# Force a specific sequence of states
markerSimParametric(states = c(1,2,7,8,9), N = 5, alleles = 1:10)

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