Suppose I have done two Chip-seq experiments. Now after the bias correction step such as MACS2, I get two set of genomic intervals (or peaks, as what is usually called) that corresponds to each of the experiment. I want to test the significance of the overlap of these two set genomic intervals that corresponds to each experiment.

The common test employed seemed to me is the Hypergeometic test. There's even a package specifically aim for this task: ChiPpeakAnno.

Recall from the Hypergeometric distrbition -- the analogy is that we have a bag of marbles with two different colors, say one blue and another red. A sample from such distribution consists of marbles drawn from this bag, and a probability measure for this distribution is the number of blue marbles in the sample.

Could someone explain what is the correspondence between the hypergeometric test and the significance overlap between two different set of genomic intervals?

  • $\begingroup$ Interesting dicussion, its about sampling error in minority populations and whether this sampling error can throw a spurious "they are different result", when in fact its a sampling bias. $\endgroup$
    – M__
    May 17, 2020 at 12:41

2 Answers 2


There is no such thing as a hypergeometric test, at least in statistical textbooks. It's a fisher test based on hypergeometric distribution.

If it is chip-seq for the same target, i.e biological replicates, significance of overlap is not quite meaningful. You get more information by for example checking the correlation of the coverage between your replicates using deeptools or anything else.

If you are comparing between two different targets, for example, chip for two different histone marks, you can use the fisher test or chi-square this way.

  1. Partition the genome in X bp bins, these are all your marbles
  2. Identity those that overlap with peaks from target 1 and those that don't
  3. Do 2. for target2
  4. construct a contingency table using 2 and 3.

So you should end up with something like this (purely made up):

                      no_overlap_target2 overlap_target2
  no_overlap_target1               9799             112
  overlap_target1                    88               1

And if there is overlap, the bottom diagonal with be higher.. less on the off-diagonal, and you can test it with a fisher.test.

  • $\begingroup$ So in your table, top left is the sum of the number of intervals in target1 and target2 that are not overlapping each other? Also the off-diagonal is the the number of target 1 that is not overlapping with target2 and vice versa? $\endgroup$
    – skc
    May 18, 2020 at 15:23
  • 1
    $\begingroup$ sorry.. not very clear, this table is for example, we partition the genome into 10000 bins.. 9799 don't have target 1 or target 2, off diagonal is found in target2 but not in target1 $\endgroup$
    – StupidWolf
    May 18, 2020 at 15:27
  • $\begingroup$ Ah, I see. Thanks! Now I think I know how to do. $\endgroup$
    – skc
    May 18, 2020 at 15:42
  • 1
    $\begingroup$ Yes, I have two targets. I think I'll just go ahead and use Granges package in R to do this task. $\endgroup$
    – skc
    May 18, 2020 at 15:44
  • $\begingroup$ Do you mind if you could explain why this is corresponds to the hypergeometric distribution in this setting? In particular, why does "drawing the blue ball" from the urn corresponds to X-bp bins that are not in target1 nor target2? $\endgroup$
    – skc
    May 18, 2020 at 20:39

Just to make sure, I took a quick look at chippeakanno, and it uses a hypergeometric test for gene enrichment, not necessarily overlap of two chip-seq results.

As you mentioned, you can imagine in your set of genes, you have those that overlap with your peaks, and those that do not. Hypergeometric distribution calculates the probability of getting a certain number of genes that overlap with your peaks (which is the same as sampling some balls and calculate the p-value of some balls with one color). The hypergeometric test calculates a p-value to see whether this number of overlapping genes is more than expected.

I also read on Wikipedia that the P-value of hypergeometric test times 2 is exactly the P-value for Fisher's exact test. Fisher's exact test tests whether your overlap is more than (or less than) expectation. Hypergeometric tests just feel like a one-tailed version of Fisher's exact tests.


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.