Statistical significance of genes associated with multiple phenotypes I have a dataset of gene-phenotype association in this format. 
I am looking at some combination of phenotypes and genes shared between combination. 
I would like to use a statistical test to show that the genes shared between two phenotypes are statistically significant using a p-value or a similar measure. 
For example: 
22 genes are associated with Phenotype1 
205 genes are associated with Phenotype2 
9 genes are common between two phenotypes   

I want to assess whether the number of genes common to two phenotypes are statistically significant or just a random observation. 
I have phenotype information for 4035 genes; I assume that human genome contains 42, 071 genes
How do you address this problem (preferably in R), what statistical test you would recommend and why ? 
PS. I have asked this question previously at BioStar 
 A: I would generally use Fisher's exact test in this context.  I would focus on the genes for which you have phenotype information.
First you turn the information into a 2$\times$2 table, as follows:
                       Phenotype 1
                       asso   not asso
Phenotype 2  asso      9      196
             not asso  13     3817

In R, you'd then use the function fisher.test, as follows:
tab <- rbind(c(9, 205-9), c(22-9, 4035-22-205+9))
fisher.test(tab)

It gives a p-value of $5 \times 10^{-7}$.  
A: Probably you know this, but just in case you dint. Since you have a lot of other genes to check for and compute p-values (I guess at $\alpha = 0.05$), you should also correct for multiple testing. In R, package multtest implements this for you. 
If you have all p-values computed using fisher-test in data.frame with column x\$pvalues, then, x\$pvalues.BH computes the corrected p-values using Benjamini & Hochberg method as follows:
require(multtest)  
# pval vector contains all p-values computed from your statistical test.  
x <- data.frame(pvalues=pval)  
r <- mt.rawp2adjp( x\$pvalues, "BH")  
adjp <- r\$adjp[ order( r\$index ), ]  
r$pvalues.BH <- adjp[,2]  

