4
$\begingroup$

I have two lists of genes as follows:

  • DEList has 282 gene names
  • AllList has 32805 gene names
  • DEList is a subset of AllList.

In both lists I've looked for genes which have a specific parameter (e.g. binding site for pol3 and binding site for pol2). The results of this search is in the table below.

  • pol3DE 4
  • pol2DE 190
  • pol3all 85
  • pol2all 12365

pol3DE and pol2DE are both subsets of the list DEList with the specific parameter binding site for pol3 and binding site for pol2 respectively. pol3all and pol2all are both subsets of the list AllList with the same specific parameters as above.

I would like to calculate the p-value to see if a higher proportion of pol2-specific genes are in the DEList than the AllList, and likewise for the pol3-specific genes in DEList relative to AllList.

If I understand it correctly I have six different parameters:

  • AllList - 32805
  • DEList - 282
  • pol3DE - 4
  • pol2DE - 190
  • pol3all - 85
  • pol2all - 12365

How do I create the contingency table for the Fisher's exact test in this case?

Can I even use the Fisher's exact test for that, or do I need to use a different one (Xi square, equality of proportion)?

EDIT:

What I would like to know is not the significance of each group on its own, but whether or not the proportion of of pol2 in the comparison DEList relative to AllList is higher than the proportion of pol3 for the same comparison. So Just making two McNemar tests wouldn't really solve the problem, unless I can compare the two p-values. I have run the two tests and both p-values are very low, i.e. supposedly significant, but what about against each other. Is there a way to compare this?

pol3 = as.table(rbind(c(32720, 0), 
                      c( 81, 4) ))
colnames(pol3) <- rownames(pol3) <- c("No", "Yes")
names(dimnames(pol3)) = c("all", "DE")
pol3
mcnemar.test(pol3, correct=FALSE)

     McNemar's Chi-squared test

data:  pol3
McNemar's chi-squared = 81, df = 1, p-value < 2.2e-16

pol2 = as.table(rbind(c(32720, 0), 
                      c( 81, 4) ))
colnames(pol2) <- rownames(pol2) <- c("No", "Yes")
names(dimnames(pol2)) = c("all", "DE")
pol2
mcnemar.test(pol2, correct=FALSE)

McNemar's Chi-squared test

data:  pol2
McNemar's chi-squared = 81, df = 1, p-value < 2.2e-16
$\endgroup$
6
  • $\begingroup$ If I understand correctly, this is a software question. What software are you using (e.g., R, Python, SPSS, Excel)? What form is the data in currently? $\endgroup$ Mar 11, 2015 at 16:06
  • $\begingroup$ I would use R if possible. The data is a text file. $\endgroup$ Mar 11, 2015 at 16:28
  • 1
    $\begingroup$ Can a gene be in both pol2 & pol3? $\endgroup$ Mar 18, 2015 at 16:15
  • $\begingroup$ usually not. They might be cases that this is the case, but we take it as if it is not happening $\endgroup$ Mar 19, 2015 at 16:25
  • $\begingroup$ @AssaYeroslaviz, for me to know that you've responded to my comment, you need to put the "@" symbol & then my name (as I did for you at the beginning). $\endgroup$ Mar 22, 2015 at 2:54

1 Answer 1

2
$\begingroup$

You would make a table with four cells ($2\times 2$). In the top row, you would put the numbers in the subsets. In the bottom row, put the numbers not in the subsets (i.e., the total counts minus the subset counts). Be sure that the same sets are grouped in the same columns (i.e., both pol3's are in the left column and both pol2's are in the right column), and you are good to go.


Edit:
OK, if I understand correctly now, what you need is actually two tests:

  1. Is the proportion of pol2's in DEList higher than the proportion of pol2's in AllList? And,
  2. The same for pol3s.

If this is correct, you need to run two tests, not one. Secondly, you don't want to use Fisher's exact test, because this is a test of whether the two variables are related, not whether the proportions are the same. Instead, you want McNemar's test. (To understand this more fully, it may help you to read my answer here: What is the difference between McNemar's test and the chi-squared test, and how do you know when to use each?)


Edit 2: If I understand your question correctly now (which is not clear), your data look like this:

tab
#        pol2  pol3 neither
# DE      190     4      88
# notDE 12175    81   20267

At this point, you want to know if 4/81 / 88/20267 differs from 190/12175 / 88/20267. Since both denominators are the same, the question reduces to asking if 4/81 differs from 190/12175. You can test this with a simple chi-squared test:

chisq.test(tab[,1:2])
#  Pearson's Chi-squared test with Yates' continuity correction
# 
# data:  tab[, 1:2]
# X-squared = 3.6548, df = 1, p-value = 0.05591
# 
# Warning message:
# In chisq.test(tab[, 1:2]) : Chi-squared approximation may be incorrect

Because the proportions in the third column might differ from the first two (but which isn't of theoretical interest), I am running the chi-squared test only on the first two columns. I notice that R throws a warning here. That typically happens when you have cells with an expected value less than $5$. We can check this:

chisq.test(tab[,1:2])$expected
#             pol2      pol3
# DE      192.6755  1.324498
# notDE 12172.3245 83.675502

Sure enough, you do. However, this rule of thumb is now known to be too conservative, I wouldn't worry about the above test. If you just want to be extra thorough, we can simulate the p-value:

chisq.test(tab[,1:2], simulate.p.value=TRUE, B=10000)
#  Pearson's Chi-squared test with simulated p-value (based on 10000
#   replicates)
# 
# data:  tab[, 1:2]
# X-squared = 5.5278, df = NA, p-value = 0.0437

This will bounce around a little if you re-run it, but I increased the iterations to $10,000$, so it should be fairly stable. As it happens, the two versions are just on both sides of the magical $.05$ line. For what it's worth, I would probably interpret both versions as providing the same amount of evidence against the null.

$\endgroup$
2
  • $\begingroup$ To be honest I am not sure. What I would really like to know is if this proportion in pol2 between DEList and AllList is significantly higher than the proportion of pol3 between DEList and AllList. Is the McNemar's test the right one for that? Do I need to do one test for pol3 and one for pol2 separately? How do I than decide whether or not the one value is more significant than the other? $\endgroup$ Mar 12, 2015 at 8:12
  • $\begingroup$ Am I correct in assuming, the the contingency table for pol3 will be than this one? $\endgroup$ Mar 12, 2015 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.