Learn R Programming

gtx (version 0.0.8)

snphweCounts: Exact test of Hardy--Weinberg.

Description

Computes a p-value for the exact test of Hardy--Weinberg proportions, for genotype counts for a biallelic locus, as described by Wiggington et al. (2005).

Usage

snphweCounts(obs_hets, obs_hom1, obs_hom2)

Arguments

obs_hets
Observed count of the heterozygote genotype.
obs_hom1
Observed count of one homozygote genotype.
obs_hom2
Observed count of the other homozygote genotype.

Value

The p-value.

Details

This is the original code of Wiggington et al. (see references below), with minor modifications. The original (and perhaps counterintuitive) order of arguments has been preserved. It is better to use the snphwe wrapper function.

References

The method and algorithm used are described by Wiggington, Cutler and Abecasis (2005; A Note on Exact Tests of Hardy-Weinberg Equilibrium. American Journal of Human Genetics. 76(5):887-893) available at http://www.ncbi.nih.gov/pmc/articles/PMC1199378. The code of Wiggington et al. that is used here was downloaded from http://www.sph.umich.edu/csg/abecasis/Exact. With appropriate citation, this code is freely available for use and can be incorporated into other programs.

Examples

Run this code
snphwe(rbinom(100, 2, 0.2))

Run the code above in your browser using DataLab