Last data update: 2014.03.03

R: Plot 2-5 way Venn diagrams
vennPlotR Documentation

Plot 2-5 way Venn diagrams

Description

Ploting function of 2-5 way Venn diagrams from 'VENNset' objects or count set vectors. A useful feature is the possiblity to combine the counts from several Venn comparisons with the same number of label sets in a single Venn diagram.

Usage

vennPlot(x, mymain = "Venn Diagram", mysub = "default", setlabels = "default", yoffset = seq(0, 10, by = 0.34), ccol = rep(1, 31), colmode = 1, lcol = c("#FF0000", "#008B00", "#0000FF", "#FF00FF", "#CD8500"), lines = c("#FF0000", "#008B00", "#0000FF", "#FF00FF", "#CD8500"), mylwd = 3, diacol = 1, type = "ellipse", ccex = 1, lcex = 1, sepsplit = "_", ...)

Arguments

x

VENNset or list of VENNset objects. Alternatively, a vector of Venn counts or a list of vectors of Venn counts can be provided as input. If several Venn comparisons are provided in a list then their results are combined in a single Venn diagram, where the count sets are organized above each other.

mymain

Main title of plot.

mysub

Subtitle of plot. Default mysub="default" reports the number of unique items in all sets, as well as the number of unique items in each individual set, respectively.

setlabels

The argument setlabels allows to provide a vector of custom sample labels. However, assigning the proper names in the name slots of the initial setlist is preferred for tracking purposes.

yoffset

The results from several Venn comparisons can be combined in a single Venn diagram by assigning to x a list with several VENNsets or count vectors. The positonal offset of the count sets in the plot can be controlled with the yoffset argument. The argument setting colmode allows to assign different colors to each count set. For instance, with colmode=2 one can assign to ccol a color vector or a list, such as ccol=c("blue", "red") or ccol=list(1:8, 8:1).

ccol

Character or numeric vector to define colors of count values, e.g. ccol=c("black","black","red").

colmode

See argument yoffset.

lcol

Character or numeric vector to define colors of set labels, e.g. lcol=c("red", "green")

lines

Character or numeric vector to define colors of lines in plot.

mylwd

Defines line width of shapes used in plot.

diacol

See argument type.

type

Defines shapes used to plot 4-way Venn diagram. Default type="ellipse" uses ellipses. The setting type="circle" returns an incomplete 4-way Venn diagram as circles. This representation misses two overlap sectors, but is sometimes easier to navigate than the default ellipse version. The missing Venn intersects are reported below the Venn diagram. Their font color can be controled with the argument diacol.

ccex

Controls font size for count values.

lcex

Controls font size for set labels.

sepsplit

Character used to separate sample labels in Venn counts.

...

Additional arguments to pass on.

Value

Venn diagram plot.

Note

The functions provided here are an extension of the Venn diagram resources on this site: http://manuals.bioinformatics.ucr.edu/home/R_BioCondManual#TOC-Venn-Diagrams

Author(s)

Thomas Girke

References

See examples in 'The Electronic Journal of Combinatorics': http://www.combinatorics.org/files/Surveys/ds5/VennSymmExamples.html

See Also

overLapper, olBarplot

Examples

## 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))

## 2-way Venn diagram
vennset <- overLapper(setlist[1:2], type="vennsets")
vennPlot(vennset)

## 3-way Venn diagram
vennset <- overLapper(setlist[1:3], type="vennsets")
vennPlot(vennset)

## 4-way Venn diagram
vennset <- overLapper(setlist[1:4], type="vennsets")
vennPlot(list(vennset, vennset))

## Pseudo 4-way Venn diagram with circles
vennPlot(vennset, type="circle")

## 5-way 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)

## 6-way 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)

## Presence-absence 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")) 

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(systemPipeR)
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
Loading required package: ShortRead
Loading required package: BiocParallel
Loading required package: GenomicAlignments
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/systemPipeR/vennPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: vennPlot
> ### Title: Plot 2-5 way Venn diagrams
> ### Aliases: vennPlot
> ### Keywords: utilities
> 
> ### ** Examples
> 
> ## 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))
> 
> ## 2-way Venn diagram
> vennset <- overLapper(setlist[1:2], type="vennsets")
> vennPlot(vennset)
> 
> ## 3-way Venn diagram
> vennset <- overLapper(setlist[1:3], type="vennsets")
> vennPlot(vennset)
> 
> ## 4-way Venn diagram
> vennset <- overLapper(setlist[1:4], type="vennsets")
> vennPlot(list(vennset, vennset))
> 
> ## Pseudo 4-way Venn diagram with circles
> vennPlot(vennset, type="circle")
> 
> ## 5-way 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)
> 
> ## 6-way 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)
[1] "setlist"          "intersectmatrix"  "complexitylevels" "vennlist"        
> names(interset)
[1] "setlist"          "intersectmatrix"  "complexitylevels" "intersectlist"   
> setlist(vennset)
$A
 [1] "s" "g" "w" "t" "h" "c" "p" "x" "d" "r" "l" "v" "e" "n" "u" "m" "z" "o"

$B
 [1] "a" "n" "s" "i" "q" "j" "e" "o" "r" "t" "c" "f" "p" "d" "m" "l"

$C
 [1] "s" "h" "i" "l" "p" "r" "q" "c" "u" "o" "t" "f" "a" "g" "n" "w" "z" "m" "y"
[20] "k"

$D
 [1] "c" "i" "k" "h" "r" "u" "n" "f" "j" "m" "l" "d" "b" "v" "e" "g" "z" "o" "p"
[20] "t" "w" "x"

$E
 [1] "m" "p" "q" "z" "r" "a" "g" "d" "u" "t" "n" "y" "o" "b" "k" "l" "c" "h"

$F
 [1] "w" "z" "l" "v" "a" "k" "q" "j" "u" "y" "m" "t" "d" "h" "x" "e" "s" "b" "f"
[20] "p" "i" "c"

> intersectmatrix(vennset)
  A B C D E F
a 0 1 1 0 1 1
b 0 0 0 1 1 1
c 1 1 1 1 1 1
d 1 1 0 1 1 1
e 1 1 0 1 0 1
f 0 1 1 1 0 1
g 1 0 1 1 1 0
h 1 0 1 1 1 1
i 0 1 1 1 0 1
j 0 1 0 1 0 1
k 0 0 1 1 1 1
l 1 1 1 1 1 1
m 1 1 1 1 1 1
n 1 1 1 1 1 0
o 1 1 1 1 1 0
p 1 1 1 1 1 1
q 0 1 1 0 1 1
r 1 1 1 1 1 0
s 1 1 1 0 0 1
t 1 1 1 1 1 1
u 1 0 1 1 1 1
v 1 0 0 1 0 1
w 1 0 1 1 0 1
x 1 0 0 1 0 1
y 0 0 1 0 1 1
z 1 0 1 1 1 1
> complexitylevels(vennset)
 [1] 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[39] 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6
> vennlist(vennset)
$A
character(0)

$B
character(0)

$C
character(0)

$D
character(0)

$E
character(0)

$F
character(0)

$A_B
character(0)

$A_C
character(0)

$A_D
character(0)

$A_E
character(0)

$A_F
character(0)

$B_C
character(0)

$B_D
character(0)

$B_E
character(0)

$B_F
character(0)

$C_D
character(0)

$C_E
character(0)

$C_F
character(0)

$D_E
character(0)

$D_F
character(0)

$E_F
character(0)

$A_B_C
character(0)

$A_B_D
character(0)

$A_B_E
character(0)

$A_B_F
character(0)

$A_C_D
character(0)

$A_C_E
character(0)

$A_C_F
character(0)

$A_D_E
character(0)

$A_D_F
[1] "v" "x"

$A_E_F
character(0)

$B_C_D
character(0)

$B_C_E
character(0)

$B_C_F
character(0)

$B_D_E
character(0)

$B_D_F
[1] "j"

$B_E_F
character(0)

$C_D_E
character(0)

$C_D_F
character(0)

$C_E_F
[1] "y"

$D_E_F
[1] "b"

$A_B_C_D
character(0)

$A_B_C_E
character(0)

$A_B_C_F
[1] "s"

$A_B_D_E
character(0)

$A_B_D_F
[1] "e"

$A_B_E_F
character(0)

$A_C_D_E
[1] "g"

$A_C_D_F
[1] "w"

$A_C_E_F
character(0)

$A_D_E_F
character(0)

$B_C_D_E
character(0)

$B_C_D_F
[1] "f" "i"

$B_C_E_F
[1] "a" "q"

$B_D_E_F
character(0)

$C_D_E_F
[1] "k"

$A_B_C_D_E
[1] "n" "o" "r"

$A_B_C_D_F
character(0)

$A_B_C_E_F
character(0)

$A_B_D_E_F
[1] "d"

$A_C_D_E_F
[1] "h" "u" "z"

$B_C_D_E_F
character(0)

$A_B_C_D_E_F
[1] "c" "l" "m" "p" "t"

> intersectlist(interset)
$A
 [1] "c" "d" "e" "g" "h" "l" "m" "n" "o" "p" "r" "s" "t" "u" "v" "w" "x" "z"

$B
 [1] "a" "c" "d" "e" "f" "i" "j" "l" "m" "n" "o" "p" "q" "r" "s" "t"

$C
 [1] "a" "c" "f" "g" "h" "i" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "w" "y"
[20] "z"

$D
 [1] "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "r" "t" "u" "v"
[20] "w" "x" "z"

$E
 [1] "a" "b" "c" "d" "g" "h" "k" "l" "m" "n" "o" "p" "q" "r" "t" "u" "y" "z"

$F
 [1] "a" "b" "c" "d" "e" "f" "h" "i" "j" "k" "l" "m" "p" "q" "s" "t" "u" "v" "w"
[20] "x" "y" "z"

$A_B
 [1] "c" "d" "e" "l" "m" "n" "o" "p" "r" "s" "t"

$A_C
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "s" "t" "u" "w" "z"

$A_D
 [1] "c" "d" "e" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "v" "w" "x" "z"

$A_E
 [1] "c" "d" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$A_F
 [1] "c" "d" "e" "h" "l" "m" "p" "s" "t" "u" "v" "w" "x" "z"

$B_C
 [1] "a" "c" "f" "i" "l" "m" "n" "o" "p" "q" "r" "s" "t"

$B_D
 [1] "c" "d" "e" "f" "i" "j" "l" "m" "n" "o" "p" "r" "t"

$B_E
 [1] "a" "c" "d" "l" "m" "n" "o" "p" "q" "r" "t"

$B_F
 [1] "a" "c" "d" "e" "f" "i" "j" "l" "m" "p" "q" "s" "t"

$C_D
 [1] "c" "f" "g" "h" "i" "k" "l" "m" "n" "o" "p" "r" "t" "u" "w" "z"

$C_E
 [1] "a" "c" "g" "h" "k" "l" "m" "n" "o" "p" "q" "r" "t" "u" "y" "z"

$C_F
 [1] "a" "c" "f" "h" "i" "k" "l" "m" "p" "q" "s" "t" "u" "w" "y" "z"

$D_E
 [1] "b" "c" "d" "g" "h" "k" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$D_F
 [1] "b" "c" "d" "e" "f" "h" "i" "j" "k" "l" "m" "p" "t" "u" "v" "w" "x" "z"

$E_F
 [1] "a" "b" "c" "d" "h" "k" "l" "m" "p" "q" "t" "u" "y" "z"

$A_B_C
[1] "c" "l" "m" "n" "o" "p" "r" "s" "t"

$A_B_D
 [1] "c" "d" "e" "l" "m" "n" "o" "p" "r" "t"

$A_B_E
[1] "c" "d" "l" "m" "n" "o" "p" "r" "t"

$A_B_F
[1] "c" "d" "e" "l" "m" "p" "s" "t"

$A_C_D
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "w" "z"

$A_C_E
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$A_C_F
 [1] "c" "h" "l" "m" "p" "s" "t" "u" "w" "z"

$A_D_E
 [1] "c" "d" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$A_D_F
 [1] "c" "d" "e" "h" "l" "m" "p" "t" "u" "v" "w" "x" "z"

$A_E_F
[1] "c" "d" "h" "l" "m" "p" "t" "u" "z"

$B_C_D
 [1] "c" "f" "i" "l" "m" "n" "o" "p" "r" "t"

$B_C_E
 [1] "a" "c" "l" "m" "n" "o" "p" "q" "r" "t"

$B_C_F
 [1] "a" "c" "f" "i" "l" "m" "p" "q" "s" "t"

$B_D_E
[1] "c" "d" "l" "m" "n" "o" "p" "r" "t"

$B_D_F
 [1] "c" "d" "e" "f" "i" "j" "l" "m" "p" "t"

$B_E_F
[1] "a" "c" "d" "l" "m" "p" "q" "t"

$C_D_E
 [1] "c" "g" "h" "k" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$C_D_F
 [1] "c" "f" "h" "i" "k" "l" "m" "p" "t" "u" "w" "z"

$C_E_F
 [1] "a" "c" "h" "k" "l" "m" "p" "q" "t" "u" "y" "z"

$D_E_F
 [1] "b" "c" "d" "h" "k" "l" "m" "p" "t" "u" "z"

$A_B_C_D
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$A_B_C_E
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$A_B_C_F
[1] "c" "l" "m" "p" "s" "t"

$A_B_D_E
[1] "c" "d" "l" "m" "n" "o" "p" "r" "t"

$A_B_D_F
[1] "c" "d" "e" "l" "m" "p" "t"

$A_B_E_F
[1] "c" "d" "l" "m" "p" "t"

$A_C_D_E
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$A_C_D_F
[1] "c" "h" "l" "m" "p" "t" "u" "w" "z"

$A_C_E_F
[1] "c" "h" "l" "m" "p" "t" "u" "z"

$A_D_E_F
[1] "c" "d" "h" "l" "m" "p" "t" "u" "z"

$B_C_D_E
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$B_C_D_F
[1] "c" "f" "i" "l" "m" "p" "t"

$B_C_E_F
[1] "a" "c" "l" "m" "p" "q" "t"

$B_D_E_F
[1] "c" "d" "l" "m" "p" "t"

$C_D_E_F
[1] "c" "h" "k" "l" "m" "p" "t" "u" "z"

$A_B_C_D_E
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$A_B_C_D_F
[1] "c" "l" "m" "p" "t"

$A_B_C_E_F
[1] "c" "l" "m" "p" "t"

$A_B_D_E_F
[1] "c" "d" "l" "m" "p" "t"

$A_C_D_E_F
[1] "c" "h" "l" "m" "p" "t" "u" "z"

$B_C_D_E_F
[1] "c" "l" "m" "p" "t"

$A_B_C_D_E_F
[1] "c" "l" "m" "p" "t"

> 
> ## Coerce VENNset/INTERSECTset object to list
> as.list(vennset)
$setlist
$setlist$A
 [1] "s" "g" "w" "t" "h" "c" "p" "x" "d" "r" "l" "v" "e" "n" "u" "m" "z" "o"

$setlist$B
 [1] "a" "n" "s" "i" "q" "j" "e" "o" "r" "t" "c" "f" "p" "d" "m" "l"

$setlist$C
 [1] "s" "h" "i" "l" "p" "r" "q" "c" "u" "o" "t" "f" "a" "g" "n" "w" "z" "m" "y"
[20] "k"

$setlist$D
 [1] "c" "i" "k" "h" "r" "u" "n" "f" "j" "m" "l" "d" "b" "v" "e" "g" "z" "o" "p"
[20] "t" "w" "x"

$setlist$E
 [1] "m" "p" "q" "z" "r" "a" "g" "d" "u" "t" "n" "y" "o" "b" "k" "l" "c" "h"

$setlist$F
 [1] "w" "z" "l" "v" "a" "k" "q" "j" "u" "y" "m" "t" "d" "h" "x" "e" "s" "b" "f"
[20] "p" "i" "c"


$intersectmatrix
  A B C D E F
a 0 1 1 0 1 1
b 0 0 0 1 1 1
c 1 1 1 1 1 1
d 1 1 0 1 1 1
e 1 1 0 1 0 1
f 0 1 1 1 0 1
g 1 0 1 1 1 0
h 1 0 1 1 1 1
i 0 1 1 1 0 1
j 0 1 0 1 0 1
k 0 0 1 1 1 1
l 1 1 1 1 1 1
m 1 1 1 1 1 1
n 1 1 1 1 1 0
o 1 1 1 1 1 0
p 1 1 1 1 1 1
q 0 1 1 0 1 1
r 1 1 1 1 1 0
s 1 1 1 0 0 1
t 1 1 1 1 1 1
u 1 0 1 1 1 1
v 1 0 0 1 0 1
w 1 0 1 1 0 1
x 1 0 0 1 0 1
y 0 0 1 0 1 1
z 1 0 1 1 1 1

$complexitylevels
 [1] 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[39] 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6

$vennlist
$vennlist$A
character(0)

$vennlist$B
character(0)

$vennlist$C
character(0)

$vennlist$D
character(0)

$vennlist$E
character(0)

$vennlist$F
character(0)

$vennlist$A_B
character(0)

$vennlist$A_C
character(0)

$vennlist$A_D
character(0)

$vennlist$A_E
character(0)

$vennlist$A_F
character(0)

$vennlist$B_C
character(0)

$vennlist$B_D
character(0)

$vennlist$B_E
character(0)

$vennlist$B_F
character(0)

$vennlist$C_D
character(0)

$vennlist$C_E
character(0)

$vennlist$C_F
character(0)

$vennlist$D_E
character(0)

$vennlist$D_F
character(0)

$vennlist$E_F
character(0)

$vennlist$A_B_C
character(0)

$vennlist$A_B_D
character(0)

$vennlist$A_B_E
character(0)

$vennlist$A_B_F
character(0)

$vennlist$A_C_D
character(0)

$vennlist$A_C_E
character(0)

$vennlist$A_C_F
character(0)

$vennlist$A_D_E
character(0)

$vennlist$A_D_F
[1] "v" "x"

$vennlist$A_E_F
character(0)

$vennlist$B_C_D
character(0)

$vennlist$B_C_E
character(0)

$vennlist$B_C_F
character(0)

$vennlist$B_D_E
character(0)

$vennlist$B_D_F
[1] "j"

$vennlist$B_E_F
character(0)

$vennlist$C_D_E
character(0)

$vennlist$C_D_F
character(0)

$vennlist$C_E_F
[1] "y"

$vennlist$D_E_F
[1] "b"

$vennlist$A_B_C_D
character(0)

$vennlist$A_B_C_E
character(0)

$vennlist$A_B_C_F
[1] "s"

$vennlist$A_B_D_E
character(0)

$vennlist$A_B_D_F
[1] "e"

$vennlist$A_B_E_F
character(0)

$vennlist$A_C_D_E
[1] "g"

$vennlist$A_C_D_F
[1] "w"

$vennlist$A_C_E_F
character(0)

$vennlist$A_D_E_F
character(0)

$vennlist$B_C_D_E
character(0)

$vennlist$B_C_D_F
[1] "f" "i"

$vennlist$B_C_E_F
[1] "a" "q"

$vennlist$B_D_E_F
character(0)

$vennlist$C_D_E_F
[1] "k"

$vennlist$A_B_C_D_E
[1] "n" "o" "r"

$vennlist$A_B_C_D_F
character(0)

$vennlist$A_B_C_E_F
character(0)

$vennlist$A_B_D_E_F
[1] "d"

$vennlist$A_C_D_E_F
[1] "h" "u" "z"

$vennlist$B_C_D_E_F
character(0)

$vennlist$A_B_C_D_E_F
[1] "c" "l" "m" "p" "t"


> as.list(interset)
$setlist
$setlist$A
 [1] "s" "g" "w" "t" "h" "c" "p" "x" "d" "r" "l" "v" "e" "n" "u" "m" "z" "o"

$setlist$B
 [1] "a" "n" "s" "i" "q" "j" "e" "o" "r" "t" "c" "f" "p" "d" "m" "l"

$setlist$C
 [1] "s" "h" "i" "l" "p" "r" "q" "c" "u" "o" "t" "f" "a" "g" "n" "w" "z" "m" "y"
[20] "k"

$setlist$D
 [1] "c" "i" "k" "h" "r" "u" "n" "f" "j" "m" "l" "d" "b" "v" "e" "g" "z" "o" "p"
[20] "t" "w" "x"

$setlist$E
 [1] "m" "p" "q" "z" "r" "a" "g" "d" "u" "t" "n" "y" "o" "b" "k" "l" "c" "h"

$setlist$F
 [1] "w" "z" "l" "v" "a" "k" "q" "j" "u" "y" "m" "t" "d" "h" "x" "e" "s" "b" "f"
[20] "p" "i" "c"


$intersectmatrix
  A B C D E F
a 0 1 1 0 1 1
b 0 0 0 1 1 1
c 1 1 1 1 1 1
d 1 1 0 1 1 1
e 1 1 0 1 0 1
f 0 1 1 1 0 1
g 1 0 1 1 1 0
h 1 0 1 1 1 1
i 0 1 1 1 0 1
j 0 1 0 1 0 1
k 0 0 1 1 1 1
l 1 1 1 1 1 1
m 1 1 1 1 1 1
n 1 1 1 1 1 0
o 1 1 1 1 1 0
p 1 1 1 1 1 1
q 0 1 1 0 1 1
r 1 1 1 1 1 0
s 1 1 1 0 0 1
t 1 1 1 1 1 1
u 1 0 1 1 1 1
v 1 0 0 1 0 1
w 1 0 1 1 0 1
x 1 0 0 1 0 1
y 0 0 1 0 1 1
z 1 0 1 1 1 1

$complexitylevels
 [1] 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[39] 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 6

$intersectlist
$intersectlist$A
 [1] "c" "d" "e" "g" "h" "l" "m" "n" "o" "p" "r" "s" "t" "u" "v" "w" "x" "z"

$intersectlist$B
 [1] "a" "c" "d" "e" "f" "i" "j" "l" "m" "n" "o" "p" "q" "r" "s" "t"

$intersectlist$C
 [1] "a" "c" "f" "g" "h" "i" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "w" "y"
[20] "z"

$intersectlist$D
 [1] "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "r" "t" "u" "v"
[20] "w" "x" "z"

$intersectlist$E
 [1] "a" "b" "c" "d" "g" "h" "k" "l" "m" "n" "o" "p" "q" "r" "t" "u" "y" "z"

$intersectlist$F
 [1] "a" "b" "c" "d" "e" "f" "h" "i" "j" "k" "l" "m" "p" "q" "s" "t" "u" "v" "w"
[20] "x" "y" "z"

$intersectlist$A_B
 [1] "c" "d" "e" "l" "m" "n" "o" "p" "r" "s" "t"

$intersectlist$A_C
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "s" "t" "u" "w" "z"

$intersectlist$A_D
 [1] "c" "d" "e" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "v" "w" "x" "z"

$intersectlist$A_E
 [1] "c" "d" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$intersectlist$A_F
 [1] "c" "d" "e" "h" "l" "m" "p" "s" "t" "u" "v" "w" "x" "z"

$intersectlist$B_C
 [1] "a" "c" "f" "i" "l" "m" "n" "o" "p" "q" "r" "s" "t"

$intersectlist$B_D
 [1] "c" "d" "e" "f" "i" "j" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$B_E
 [1] "a" "c" "d" "l" "m" "n" "o" "p" "q" "r" "t"

$intersectlist$B_F
 [1] "a" "c" "d" "e" "f" "i" "j" "l" "m" "p" "q" "s" "t"

$intersectlist$C_D
 [1] "c" "f" "g" "h" "i" "k" "l" "m" "n" "o" "p" "r" "t" "u" "w" "z"

$intersectlist$C_E
 [1] "a" "c" "g" "h" "k" "l" "m" "n" "o" "p" "q" "r" "t" "u" "y" "z"

$intersectlist$C_F
 [1] "a" "c" "f" "h" "i" "k" "l" "m" "p" "q" "s" "t" "u" "w" "y" "z"

$intersectlist$D_E
 [1] "b" "c" "d" "g" "h" "k" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$intersectlist$D_F
 [1] "b" "c" "d" "e" "f" "h" "i" "j" "k" "l" "m" "p" "t" "u" "v" "w" "x" "z"

$intersectlist$E_F
 [1] "a" "b" "c" "d" "h" "k" "l" "m" "p" "q" "t" "u" "y" "z"

$intersectlist$A_B_C
[1] "c" "l" "m" "n" "o" "p" "r" "s" "t"

$intersectlist$A_B_D
 [1] "c" "d" "e" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$A_B_E
[1] "c" "d" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$A_B_F
[1] "c" "d" "e" "l" "m" "p" "s" "t"

$intersectlist$A_C_D
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "w" "z"

$intersectlist$A_C_E
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$intersectlist$A_C_F
 [1] "c" "h" "l" "m" "p" "s" "t" "u" "w" "z"

$intersectlist$A_D_E
 [1] "c" "d" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$intersectlist$A_D_F
 [1] "c" "d" "e" "h" "l" "m" "p" "t" "u" "v" "w" "x" "z"

$intersectlist$A_E_F
[1] "c" "d" "h" "l" "m" "p" "t" "u" "z"

$intersectlist$B_C_D
 [1] "c" "f" "i" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$B_C_E
 [1] "a" "c" "l" "m" "n" "o" "p" "q" "r" "t"

$intersectlist$B_C_F
 [1] "a" "c" "f" "i" "l" "m" "p" "q" "s" "t"

$intersectlist$B_D_E
[1] "c" "d" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$B_D_F
 [1] "c" "d" "e" "f" "i" "j" "l" "m" "p" "t"

$intersectlist$B_E_F
[1] "a" "c" "d" "l" "m" "p" "q" "t"

$intersectlist$C_D_E
 [1] "c" "g" "h" "k" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$intersectlist$C_D_F
 [1] "c" "f" "h" "i" "k" "l" "m" "p" "t" "u" "w" "z"

$intersectlist$C_E_F
 [1] "a" "c" "h" "k" "l" "m" "p" "q" "t" "u" "y" "z"

$intersectlist$D_E_F
 [1] "b" "c" "d" "h" "k" "l" "m" "p" "t" "u" "z"

$intersectlist$A_B_C_D
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$A_B_C_E
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$A_B_C_F
[1] "c" "l" "m" "p" "s" "t"

$intersectlist$A_B_D_E
[1] "c" "d" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$A_B_D_F
[1] "c" "d" "e" "l" "m" "p" "t"

$intersectlist$A_B_E_F
[1] "c" "d" "l" "m" "p" "t"

$intersectlist$A_C_D_E
 [1] "c" "g" "h" "l" "m" "n" "o" "p" "r" "t" "u" "z"

$intersectlist$A_C_D_F
[1] "c" "h" "l" "m" "p" "t" "u" "w" "z"

$intersectlist$A_C_E_F
[1] "c" "h" "l" "m" "p" "t" "u" "z"

$intersectlist$A_D_E_F
[1] "c" "d" "h" "l" "m" "p" "t" "u" "z"

$intersectlist$B_C_D_E
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$B_C_D_F
[1] "c" "f" "i" "l" "m" "p" "t"

$intersectlist$B_C_E_F
[1] "a" "c" "l" "m" "p" "q" "t"

$intersectlist$B_D_E_F
[1] "c" "d" "l" "m" "p" "t"

$intersectlist$C_D_E_F
[1] "c" "h" "k" "l" "m" "p" "t" "u" "z"

$intersectlist$A_B_C_D_E
[1] "c" "l" "m" "n" "o" "p" "r" "t"

$intersectlist$A_B_C_D_F
[1] "c" "l" "m" "p" "t"

$intersectlist$A_B_C_E_F
[1] "c" "l" "m" "p" "t"

$intersectlist$A_B_D_E_F
[1] "c" "d" "l" "m" "p" "t"

$intersectlist$A_C_D_E_F
[1] "c" "h" "l" "m" "p" "t" "u" "z"

$intersectlist$B_C_D_E_F
[1] "c" "l" "m" "p" "t"

$intersectlist$A_B_C_D_E_F
[1] "c" "l" "m" "p" "t"


> 
> ## Pairwise intersect matrix and heatmap
> olMA <- sapply(names(setlist), 
+ 		function(x) sapply(names(setlist), 
+ 		function(y) sum(setlist[[x]] %in% setlist[[y]])))
> olMA
   A  B  C  D  E  F
A 18 11 14 17 13 14
B 11 16 13 13 11 13
C 14 13 20 16 16 16
D 17 13 16 22 15 18
E 13 11 16 15 18 14
F 14 13 16 18 14 22
> heatmap(olMA, Rowv=NA, Colv=NA)
> 
> ## Presence-absence matrices for large numbers of sample sets
> interset <- overLapper(setlist=setlist, type="intersects", complexity=2)
> (paMA <- intersectmatrix(interset))
  A B C D E F
a 0 1 1 0 1 1
b 0 0 0 1 1 1
c 1 1 1 1 1 1
d 1 1 0 1 1 1
e 1 1 0 1 0 1
f 0 1 1 1 0 1
g 1 0 1 1 1 0
h 1 0 1 1 1 1
i 0 1 1 1 0 1
j 0 1 0 1 0 1
k 0 0 1 1 1 1
l 1 1 1 1 1 1
m 1 1 1 1 1 1
n 1 1 1 1 1 0
o 1 1 1 1 1 0
p 1 1 1 1 1 1
q 0 1 1 0 1 1
r 1 1 1 1 1 0
s 1 1 1 0 0 1
t 1 1 1 1 1 1
u 1 0 1 1 1 1
v 1 0 0 1 0 1
w 1 0 1 1 0 1
x 1 0 0 1 0 1
y 0 0 1 0 1 1
z 1 0 1 1 1 1
> heatmap(paMA, Rowv=NA, Colv=NA, col=c("white", "gray")) 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>