# Notes: Hypergeometric Analysis # Example urn problem: http://mathworld.wolfram.com/HypergeometricDistribution.html cat("Formula: phyper(x, m, n, k)", "\n", "x: number of good items drawn from urn ", 6:0, "\n", "m: 6 good items in urn", "\n", "n: 30 bad items in urn", "\n", "k: 6 items drawn from urn", "\n") round(data.frame(good=6:0, phyper=phyper((6:0)-1,6,30,6,lower.tail = FALSE), dhyper=dhyper(6:0,6,30,6)),7) # How to implement phyper function for GO analysis # phyper(x-1, m, n-m , k, lower.tail = FALSE) # x: number of sample genes at GO node (can be vector with many entries) # m: number of genes at GO node (works with vector of same length as x) # n: number of unique genes at all GO nodes # k: number of unique genes in test sample that have GO mappings