Generates bar plots of the intersect counts of VENNset and INTERSECTset objects generated by the overLapper function. It is an alternative to Venn diagrames (e.g. vennPlot) that scales to larger numbers of label sets. By default the bars in the plot are colored and grouped by complexity levels of the intersect sets.

olBarplot(x, mincount = 0, complexity="default", myxlabel = "default", myylabel="Counts", mytitle = "default", ...)

Arguments

x

Object of class VENNset or INTERSECTset.

mincount

Sets minimum number of counts to consider in the bar plot. Default mincount=0 considers all counts.

complexity

Allows user to limit the bar plot to specific complexity levels of intersects by specifying the chosen ones with an integer vector. Default complexity="default" considers all complexity levels.

myxlabel

Defines label of x-axis.

myylabel

Defines label of y-axis.

mytitle

Defines main title of plot.

...

Allows to pass on additional arguments to geom_bar from ggplot2. For instance, fill=seq(along=vennlist(x)) or fill=seq(along=intersectlist(x)) will assign a different color to each bar, or fill="blue" will color all of them blue. The default bar coloring is by complexity levels of the intersect sets.

Value

Bar plot.

Author

Thomas Girke

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

See also

overLapper, vennPlot

Examples

## Sample data: list of vectors with object labels
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" "o" "p" "w" "i" "f" "x" "q" "a" "e" "u" "m" "r" "j" "g" "l" "d" "z"
#> 
#> $B
#>  [1] "u" "t" "x" "k" "v" "o" "m" "d" "r" "g" "s" "q" "f" "h" "c" "n"
#> 
#> $C
#>  [1] "h" "i" "c" "q" "o" "k" "e" "w" "r" "b" "l" "n" "y" "x" "p" "a" "d" "g" "j"
#> [20] "s"
#> 
#> $D
#>  [1] "h" "p" "w" "g" "d" "b" "z" "u" "m" "y" "q" "r" "s" "f" "l" "v" "e" "j" "x"
#> [20] "c" "i" "k"
#> 
#> $E
#>  [1] "e" "h" "c" "j" "d" "r" "f" "y" "w" "z" "b" "v" "u" "t" "a" "g" "x" "k"
#> 
#> $F
#>  [1] "e" "b" "s" "z" "l" "f" "y" "u" "h" "j" "x" "i" "w" "g" "r" "k" "c" "d" "p"
#> [20] "a" "q" "m"
#> 
intersectmatrix(vennset)
#>   A B C D E F
#> a 1 0 1 0 1 1
#> b 0 0 1 1 1 1
#> c 0 1 1 1 1 1
#> d 1 1 1 1 1 1
#> e 1 0 1 1 1 1
#> f 1 1 0 1 1 1
#> g 1 1 1 1 1 1
#> h 0 1 1 1 1 1
#> i 1 0 1 1 0 1
#> j 1 0 1 1 1 1
#> k 0 1 1 1 1 1
#> l 1 0 1 1 0 1
#> m 1 1 0 1 0 1
#> n 0 1 1 0 0 0
#> o 1 1 1 0 0 0
#> p 1 0 1 1 0 1
#> q 1 1 1 1 0 1
#> r 1 1 1 1 1 1
#> s 1 1 1 1 0 1
#> t 0 1 0 0 1 0
#> u 1 1 0 1 1 1
#> v 0 1 0 1 1 0
#> w 1 0 1 1 1 1
#> x 1 1 1 1 1 1
#> y 0 0 1 1 1 1
#> z 1 0 0 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
#> [1] "n"
#> 
#> $B_D
#> character(0)
#> 
#> $B_E
#> [1] "t"
#> 
#> $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
#> [1] "o"
#> 
#> $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
#> character(0)
#> 
#> $A_E_F
#> character(0)
#> 
#> $B_C_D
#> character(0)
#> 
#> $B_C_E
#> character(0)
#> 
#> $B_C_F
#> character(0)
#> 
#> $B_D_E
#> [1] "v"
#> 
#> $B_D_F
#> character(0)
#> 
#> $B_E_F
#> character(0)
#> 
#> $C_D_E
#> character(0)
#> 
#> $C_D_F
#> character(0)
#> 
#> $C_E_F
#> character(0)
#> 
#> $D_E_F
#> character(0)
#> 
#> $A_B_C_D
#> character(0)
#> 
#> $A_B_C_E
#> character(0)
#> 
#> $A_B_C_F
#> character(0)
#> 
#> $A_B_D_E
#> character(0)
#> 
#> $A_B_D_F
#> [1] "m"
#> 
#> $A_B_E_F
#> character(0)
#> 
#> $A_C_D_E
#> character(0)
#> 
#> $A_C_D_F
#> [1] "i" "l" "p"
#> 
#> $A_C_E_F
#> [1] "a"
#> 
#> $A_D_E_F
#> [1] "z"
#> 
#> $B_C_D_E
#> character(0)
#> 
#> $B_C_D_F
#> character(0)
#> 
#> $B_C_E_F
#> character(0)
#> 
#> $B_D_E_F
#> character(0)
#> 
#> $C_D_E_F
#> [1] "b" "y"
#> 
#> $A_B_C_D_E
#> character(0)
#> 
#> $A_B_C_D_F
#> [1] "q" "s"
#> 
#> $A_B_C_E_F
#> character(0)
#> 
#> $A_B_D_E_F
#> [1] "f" "u"
#> 
#> $A_C_D_E_F
#> [1] "e" "j" "w"
#> 
#> $B_C_D_E_F
#> [1] "c" "h" "k"
#> 
#> $A_B_C_D_E_F
#> [1] "d" "g" "r" "x"
#> 
intersectlist(interset)
#> $A
#>  [1] "a" "d" "e" "f" "g" "i" "j" "l" "m" "o" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $B
#>  [1] "c" "d" "f" "g" "h" "k" "m" "n" "o" "q" "r" "s" "t" "u" "v" "x"
#> 
#> $C
#>  [1] "a" "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "n" "o" "p" "q" "r" "s" "w" "x"
#> [20] "y"
#> 
#> $D
#>  [1] "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "p" "q" "r" "s" "u" "v" "w"
#> [20] "x" "y" "z"
#> 
#> $E
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "t" "u" "v" "w" "x" "y" "z"
#> 
#> $F
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "p" "q" "r" "s" "u" "w"
#> [20] "x" "y" "z"
#> 
#> $A_B
#>  [1] "d" "f" "g" "m" "o" "q" "r" "s" "u" "x"
#> 
#> $A_C
#>  [1] "a" "d" "e" "g" "i" "j" "l" "o" "p" "q" "r" "s" "w" "x"
#> 
#> $A_D
#>  [1] "d" "e" "f" "g" "i" "j" "l" "m" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $A_E
#>  [1] "a" "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $A_F
#>  [1] "a" "d" "e" "f" "g" "i" "j" "l" "m" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $B_C
#>  [1] "c" "d" "g" "h" "k" "n" "o" "q" "r" "s" "x"
#> 
#> $B_D
#>  [1] "c" "d" "f" "g" "h" "k" "m" "q" "r" "s" "u" "v" "x"
#> 
#> $B_E
#>  [1] "c" "d" "f" "g" "h" "k" "r" "t" "u" "v" "x"
#> 
#> $B_F
#>  [1] "c" "d" "f" "g" "h" "k" "m" "q" "r" "s" "u" "x"
#> 
#> $C_D
#>  [1] "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "p" "q" "r" "s" "w" "x" "y"
#> 
#> $C_E
#>  [1] "a" "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $C_F
#>  [1] "a" "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "p" "q" "r" "s" "w" "x" "y"
#> 
#> $D_E
#>  [1] "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "u" "v" "w" "x" "y" "z"
#> 
#> $D_F
#>  [1] "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "p" "q" "r" "s" "u" "w" "x"
#> [20] "y" "z"
#> 
#> $E_F
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "u" "w" "x" "y" "z"
#> 
#> $A_B_C
#> [1] "d" "g" "o" "q" "r" "s" "x"
#> 
#> $A_B_D
#> [1] "d" "f" "g" "m" "q" "r" "s" "u" "x"
#> 
#> $A_B_E
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $A_B_F
#> [1] "d" "f" "g" "m" "q" "r" "s" "u" "x"
#> 
#> $A_C_D
#>  [1] "d" "e" "g" "i" "j" "l" "p" "q" "r" "s" "w" "x"
#> 
#> $A_C_E
#> [1] "a" "d" "e" "g" "j" "r" "w" "x"
#> 
#> $A_C_F
#>  [1] "a" "d" "e" "g" "i" "j" "l" "p" "q" "r" "s" "w" "x"
#> 
#> $A_D_E
#>  [1] "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $A_D_F
#>  [1] "d" "e" "f" "g" "i" "j" "l" "m" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $A_E_F
#>  [1] "a" "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $B_C_D
#> [1] "c" "d" "g" "h" "k" "q" "r" "s" "x"
#> 
#> $B_C_E
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $B_C_F
#> [1] "c" "d" "g" "h" "k" "q" "r" "s" "x"
#> 
#> $B_D_E
#>  [1] "c" "d" "f" "g" "h" "k" "r" "u" "v" "x"
#> 
#> $B_D_F
#>  [1] "c" "d" "f" "g" "h" "k" "m" "q" "r" "s" "u" "x"
#> 
#> $B_E_F
#> [1] "c" "d" "f" "g" "h" "k" "r" "u" "x"
#> 
#> $C_D_E
#>  [1] "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $C_D_F
#>  [1] "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "p" "q" "r" "s" "w" "x" "y"
#> 
#> $C_E_F
#>  [1] "a" "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $D_E_F
#>  [1] "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "u" "w" "x" "y" "z"
#> 
#> $A_B_C_D
#> [1] "d" "g" "q" "r" "s" "x"
#> 
#> $A_B_C_E
#> [1] "d" "g" "r" "x"
#> 
#> $A_B_C_F
#> [1] "d" "g" "q" "r" "s" "x"
#> 
#> $A_B_D_E
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $A_B_D_F
#> [1] "d" "f" "g" "m" "q" "r" "s" "u" "x"
#> 
#> $A_B_E_F
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $A_C_D_E
#> [1] "d" "e" "g" "j" "r" "w" "x"
#> 
#> $A_C_D_F
#>  [1] "d" "e" "g" "i" "j" "l" "p" "q" "r" "s" "w" "x"
#> 
#> $A_C_E_F
#> [1] "a" "d" "e" "g" "j" "r" "w" "x"
#> 
#> $A_D_E_F
#>  [1] "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $B_C_D_E
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $B_C_D_F
#> [1] "c" "d" "g" "h" "k" "q" "r" "s" "x"
#> 
#> $B_C_E_F
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $B_D_E_F
#> [1] "c" "d" "f" "g" "h" "k" "r" "u" "x"
#> 
#> $C_D_E_F
#>  [1] "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $A_B_C_D_E
#> [1] "d" "g" "r" "x"
#> 
#> $A_B_C_D_F
#> [1] "d" "g" "q" "r" "s" "x"
#> 
#> $A_B_C_E_F
#> [1] "d" "g" "r" "x"
#> 
#> $A_B_D_E_F
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $A_C_D_E_F
#> [1] "d" "e" "g" "j" "r" "w" "x"
#> 
#> $B_C_D_E_F
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $A_B_C_D_E_F
#> [1] "d" "g" "r" "x"
#> 

## Coerce VENNset/INTERSECTset object to list
as.list(vennset)
#> $setlist
#> $setlist$A
#>  [1] "s" "o" "p" "w" "i" "f" "x" "q" "a" "e" "u" "m" "r" "j" "g" "l" "d" "z"
#> 
#> $setlist$B
#>  [1] "u" "t" "x" "k" "v" "o" "m" "d" "r" "g" "s" "q" "f" "h" "c" "n"
#> 
#> $setlist$C
#>  [1] "h" "i" "c" "q" "o" "k" "e" "w" "r" "b" "l" "n" "y" "x" "p" "a" "d" "g" "j"
#> [20] "s"
#> 
#> $setlist$D
#>  [1] "h" "p" "w" "g" "d" "b" "z" "u" "m" "y" "q" "r" "s" "f" "l" "v" "e" "j" "x"
#> [20] "c" "i" "k"
#> 
#> $setlist$E
#>  [1] "e" "h" "c" "j" "d" "r" "f" "y" "w" "z" "b" "v" "u" "t" "a" "g" "x" "k"
#> 
#> $setlist$F
#>  [1] "e" "b" "s" "z" "l" "f" "y" "u" "h" "j" "x" "i" "w" "g" "r" "k" "c" "d" "p"
#> [20] "a" "q" "m"
#> 
#> 
#> $intersectmatrix
#>   A B C D E F
#> a 1 0 1 0 1 1
#> b 0 0 1 1 1 1
#> c 0 1 1 1 1 1
#> d 1 1 1 1 1 1
#> e 1 0 1 1 1 1
#> f 1 1 0 1 1 1
#> g 1 1 1 1 1 1
#> h 0 1 1 1 1 1
#> i 1 0 1 1 0 1
#> j 1 0 1 1 1 1
#> k 0 1 1 1 1 1
#> l 1 0 1 1 0 1
#> m 1 1 0 1 0 1
#> n 0 1 1 0 0 0
#> o 1 1 1 0 0 0
#> p 1 0 1 1 0 1
#> q 1 1 1 1 0 1
#> r 1 1 1 1 1 1
#> s 1 1 1 1 0 1
#> t 0 1 0 0 1 0
#> u 1 1 0 1 1 1
#> v 0 1 0 1 1 0
#> w 1 0 1 1 1 1
#> x 1 1 1 1 1 1
#> y 0 0 1 1 1 1
#> z 1 0 0 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
#> [1] "n"
#> 
#> $vennlist$B_D
#> character(0)
#> 
#> $vennlist$B_E
#> [1] "t"
#> 
#> $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
#> [1] "o"
#> 
#> $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
#> character(0)
#> 
#> $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
#> [1] "v"
#> 
#> $vennlist$B_D_F
#> character(0)
#> 
#> $vennlist$B_E_F
#> character(0)
#> 
#> $vennlist$C_D_E
#> character(0)
#> 
#> $vennlist$C_D_F
#> character(0)
#> 
#> $vennlist$C_E_F
#> character(0)
#> 
#> $vennlist$D_E_F
#> character(0)
#> 
#> $vennlist$A_B_C_D
#> character(0)
#> 
#> $vennlist$A_B_C_E
#> character(0)
#> 
#> $vennlist$A_B_C_F
#> character(0)
#> 
#> $vennlist$A_B_D_E
#> character(0)
#> 
#> $vennlist$A_B_D_F
#> [1] "m"
#> 
#> $vennlist$A_B_E_F
#> character(0)
#> 
#> $vennlist$A_C_D_E
#> character(0)
#> 
#> $vennlist$A_C_D_F
#> [1] "i" "l" "p"
#> 
#> $vennlist$A_C_E_F
#> [1] "a"
#> 
#> $vennlist$A_D_E_F
#> [1] "z"
#> 
#> $vennlist$B_C_D_E
#> character(0)
#> 
#> $vennlist$B_C_D_F
#> character(0)
#> 
#> $vennlist$B_C_E_F
#> character(0)
#> 
#> $vennlist$B_D_E_F
#> character(0)
#> 
#> $vennlist$C_D_E_F
#> [1] "b" "y"
#> 
#> $vennlist$A_B_C_D_E
#> character(0)
#> 
#> $vennlist$A_B_C_D_F
#> [1] "q" "s"
#> 
#> $vennlist$A_B_C_E_F
#> character(0)
#> 
#> $vennlist$A_B_D_E_F
#> [1] "f" "u"
#> 
#> $vennlist$A_C_D_E_F
#> [1] "e" "j" "w"
#> 
#> $vennlist$B_C_D_E_F
#> [1] "c" "h" "k"
#> 
#> $vennlist$A_B_C_D_E_F
#> [1] "d" "g" "r" "x"
#> 
#> 
as.list(interset)
#> $setlist
#> $setlist$A
#>  [1] "s" "o" "p" "w" "i" "f" "x" "q" "a" "e" "u" "m" "r" "j" "g" "l" "d" "z"
#> 
#> $setlist$B
#>  [1] "u" "t" "x" "k" "v" "o" "m" "d" "r" "g" "s" "q" "f" "h" "c" "n"
#> 
#> $setlist$C
#>  [1] "h" "i" "c" "q" "o" "k" "e" "w" "r" "b" "l" "n" "y" "x" "p" "a" "d" "g" "j"
#> [20] "s"
#> 
#> $setlist$D
#>  [1] "h" "p" "w" "g" "d" "b" "z" "u" "m" "y" "q" "r" "s" "f" "l" "v" "e" "j" "x"
#> [20] "c" "i" "k"
#> 
#> $setlist$E
#>  [1] "e" "h" "c" "j" "d" "r" "f" "y" "w" "z" "b" "v" "u" "t" "a" "g" "x" "k"
#> 
#> $setlist$F
#>  [1] "e" "b" "s" "z" "l" "f" "y" "u" "h" "j" "x" "i" "w" "g" "r" "k" "c" "d" "p"
#> [20] "a" "q" "m"
#> 
#> 
#> $intersectmatrix
#>   A B C D E F
#> a 1 0 1 0 1 1
#> b 0 0 1 1 1 1
#> c 0 1 1 1 1 1
#> d 1 1 1 1 1 1
#> e 1 0 1 1 1 1
#> f 1 1 0 1 1 1
#> g 1 1 1 1 1 1
#> h 0 1 1 1 1 1
#> i 1 0 1 1 0 1
#> j 1 0 1 1 1 1
#> k 0 1 1 1 1 1
#> l 1 0 1 1 0 1
#> m 1 1 0 1 0 1
#> n 0 1 1 0 0 0
#> o 1 1 1 0 0 0
#> p 1 0 1 1 0 1
#> q 1 1 1 1 0 1
#> r 1 1 1 1 1 1
#> s 1 1 1 1 0 1
#> t 0 1 0 0 1 0
#> u 1 1 0 1 1 1
#> v 0 1 0 1 1 0
#> w 1 0 1 1 1 1
#> x 1 1 1 1 1 1
#> y 0 0 1 1 1 1
#> z 1 0 0 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] "a" "d" "e" "f" "g" "i" "j" "l" "m" "o" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $intersectlist$B
#>  [1] "c" "d" "f" "g" "h" "k" "m" "n" "o" "q" "r" "s" "t" "u" "v" "x"
#> 
#> $intersectlist$C
#>  [1] "a" "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "n" "o" "p" "q" "r" "s" "w" "x"
#> [20] "y"
#> 
#> $intersectlist$D
#>  [1] "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "p" "q" "r" "s" "u" "v" "w"
#> [20] "x" "y" "z"
#> 
#> $intersectlist$E
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "t" "u" "v" "w" "x" "y" "z"
#> 
#> $intersectlist$F
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "p" "q" "r" "s" "u" "w"
#> [20] "x" "y" "z"
#> 
#> $intersectlist$A_B
#>  [1] "d" "f" "g" "m" "o" "q" "r" "s" "u" "x"
#> 
#> $intersectlist$A_C
#>  [1] "a" "d" "e" "g" "i" "j" "l" "o" "p" "q" "r" "s" "w" "x"
#> 
#> $intersectlist$A_D
#>  [1] "d" "e" "f" "g" "i" "j" "l" "m" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $intersectlist$A_E
#>  [1] "a" "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $intersectlist$A_F
#>  [1] "a" "d" "e" "f" "g" "i" "j" "l" "m" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $intersectlist$B_C
#>  [1] "c" "d" "g" "h" "k" "n" "o" "q" "r" "s" "x"
#> 
#> $intersectlist$B_D
#>  [1] "c" "d" "f" "g" "h" "k" "m" "q" "r" "s" "u" "v" "x"
#> 
#> $intersectlist$B_E
#>  [1] "c" "d" "f" "g" "h" "k" "r" "t" "u" "v" "x"
#> 
#> $intersectlist$B_F
#>  [1] "c" "d" "f" "g" "h" "k" "m" "q" "r" "s" "u" "x"
#> 
#> $intersectlist$C_D
#>  [1] "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "p" "q" "r" "s" "w" "x" "y"
#> 
#> $intersectlist$C_E
#>  [1] "a" "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $intersectlist$C_F
#>  [1] "a" "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "p" "q" "r" "s" "w" "x" "y"
#> 
#> $intersectlist$D_E
#>  [1] "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "u" "v" "w" "x" "y" "z"
#> 
#> $intersectlist$D_F
#>  [1] "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "p" "q" "r" "s" "u" "w" "x"
#> [20] "y" "z"
#> 
#> $intersectlist$E_F
#>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "u" "w" "x" "y" "z"
#> 
#> $intersectlist$A_B_C
#> [1] "d" "g" "o" "q" "r" "s" "x"
#> 
#> $intersectlist$A_B_D
#> [1] "d" "f" "g" "m" "q" "r" "s" "u" "x"
#> 
#> $intersectlist$A_B_E
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $intersectlist$A_B_F
#> [1] "d" "f" "g" "m" "q" "r" "s" "u" "x"
#> 
#> $intersectlist$A_C_D
#>  [1] "d" "e" "g" "i" "j" "l" "p" "q" "r" "s" "w" "x"
#> 
#> $intersectlist$A_C_E
#> [1] "a" "d" "e" "g" "j" "r" "w" "x"
#> 
#> $intersectlist$A_C_F
#>  [1] "a" "d" "e" "g" "i" "j" "l" "p" "q" "r" "s" "w" "x"
#> 
#> $intersectlist$A_D_E
#>  [1] "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $intersectlist$A_D_F
#>  [1] "d" "e" "f" "g" "i" "j" "l" "m" "p" "q" "r" "s" "u" "w" "x" "z"
#> 
#> $intersectlist$A_E_F
#>  [1] "a" "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $intersectlist$B_C_D
#> [1] "c" "d" "g" "h" "k" "q" "r" "s" "x"
#> 
#> $intersectlist$B_C_E
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $intersectlist$B_C_F
#> [1] "c" "d" "g" "h" "k" "q" "r" "s" "x"
#> 
#> $intersectlist$B_D_E
#>  [1] "c" "d" "f" "g" "h" "k" "r" "u" "v" "x"
#> 
#> $intersectlist$B_D_F
#>  [1] "c" "d" "f" "g" "h" "k" "m" "q" "r" "s" "u" "x"
#> 
#> $intersectlist$B_E_F
#> [1] "c" "d" "f" "g" "h" "k" "r" "u" "x"
#> 
#> $intersectlist$C_D_E
#>  [1] "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $intersectlist$C_D_F
#>  [1] "b" "c" "d" "e" "g" "h" "i" "j" "k" "l" "p" "q" "r" "s" "w" "x" "y"
#> 
#> $intersectlist$C_E_F
#>  [1] "a" "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $intersectlist$D_E_F
#>  [1] "b" "c" "d" "e" "f" "g" "h" "j" "k" "r" "u" "w" "x" "y" "z"
#> 
#> $intersectlist$A_B_C_D
#> [1] "d" "g" "q" "r" "s" "x"
#> 
#> $intersectlist$A_B_C_E
#> [1] "d" "g" "r" "x"
#> 
#> $intersectlist$A_B_C_F
#> [1] "d" "g" "q" "r" "s" "x"
#> 
#> $intersectlist$A_B_D_E
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $intersectlist$A_B_D_F
#> [1] "d" "f" "g" "m" "q" "r" "s" "u" "x"
#> 
#> $intersectlist$A_B_E_F
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $intersectlist$A_C_D_E
#> [1] "d" "e" "g" "j" "r" "w" "x"
#> 
#> $intersectlist$A_C_D_F
#>  [1] "d" "e" "g" "i" "j" "l" "p" "q" "r" "s" "w" "x"
#> 
#> $intersectlist$A_C_E_F
#> [1] "a" "d" "e" "g" "j" "r" "w" "x"
#> 
#> $intersectlist$A_D_E_F
#>  [1] "d" "e" "f" "g" "j" "r" "u" "w" "x" "z"
#> 
#> $intersectlist$B_C_D_E
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $intersectlist$B_C_D_F
#> [1] "c" "d" "g" "h" "k" "q" "r" "s" "x"
#> 
#> $intersectlist$B_C_E_F
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $intersectlist$B_D_E_F
#> [1] "c" "d" "f" "g" "h" "k" "r" "u" "x"
#> 
#> $intersectlist$C_D_E_F
#>  [1] "b" "c" "d" "e" "g" "h" "j" "k" "r" "w" "x" "y"
#> 
#> $intersectlist$A_B_C_D_E
#> [1] "d" "g" "r" "x"
#> 
#> $intersectlist$A_B_C_D_F
#> [1] "d" "g" "q" "r" "s" "x"
#> 
#> $intersectlist$A_B_C_E_F
#> [1] "d" "g" "r" "x"
#> 
#> $intersectlist$A_B_D_E_F
#> [1] "d" "f" "g" "r" "u" "x"
#> 
#> $intersectlist$A_C_D_E_F
#> [1] "d" "e" "g" "j" "r" "w" "x"
#> 
#> $intersectlist$B_C_D_E_F
#> [1] "c" "d" "g" "h" "k" "r" "x"
#> 
#> $intersectlist$A_B_C_D_E_F
#> [1] "d" "g" "r" "x"
#> 
#> 

## 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 10 14 16 11 17
#> B 10 16 11 13 11 12
#> C 14 11 20 17 13 18
#> D 16 13 17 22 16 21
#> E 11 11 13 16 18 16
#> F 17 12 18 21 16 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 1 0 1 0 1 1
#> b 0 0 1 1 1 1
#> c 0 1 1 1 1 1
#> d 1 1 1 1 1 1
#> e 1 0 1 1 1 1
#> f 1 1 0 1 1 1
#> g 1 1 1 1 1 1
#> h 0 1 1 1 1 1
#> i 1 0 1 1 0 1
#> j 1 0 1 1 1 1
#> k 0 1 1 1 1 1
#> l 1 0 1 1 0 1
#> m 1 1 0 1 0 1
#> n 0 1 1 0 0 0
#> o 1 1 1 0 0 0
#> p 1 0 1 1 0 1
#> q 1 1 1 1 0 1
#> r 1 1 1 1 1 1
#> s 1 1 1 1 0 1
#> t 0 1 0 0 1 0
#> u 1 1 0 1 1 1
#> v 0 1 0 1 1 0
#> w 1 0 1 1 1 1
#> x 1 1 1 1 1 1
#> y 0 0 1 1 1 1
#> z 1 0 0 1 1 1
heatmap(paMA, Rowv=NA, Colv=NA, col=c("white", "gray"))