Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.