I'm analysing nearly 20k genes using r (code below) with Fisher's exact test but the adjusted p-value using Bonferroni correction is the same as the one that came out of the exact test, please can someone tell me where it has gone wrong?
I have saved p-values, odds ratio and adjusted p-values so that they can be presented as separate columns as well.
for (i in 1:nrow(RVAS_counts)) {
ctbl <- matrix(c(RVAS_counts[i, "cases"], RVAS_counts[i, "ctrls"],
ncases - RVAS_counts[i, "cases"],
nctrls - RVAS_counts[i, "ctrls"]),
nrow = 2, byrow = FALSE)
ctable <- matrix(unlist(ctbl), 2)
fisher_result <- fisher.test(ctable, alternative="greater")
p_values[i] <- fisher_result$p.value
odds_ratios[i] <- fisher_result$estimate
adjusted_p_values[i] <- p.adjust(p_values[i], method = "bonferroni", n = leng(p_values[i]))
}
Any help is much appreciated.
Works now! Thanks