Here is the explanation. I have around 22000 gene in 17 sample, out of 17, 7 are resistant, 5 are susceptible and remaining 5 are Intermediate. My data is in the format of 0/0, 0/1, 1/1, 0/2, 2/2 and ./.. I would like to run fisher's exact test or any other significance test to check whether there is a significant haplotype contrast between these three category. I tried to do manually in R studio for one gene with three variants ex,
Original contingency table
gene1 <- matrix(c(5,5,3,0,0,0,2,0,2),nrow = 3, dimnames= list(c("stable", "unstable", "intermediate"), c("variant0/0", "variant1/1", "variant0/1")))
Run Fisher's exact test
fisher.result_gene1= fisher.test(gene1) fisher.result_gene1 It worked but just with these three category. Meanwhile I can not do manually for 22000 genes. I was wondering if anybody can recommend me some software or any other loop in R studio.