The subroutines below implement a fast exact Hardy-Weinberg Equilibrium test for SNPs as described in Wigginton, et al. (2005). This test is based on an efficient algorithm for enumerating the exact heterozygote probability distribution conditional on the number of minor alleles present in the sample. It adequately controls Type I error rates within large and small samples and is suitable for use in large-scale studies of SNP data. With appropriate citation, these routines are freely available for your use and can be incorporated into other programs.
If you'd rather run the test and see a summary of your results without writing code, the exact test of HWE is implemented in the program Pedstats along with an asymptotic chi-square test for microsatellites. A description of both tests can be found in the Pedstats tutorial
If you use this code, please e-mail Jan Wigginton firstname.lastname@example.org or fill out the registration form.
SNP-HWE (Fortran) SNP-HWE (C/C++) SNP-HWE (R) snp_hwe.pl (PERL) (courtesy Josh Randall in Oxford)