Learn R Programming

GWASExactHW (version 1.2)

HWExact: Function to calculate Hardy-Weinburg exact p-values

Description

This function calculates Hardy-Weinburg (Fisher's) exact p-values for GWAS SNP data.

Usage

HWExact(GenotypeCounts)

Value

A vector of exact p-values.

Arguments

GenotypeCounts

A dataframe of genotype counts, with columns called nAA, nAa and naa, one row for each SNP.

Author

Ian Painter

References

Wigginton, JE, Cutler, DJ, and Abecasis, GR (2005) A Note on Exact Tests of Hardy-Weinberg Equilibrium. American Journal of Human Genetics. 76

Examples

Run this code

pA<- runif(1)
pAA<- pA^2
pAa<- 2*pA*(1-pA)
paa<- (1-pA)^2

counts<- rmultinom(1000, 3000, c(pAA, pAa, paa) )
genotypes<- data.frame(nAA = counts[1,], nAa = counts[2,], naa = counts[3,])
hwPvalues<- HWExact(genotypes)

Run the code above in your browser using DataLab