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

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

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

A vector of exact p-values.

This function uses a C function `SNPHWE.c`

written by Jan Wigginton as described in the above reference.

Ian Painter

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

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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.