BioVenn: R and Python packages

BioVenn is also available as an R package and a Python package.

This page shows a comparison between these packages and existing Venn diagram packages in both languages.

Data was downloaded from the OMA browser (August 2020 release).
The species-specific files derived from this dataset are here: Human, Mouse and Xenopus.

The R code to create Venn diagrams using BioVenn and other packages is as follows:
list_x <- as.vector(unlist(read.table("oma-human.txt")))
list_y <- as.vector(unlist(read.table("oma-mouse.txt")))
list_z <- as.vector(unlist(read.table("oma-xenla.txt")))

# BioVenn
library("BioVenn")
biovenn <- draw.venn(list_x, list_y, list_z, xtitle="Human", ytitle="Mouse", ztitle="Xenopus", title="", subtitle="", nrtype="abs")

# VennDiagram
library("VennDiagram")
venn.plot <- draw.triple.venn(19614,21018,27738,16478,12389,12334,11535,category=c("Human","Mouse","Xenopus"),fill=c("red","green","blue"))
grid.draw(venn.plot)

# venneuler
library("venneuler")
vd <- venneuler(c(A=2337,B=3686,C=14550,"A&B"=4943,"A&C"=799,"B&C"=854,"A&B&C"=11535))
vd$labels=c("Human","Mouse","Xenopus")
vd$colors=c(0,0.33,0.67)
plot(vd)

# eulerr
library("eulerr")
venn <- euler(c("A"=2337,"B"=3686,"C"=14550,"A&B"=4943,"A&C"=799,"B&C"=854,"A&B&C"=11535))
plot(venn,labels=c("Human","Mouse","Xenopus"),fills=c("red","green","blue"),quantities=list(type="counts"))

# nVennR
library("nVennR")
set1 <- list(list_x)
set2 <- list(list_y)
set3 <- list(list_z)
myNV <- nVennR::plotVenn(list(set1,set2,set3),sNames=c("Human","Mouse","Xenopus"),labelRegions=F,outFile="nVennR.svg",opacity=0.5,setColors=c("red","green","blue"))

# venn
library("venn")
venn <- venn(list(list_x,list_y,list_z),snames="Human, Mouse, Xenopus",zcolor="Red, Green, Blue",opacity=0.5,box=F)

# vennplot
library("vennplot")
vp <- vennplot(c("Human"=2337,"Mouse"=3686,"Xenopus"=14550,"Human&Mouse"=4943,"Human&Xenopus"=799,"Mouse&Xenopus"=854,"Human&Mouse&Xenopus"=11535),cols=c(rgb(1,0,0,alpha=0.5),rgb(0,1,0,alpha=0.5),rgb(0,0,1,alpha=0.5)),ThreeD=TRUE)

# colorfulVennPlot
library("colorfulVennPlot")
svg()
plotVenn3d(c(799,4943,3686,14550,854,2337,11535),labels=c("Human","Mouse","Xenopus"),Colors=c("#800080","#808000","#00FF00","#0000FF","#008080","#FF0000","#555555"),Title=NULL)
dev.off()
The Python code to create Venn diagrams using BioVenn and other packages is as follows:
# BioVenn
from BioVenn import *
list_x=[]
list_y=[]
list_z=[]
with open('oma-human.txt') as f:
    for line in f:
        list_x.append(line.strip())
with open('oma-mouse.txt') as f:
    for line in f:
        list_y.append(line.strip())
with open('oma-xenla.txt') as f:
    for line in f:
        list_z.append(line.strip())
biovenn = draw_venn(list_x, list_y, list_z, xtitle="Human", ytitle="Mouse", ztitle="Xenopus", title="", subtitle="", nrtype="abs", output="svg")

# matplotlib_venn
import matplotlib.pyplot as plt
from matplotlib_venn import venn3, venn3_circles
import numpy as np
plt.figure(figsize=(10,10))
v=venn3(subsets=(2337,3686,4943,14550,799,854,11535),set_labels=('Human','Mouse','Xenopus'))
v.get_patch_by_id('100').set_alpha(0.5)
v.get_patch_by_id('100').set_color('red')
v.get_patch_by_id('010').set_alpha(0.5)
v.get_patch_by_id('010').set_color('green')
v.get_patch_by_id('001').set_alpha(0.5)
v.get_patch_by_id('001').set_color('blue')

#venn
from venn import venn
import csv
plt.figure(figsize=(10,10))
list_x=set()
list_y=set()
list_z=set()
with open('oma-human.txt') as f:
    for line in f:
        list_x.add(line.strip())
with open('oma-mouse.txt') as f:
    for line in f:
        list_y.add(line.strip())
with open('oma-xenla.txt') as f:
    for line in f:
        list_z.add(line.strip())
venn({"Human":list_x,"Mouse":list_y,"Xenopus":list_z},cmap=["red","green","blue"])
The figures that are created with the code above can be downloaded here.

This table shows the similarities and differences between the different R and Python packages can be downloaded here in tab-delimited format.