This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trying to understand differential gene expression through Venn Diagrams from the 'limma' R package: why is there a number outside my diagram?

Hello,

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))

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. (ETA: 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. (ETA: 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? 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.

Any help is appreciated.

(ETA: The matrix looks like the following:)

         A    B     C
Gene1    0    1    -1
Gene2    1    1    -1
Gene3    1    1    -1
Gene4   -1    1    -1
Gene5    0    0    -1
r limma venn diagram differential expression

Thanks for pointing that out--it should be nrow=5, ncol=3 (I've corrected it now).

1 answer

I can't read your matrix, but if the first column is all zeros, then one 'gene' is neither "up" nor "down".

The number outside the Venn diagram notes how many elements were in no set.

Thanks for your response; however, as I mentioned, the rows of the matrix represent the genes (not the columns), and I have a 0 outside the three circles in the first diagram (meaning all genes are expressed by at least one condition). I am using the same matrix to generate the diagram that distinguishes which genes are up or down regulated, so I don't understand why there is a 1 outside the three circles in that diagram.

I've added the matrix for clarification.

Log in to answer this question.