plotOverlaps-methods: Plot Overlaps Between List Elements

plotOverlapsR Documentation

Plot Overlaps Between List Elements

Description

Plot Overlaps between list elements as an upset or Venn diagram

Usage

plotOverlaps(x, ...)

## S4 method for signature 'GRangesList'
plotOverlaps(
  x,
  type = c("auto", "venn", "upset"),
  var = NULL,
  f = c("mean", "median", "max", "min", "sd"),
  set_col = NULL,
  ...,
  .sort_sets = "ascending",
  hj_sets = 1.15,
  sz_sets = 3.5,
  exp_sets = 0.25,
  merge_within = 1L,
  ignore.strand = TRUE
)

## S4 method for signature 'list'
plotOverlaps(
  x,
  type = c("auto", "venn", "upset"),
  set_col = NULL,
  ...,
  .sort_sets = "ascending",
  hj_sets = 1.15,
  sz_sets = 3.5,
  exp_sets = 0.25
)

Arguments

x

GRangesList of S3 list able to be coerced to character vectors

...

Passed to draw.pairwise.venn (or draw.single/triple.venn) for Venn Diagrams, and to upset for UpSet plots

type

The type of plot to be produced

var

Column to summarised as a boxplot in an upper panel (UpSet plot only)

f

Summarisation function. Must return a single value from any numeric vector

set_col

Colours to be assigned to each set

.sort_sets

passed to sort_sets in upset

hj_sets

Horizontal adjustment of set size labels

sz_sets

Text size for set size labels. Passed internally to geom_text(size = sz_sets)

exp_sets

X-axis expansion for set size panel

merge_within

Passed to makeConsensus

ignore.strand

Passed to reduce

Details

This function should give the capability to show overlaps for any number of replicates or groups, or a list of items such as gene names. For n = 2, a scaled Venn Diagram will be produced, however no scaling is implemented for n = 3

UpSet plots are possible for any lists with length > 1, and are the only implemented possibility for lists > 3.

If the input is a GRangesList an additional boxplot can be requested using any numeric column within the existing mcols() element. Values will be summarised across all elements using the requested function and the boxplot will be included as an upper panel above the intersections

Value

Either a VennDiagram (i.e. grid) object, or a ComplexUpset plot

Examples

## Examples using a list of character vectors
ex <- list(
  x = letters[1:5], y = letters[c(6:15, 26)], z = letters[c(2, 10:25)]
)
plotOverlaps(ex, type = "upset")
plotOverlaps(ex, type = "venn", set_col = 1:3, alpha = 0.3)
plotOverlaps(ex, type = "upset", set_col = 1:3, labeller = stringr::str_to_title)
plotOverlaps(ex[1:2])

## GRangesList object will produce a boxplot of summarised values in the
## upper panel
data("peaks")
grl <- peaks[1:3]
names(grl) <- gsub("_peaks.+", "", names(grl))
plotOverlaps(grl, type = 'upset', var = 'score', f = 'max')

## If only two samples are present, a VennDiagram will be produced
plotOverlaps(grl[1:2], set_col = c("green", "blue"))


steveped/chipExtra documentation built on Aug. 1, 2024, 12:33 a.m.