Trying to understand differential gene expression through Venn Diagrams from the 'limma' R package: why is there a number outside my diagram?
Entering edit mode
hmg • 0
Last seen 7.7 years ago


I am using the vennDiagram function from the limma library in R in order to understand the relationship of differentially expressed genes between my conditions. For a simple example, create a matrix:

m <- matrix(nrow=5, ncol=3, c(0, 1, 1, -1, 0, 1, 1, 1, 1, 0, -1, -1, -1, -1, -1))

The matrix looks like the following (row and column names have been added for clarity):

         A    B     C
Gene1    0    1    -1
Gene2    1    1    -1
Gene3    1    1    -1
Gene4   -1    1    -1
Gene5    0    0    -1

Where the first column represents condition A, the second condition B, and the third C. The five rows represent five separate genes, and a positive 1 means the gene is up regulated in that condition, and a negative 1 means it is down regulated. A 0 means the gene is not expressed in that condition.

To create a Venn diagram showing which conditions share differentially expressed genes (not distinguishing up- or down-regulated genes):

vennDiagram(m, names=c("A", "B", "C"))

This shows that three genes are expressed in all three conditions, one is expressed by both B and C, and one is expressed only in C. From my understanding, the 0 in the corner means no genes are listed in the matrix that aren't expressed by any of the three conditions. In other words, all five genes are expressed in at least one condition.

To distinguish which genes are up and down regulated:

vennDiagram(m, names=c("A", "B", "C"), include=c("up", "down"))

I can understand how in this diagram, the numbers move because, for example, of the 3 genes differentially expressed by all three conditions, 2 were up regulated in A and B while down regulated in C. However, where is the 1 coming from in the corner, outside of the three circles? One gene is up-regulated but not expressed by any of the conditions? I haven't changed the matrix used to generate the diagrams, so all genes should be expressed by at least one of the conditions.

The same thing occurs when using other simple matrices, as well as actual gene expression data (though with much larger numbers appearing outside the circles), so it is not an issue with this particular example.

Any help is appreciated.

limma r venn diagram differential expression • 5.1k views
Entering edit mode
Last seen 8 hours ago
United States

All genes are expressed in at least one condition, but you have specified that you only want to count first the 'up' genes, and then the 'down' genes. Gene 5 is only down-regulated, so when you are plotting the 'up' portion of the Venn diagram, it gets excluded, because it isn't up-regulated in any contrast.

Try comparing these two Venn diagrams

vennDiagram(m, "up")
vennDiagram(m, "down")

Does that help?

Entering edit mode

YES, thank you so much. 


Login before adding your answer.

Traffic: 294 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6