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
It looks fishy to me. Maybe you should post this on the bioconductor question site. But your matrices don't match - 3 rows vs. 5?
Thanks for pointing that out--it should be
nrow=5, ncol=3
(I've corrected it now).