# Function to calculate Hardy-Weinburg exact p-values

### Description

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

### Usage

1 | ```
HWExact(GenotypeCounts)
``` |

### Arguments

`GenotypeCounts` |
A dataframe of genotype counts, with columns called |

### Value

A vector of exact p-values.

### Note

This function uses a C function `SNPHWE.c`

written by Jan Wigginton as described in the above reference.

### Author(s)

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

1 2 3 4 5 6 7 8 | ```
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)
``` |