Sunday, May 20, 2012

Another look at over-representation analysis interpretation

Interpreting a list of differentially regulated genes can take many forms. One of the most widely used method is looking for enrichment of functional group of genes compared to a random sampling of gene from the same universe, namely an over-representation analysis (ORA).

The point I want to explore today is what is the best way to interpret the results of an ORA?
The list of GO categories one obtain often tells a complex message and leave us with a confuse feeling that we are cherry picking the categories that fit our hypothesis the best.

Let's have a look at an example. First, I extract a gene list from a publicly available experiment in Gene Expression Omnibus. I use GEOquery for that and obtain a list of 274 genes up- and down-regulated (code at the end).

From this gene list we can perform a GO ORA fairly easily using the GOstats package. I combined all the steps necessary in two functions (GO_over.r and write.GOhyper.r) that you can found on my GitHub repo. I usually download the functions directly from my R session using this function: (copy and paste it in your R session or save it to a file call source_https.r)
Here we are presented with a table of 59 GO categories that are all significant after multiple hypothesis testing correction. Cell adhesion, generation of neurons, cellular response to interferon-beta...

How to interpret this list?
One way to do that is to display the Directed Acyclic Graph (DAG) of the over-represented GO categories in the list. But in my opinion it is difficult to get a big picture of such representation. We know that the GO categories (and to a lower extend pathways) share common genes. My hypothesis is that visualizing the relationship between GO categories based on the amount of gene shared will likely help to interpret the results. So what I do, in addition, is to visualize the amount of gene shared between GO categories by plotting the results of the ORA using a heatmap (code below the plot).
Rows and columns are GO categories. The color of each square represents the percentage of gene shared between any two categories. Here we see that our gene list (274 genes) seems to preferentially contain genes from three ensembles of GO categories that are in yellow along the diagonal. Based on this observation we can interpret that the main events going on in these cells seems to be linked to regulation of metabolism, cytoskeleton re-organization and neurons development. Which make sense when you consider that we compared iPS cells to neurospheres cells.

I welcome comments about this approach (in fact this the purpose of this post). I would like to argue that such representation of a GO ORA is complementary to displaying a flat text table and plotting the DAG. Did anybody already used this approach to interpret GO ORA? Or has a better solution?
I acknowledge that it is not the perfect solution. For example, if a category does not share many genes with others it does not mean it is not worth investigating. It might even be the key to understanding the biological experiment but there are a lot of those categories... which one to pick? Plus, I think a GO ORA does not aim at fined grain analysis but at a global overview of the events.

Here is the code to produce the heatmap:

I put here last the code to generate the list of genes significantly differentially expressed used in this post. Briefly, the experiment consist of three cell types. (i) Neurosphere cells, which are adult stem cells found in the brain, (ii) induced pluripotent stem (iPS) cells that are derived from neurosphere cells and (iii) neurosphere cells derived from the iPS cells, making it a full loop in term cell types [reference].


  1. Hey David,

    I suggest you check out Enrichment Map ( Although originally developed for visualization of GSEA results, it works with DAVID enrichment results as well. It creates a network of terms and connects them based on the amount of genes shared between them. It's pretty to look at as well.

  2. Hi David,

    Another plug for Enrichment Map. I don't use the plugin directly, but the principle is easy to implement, and is related to your idea of using the degree of gene overlap between the annotations to organize them. It is pretty trivial to create a network of terms, and use the RCytoscape package to visualize the network interactively in Cytoscape. I actually used this method in my own Bioconductor package categoryCompare ( Although I use it in this way to examine comparative ORA, I also tend to use it a lot for examining the results of single experiments, and find it very useful to organize the results of ORA.

  3. Hi David,

    Thanks for a good post.
    I tried to run your script on my own data, however I get an error when I try to create the goNames object (line 25 in your heatmap script). I'm sure I missed something, but I haven't been able to figure out what "GOTERM' refers to in your mget() command. Could you maybe point me in the right direction?

    Many thanks

    1. GOTERM is an annotation object part of the GO.db package. This package is loaded automatically through a call for GOstats if you use the GO_over function.
      just load the GOstats library and it should be fine.