Hardy-Weinberg equilibrium test
genetics package
Hardy-Weinberg equilibrium test can be performed using the genetics package.
load("~/Dropbox/chikudaisei/teaching/2018/ASCI431-831/day04/W.Rda")
install.packages("genetics")
library(genetics)
# Use only the first 200 SNPs
Wsub <- W[,1:200]
G <- makeGenotypes(Wsub, convert = c(colnames(Wsub)), method = as.genotype.allele.count)
?HWE.chisq
# testing for the 3rd SNP
HWE.chisq(G[,3])