Skip to content

Instantly share code, notes, and snippets.

@GuangchuangYu
Created May 17, 2012 08:00
Show Gist options
  • Save GuangchuangYu/2717285 to your computer and use it in GitHub Desktop.
Save GuangchuangYu/2717285 to your computer and use it in GitHub Desktop.
venn plot
x <- read.csv("/Volumes/YGC/Researches/ARCHIVE/Others/AL-1-by-GR.Yan/2D-data-and-analysis-result/2D.csv")
eg <- as.character(x[,1])
require(clusterProfiler)
xx <- enrichGO(eg, ont="BP")
gg <- xx@geneInCategory
names(gg) <- clusterProfiler:::TERM2NAME.BP(names(gg))
g <- gg[1:4]
require(gplots)
vm <- venn(g)
vm <- vm[,names(g)]
require(venneuler)
v <- venneuler(vm)
getCol <- function(col, alpha=0.3) {
col <- hcl(col * 360, 130, 60)
col <- col2rgb(col)/255
col <- rgb(col[1, ], col[2, ], col[3, ], alpha)
col
}
col <- getCol(v$colors)
lbs <- v$labels
id <- match(names(g), lbs)
plot(v)
legend(legend=lbs[id], fill=col[id], x="topright")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment