Learn R Programming

HardyWeinberg (version 1.7.5)

HWData: Generate genetic marker data in or out of Hardy-Weinberg Equilibrium

Description

HWData generates samples of genotypic counts under various schemes. It mainly uses sampling from the multinomial distribution given Hardy-Weinberg allele frequencies.

Usage

HWData(nm = 100, n = rep(100, nm), f = rep(0, nm), p = NULL, conditional
= FALSE, exactequilibrium = FALSE, pdist = "runif", x.linked = FALSE, nA
= NULL,
n.males=rep(round(0.5*n),nm), ...)

Value

X

A matrix containing the genotype counts.

Arguments

nm

The number of bi-allelic markers.

n

The sample sizes.

f

The inbreeding coefficients (only for autosomal markers)

p

a vector of allele frequencies

conditional

if TRUE Haldane's distribution is used for sampling, if FALSE a multinomial distribution is used. Replaces parameter pfixed from the previous version of the package

exactequilibrium

generates data in exact HWE if set to TRUE

pdist

Take a random allele frequency from a uniform or beta distribution of pfixed = FALSE and p is not given.

x.linked

Simulated autosomal markers (x.linked=FALSE, the default) or X-chromosomal markers (x.linked=TRUE)

nA

A vector of minor allele counts, one for each marker. If not specified, it will be calculated from p

n.males

The number of males (only relevant if x.linked = TRUE)

...

specific parameters for the uniform or beta

Author

Jan Graffelman (jan.graffelman@upc.edu)

Details

The exactequilibrium option only takes effects for autosomal markers (x.linked=FALSE) and multinomial sampling (conditional=FALSE).

Option pfixed is deprecated and replaced by conditional

HWData returns a matrix of genotype counts, nm by 3 for autsomal markers or nm by 5 for X-chromosomal markers. Output is no longer supplied in the compositional form. Function HWClo can be used to convert the genotype counts to a composition.

If the inbreeding coefficient is specified (f) it will only take effect for autosomal markers (x.linked=FALSE) and multinomial sampling (conditional=FALSE).

See Also

HWTernaryPlot

Examples

Run this code
nm <- 100
n <- 100
out <- HWData(nm,n)

Run the code above in your browser using DataLab