This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Venndiagram Using R

Could anyone would be able to guide me to draw a venn diagram with five entries with R library VennDiagram. I have tried the venneuler with success but it does not provide the annotation of the values for display. The code for venneuler along with the data of the five entries is given below

library("venneuler") vd <- venneuler(c(K=1206, C=1346, Y=1369, W=585, T=915, "K&C"=963, "K&Y"=978, "K&W"=234,"K&T"=613 , "C&Y"=1154, "C&W"=224, "C&T"=700, "Y&T"=638, "Y&W"=271, "W&T"=153,"K&C&Y&W&T"=1802))

r

2 answers

You probably should try the package Vennerable from R-Forge here. I have tried making Venn diagrams for upto 4 sets and i think this package allows you to go upto 9 sets. But the limitation is you can draw "proportional" Venn diagrams with only upto 3 sets.

The syntax is generally as follows:

library( vennerable )
v <- Venn( SetNames=c( "A", "B" ), Weight=c( `01` = 10, `10` = 10, `11` = 5 ) )
plot v

Do let know if this helps.

You can also download the source file and install it by R CMD INSTALL <SOURCE_FILE>, but this method may not necessarily take care of dependencies.

@WoA I am assuming you are having a LINUX-like environment to work in (Mac OS Terminal will also work equally well). All the usual caveats of privileges apply. If you want to install system-wide, you have to be root.

vennerable does not serve the purpose of interpreting 5-way data representation. VennDiagram however seems to do so but I'm not sure would it be able to distribute 5 sets of data"(Their example illustrates maximum with 4 sets)

There is a good Venn Diagram plotting function in the gplots package. Their help suggests you can use it to plot 5 way Venn Diagrams, but they cannot be proportional.

With VennDiagram, I can draw Venn Diagrams with up to 5 sets:

a<-"your a data"

b<-"your b data"

c<-"your c data"

d<-"your d data"

e<-"your e data"

aa<-cbind(a,b,c,d,e)

aa.2<-vennCounts(aa)

vennDiagram(aa.2)

Ly: Could you be more specific in explaining what type of "data" you are referring to use?I have Ids(protein IDs or gene IDs) as data for each entry/set to be compared for drawing a venn diagram

You can use IDs but I usually use it to compare the number of DE genes that I get after doing a limma analysis:

With the function: results<-decideTests(fit2, method="separate", adjust.method="fdr", p-value=0.01)

I get my DE genes across my 5 comparison. Then I can use the above function: a<-results[,1] b<-results[,2].....and so on.

Hi Ly, but with this method you cannot see up and down regulated genes right? You just plot significantly differentially expressed

Log in to answer this question.