overLapper  R Documentation 
Function for computing Venn intersects or standard intersects among large
numbers of label sets provided as list
of vectors
. The resulting
intersect objects can be used for plotting 25 way Venn diagrams or intersect
bar plots using the functions vennPlot
or olBarplot
, respectively.
The overLapper
function scales to 220 or more label vectors for Venn
intersect calculations and to much larger sample numbers for standard
intersects. The different intersect types are explained below under the
definition of the type
argument. The upper Venn limit around 20 label
sets is unavoidable because the complexity of Venn intersects increases
exponentially with the label set number n
according to this
relationship: 2^n  1
. The current implementation of
the plotting function vennPlot
supports Venn diagrams for 25 label
sets. To visually analyze larger numbers of label sets, a variety of intersect
methods are introduced in the olBarplot
help file. These methods are
much more scalable than Venn diagrams, but lack their restrictive intersect
logic.
overLapper(setlist, complexity = "default", sep = "_", cleanup = FALSE, keepdups = FALSE, type)
setlist 
Object of class 
complexity 
Complexity level of intersects specified as integer vector. For Venn intersects
it needs to be assigned 
sep 
Character used to separate set labels. 
cleanup 
If set to 
keepdups 
By default all duplicates are removed from the label sets. The setting

type 
With the default setting 
Additional Venn diagram resources are provided by the packages limma
,
gplots
, vennerable
, eVenn
and VennDiagram
, or
online resources such as shapes, Venn Diagram Generator and Venny.
overLapper
returns standard intersect and Venn intersect results as
INTERSECTset
or VENNset
objects, respectively. These S4 objects
contain the following components:
setlist 
Original label sets accessible with 
intersectmatrix 
Presentabsent matrix accessible with 
complexitylevels 
Complexity levels accessible with 
vennlist 
Venn intersects for 
intersectlist 
Standard intersects for 
The functions provided here are an extension of the Venn diagram resources on this site: http://manuals.bioinformatics.ucr.edu/home/R_BioCondManual#TOCVennDiagrams
Thomas Girke
See examples in 'The Electronic Journal of Combinatorics': http://www.combinatorics.org/files/Surveys/ds5/VennSymmExamples.html
vennPlot
, olBarplot
## Sample data
setlist < list(A=sample(letters, 18), B=sample(letters, 16),
C=sample(letters, 20), D=sample(letters, 22),
E=sample(letters, 18), F=sample(letters, 22))
## 2way Venn diagram
vennset < overLapper(setlist[1:2], type="vennsets")
vennPlot(vennset)
## 3way Venn diagram
vennset < overLapper(setlist[1:3], type="vennsets")
vennPlot(vennset)
## 4way Venn diagram
vennset < overLapper(setlist[1:4], type="vennsets")
vennPlot(list(vennset, vennset))
## Pseudo 4way Venn diagram with circles
vennPlot(vennset, type="circle")
## 5way Venn diagram
vennset < overLapper(setlist[1:5], type="vennsets")
vennPlot(vennset)
## Alternative Venn count input to vennPlot (not recommended!)
counts < sapply(vennlist(vennset), length)
vennPlot(counts)
## 6way Venn comparison as bar plot
vennset < overLapper(setlist[1:6], type="vennsets")
olBarplot(vennset, mincount=1)
## Bar plot of standard intersect counts
interset < overLapper(setlist, type="intersects")
olBarplot(interset, mincount=1)
## Accessor methods for VENNset/INTERSECTset objects
names(vennset)
names(interset)
setlist(vennset)
intersectmatrix(vennset)
complexitylevels(vennset)
vennlist(vennset)
intersectlist(interset)
## Coerce VENNset/INTERSECTset object to list
as.list(vennset)
as.list(interset)
## Pairwise intersect matrix and heatmap
olMA < sapply(names(setlist),
function(x) sapply(names(setlist),
function(y) sum(setlist[[x]] %in% setlist[[y]])))
olMA
heatmap(olMA, Rowv=NA, Colv=NA)
## Presenceabsence matrices for large numbers of sample sets
interset < overLapper(setlist=setlist, type="intersects", complexity=2)
(paMA < intersectmatrix(interset))
heatmap(paMA, Rowv=NA, Colv=NA, col=c("white", "gray"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.