注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

云之南

风声,雨声,读书声,声声入耳;家事,国事,天下事,事事关心

 
 
 

日志

 
 
关于我

专业背景:计算机科学 研究方向与兴趣: JavaEE-Web软件开发, 生物信息学, 数据挖掘与机器学习, 智能信息系统 目前工作: 基因组, 转录组, NGS高通量数据分析, 生物数据挖掘, 植物系统发育和比较进化基因组学

网易考拉推荐

R语言绘制维恩图  

2011-09-09 12:58:47|  分类: R&Bioconductor |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

http://bioinfogp.cnb.csic.es/tools/venny/index.html   
输入数据直接能画出不,不过好像只能画4个列表

http://pgfe.umassmed.edu/ou/archives/2603

http://pgfe.umassmed.edu/ou/rbioconductor-2

http://www.cnblogs.com/xianghang123/archive/2013/03/25/2980623.html

http://yishuo.org/2011/08/venn/

如果 以下包没有安装,请这样安装:

>source(http://www.bioconductor.org/biocLite.R)

>biocLite("gplots")

>biocLite("limma")

 

Gplots包

http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/gplots/html/00Index.html

Documentation for package ‘gplots’ version 2.8.0

http://www.oga-lab.net/RGM2/func.php?rd_id=gplots:venn

> library(gplots)

Loading required package: gtools

Loading required package: gdata

Attaching package: ‘gdata’

The following object(s) are masked from ‘package:utils’:

    object.size

Loading required package: caTools

Loading required package: bitops

Loading required package: grid

Attaching package: ‘gplots’

The following object(s) are masked from ‘package:stats’:

    lowess

> ##

> ## Example using a list of item indexes  belonging to the

> ## specified group.

> ##

> A<- 1:20

> B<- 1:20

> C<- 2:20

> D<- 3:21

> input<-list(A,B,C,D)

> input

[[1]]

 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

[[2]]

 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

[[3]]

 [1]  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

[[4]]

 [1]  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21

> venn(input)

> A<- as.logical(rbinom(100, 1, 0.2))

> B<- as.logical(rbinom(100, 1, 0.7))

> C<- as.logical(rbinom(100, 1, 0.2))

> D<- as.logical(rbinom(100, 1, 0.1))

> input<-data.frame(A,B,C,D)

> venn(input)

> tmp <- venn(input, simplify=TRUE)

> tmp

     num A B C D

0000   0 0 0 0 0

0001   1 0 0 0 1

0010   1 0 0 1 0

0011   0 0 0 1 1

0100  38 0 1 0 0

0101   8 0 1 0 1

0110  12 0 1 1 0

0111   0 0 1 1 1

1000   4 1 0 0 0

1001   0 1 0 0 1

1010   1 1 0 1 0

1011   0 1 0 1 1

1100  13 1 1 0 0

1101   1 1 1 0 1

1110   3 1 1 1 0

1111   0 1 1 1 1

>venn(input, showSetLogicLabel=TRUE)

> venn(input, universe=NULL, showSetLogicLabel=TRUE)

 

asbio包

> library(asbio)

Loading required package: plotrix

Attaching package: ‘plotrix’

The following object(s) are masked from ‘package:gplots’:

    plotCI

Loading required package: vegan

This is vegan 1.17-2

Attaching package: ‘vegan’

The following object(s) are masked from ‘package:gtools’

    permute

Loading required package: MASS

Loading required package: lmomco

Package lmomco (0.97.4) loaded.

Loading required package: cluster

Loading required package: boot

Attaching package: ‘boot’

The following object(s) are masked from ‘package:gtools’:

    inv.logit, logit

Loading required package: akima

> Venn(A=.3,B=.2,AandB=.06)

limma包

http://rss.acs.unt.edu/Rdoc/library/limma/html/venn.html

>library(limma)
> Y <- matrix(rnorm(100*6),100,6)
> Y[1:10,3:4] <- Y[1:10,3:4]+3
> Y[1:20,5:6] <- Y[1:20,5:6]+3
> design <- cbind(1,c(0,0,1,1,0,0),c(0,0,0,0,1,1))
> fit <- eBayes(lmFit(Y,design))
> results <- decideTests(fit)
> a <- vennCounts(results)
> print(a)
     x1 x2 x3 Counts
[1,]  0  0  0    100
[2,]  0  0  1      0
[3,]  0  1  0      0
[4,]  0  1  1      0
[5,]  1  0  0      0
[6,]  1  0  1      0
[7,]  1  1  0      0
[8,]  1  1  1      0
attr(,"class")
[1] "VennCounts"
> vennDiagram(a)
> vennDiagram(results,include=c("up","down"),counts.col=c("red","green"))

venneuler包

> library(venneuler)

Loading required package: rJava

> vd <- venneuler(c(A=0.3, B=0.3, C=1.1, “A&B”=0.1, “A&C”=0.2, “B&C”=0.1 ,”A&B&C”=0.1))

> plot(vd)

> m <- data.frame(elements=c(“1″,”2″,”2″,”2″,”3″), sets=c(“A”,”A”,”B”,”C”,”C”))

Warning message:

semi-transparency is not supported on this device: reported only once per page

> v <- venneuler(m)

> plot(v)

> m <- as.matrix(data.frame(A=c(1.5, 0.2, 0.4, 0, 0),

+                           B=c(0  , 0.2, 0  , 1, 0),

+                           C=c(0  , 0  , 0.3, 0, 1)))

Warning message:

semi-transparency is not supported on this device: reported only once per page

> # without weights

> v <- venneuler(m > 0)

> plot(v)

> v <- venneuler(m)

> plot(v)

Vennerable包

> library(Vennerable)

Loading required package: graph

Loading required package: RBGL

Loading required package: lattice

Attaching package: ‘lattice’

The following object(s) are masked from ‘package:boot’:

    melanoma

Loading required package: RColorBrewer

Loading required package: reshape

Loading required package: plyr

Attaching package: ‘Vennerable’

The following object(s) are masked from ‘package:asbio’:

Venn

> Venn(n=3)

A Venn object on 3 sets named

1,2,3

000 100 010 110 001 101 011 111

  1   1   1   1   1   1   1   1

> plot(Venn(n=3))

> data(StemCell)

> w <- Venn(Sets=StemCell[1:2])

> Weights(w)

 00  10  01  11

  0 219 875 404

> plot(w)

> Weights(w) <- 1:4

> plot(w)


VennDiagram

> library(VennDiagram)
Loading required package: grid
Warning message:
package 'VennDiagram' was built under R version 2.13.0
> x <- c(1,3,5,7,9,11,17,19,21,23,25,29,31,33,37,39,41,47,49,51,57,59)
> y <- c(1,3,5,7,13,17,19,21,23,25,27,29,31,33,45,47,51)
> z <- c(1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,55,57,59,61)
> venn.diagram(list(X=x,Y=y,Z=z),fill=c("red","blue","yellow"),"out.tiff")
[1] 1
输出1表示画图成功,生成的结果是out.tiff,这个文件在你的R工作目录下。
  评论这张
 
阅读(2064)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016