Venndiagram Using R
2
7
Entering edit mode
12.8 years ago

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 • 20k views
ADD COMMENT
1
Entering edit mode

You should ask this question on stackoverflow, there is a bigger R community there: http://stackoverflow.com/questions/tagged/r

ADD REPLY
5
Entering edit mode
12.8 years ago
Sameet ▴ 300

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.

ADD COMMENT
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

I've problem in installing the 'vennerable' package, even after following this instruction: http://matticklab.com/index.php?title=Weighted_Venn_diagrams_in_R Can anybody suggest some other method?

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

@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.

ADD REPLY
0
Entering edit mode

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)

ADD REPLY
0
Entering edit mode
12.7 years ago
Ly ▴ 130

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)

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1681 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6