dba.plotVenn {DiffBind} | R Documentation

## Draw 2-way, 3-way, or 4-way Venn diagrams of overlaps

### Description

Draws 2-way, 3-way, or 4-way Venn diagrams of overlaps

### Usage

    dba.plotVenn(DBA, mask, overlaps, label1, label2, label3, label4, main, sub,
                 contrast, method=DBA$config$AnalysisMethod,
                 th=DBA$config$th, bUsePval=DBA$config$bUsePval,
                 bDB=TRUE, bNotDB, bAll=TRUE, bGain=FALSE, bLoss=FALSE,
                 labelAttributes, DataType=DBA$config$DataType)

### Arguments

`DBA` | DBA object; if present, only the mask parameter will apply.
`mask` | mask or vector of peakset numbers indicating which peaksets to include in Venn diagram. Only 2 or 3 peaksets should be included. See `dba.mask`. Only one of mask or overlaps is used.
`overlaps` | overlap record, as computed by `dba.overlap(Report=DBA_OLAP_PEAKS)`. Only one of mask or overlaps is used.

`label1` | label for first peakset in diagram
`label2` | label for second peakset in diagram
`label3` | label for third peakset in diagram
`label4` | label for fourth peakset in diagram
`main` | main title for plot
`sub` | subtitle for plot
`contrast` | contrast number(s) to use for results-based plots. This can be a vector of contrast numbers. See `dba.show(DBA, bContrast=T)` to get contrast numbers.
`method` | if `contrast` is specified, include results from analyses using this method or methods: DBA_DESEQ2 DBA_DESEQ2_BLOCK DBA_EDGER DBA_EDGER_BLOCK DBA_ALL_METHODS DBA_ALL_BLOCK DBA_ALL_METHODS_BLOCK
`th` | if `contrast` is specified, use this significance threshold; all sites with FDR (or p-values, see bUsePval) less than or equal to this value will be considered differentially bound (DB).
`bUsePval` | if `contrast` is specified, this logical indicates whether to use FDR (FALSE) or p-value (TRUE) for thresholding.
`bDB` | if `contrast` is specified, this logical indicates that peaksets should include Differentially Bound (DB) sites (respecting the `th`, `bUsePval`, and `fold` parameters).
`bNotDB` | if `contrast` is specified, this logical indicates that peaksets should include non-Differentially Bound (non-DB) sites (respecting the `th`, `bUsePval`, and `fold` parameters).
`bAll` | if `contrast` is specified, this logical indicates peaksets combining peaks with both positive and negative fold changes should be included.
`bGain` | if `contrast` is specified, this logical indicates that peaksets with only positive fold changes should be included.
`bLoss` | if `contrast` is specified, this logical indicates that peaksets with only negative fold changes should be included.
`labelAttributes` | is `label`s are not specified, use these attributes to create default labels: DBA_ID DBA_TISSUE DBA_FACTOR DBA_CONDITION DBA_TREATMENT DBA_REPLICATE DBA_CONSENSUS DBA_CALLER Only specified attributes that differ between peaksets will be used for labels; the ones that have the same value for all peaksets will be used as the default subtitle.

`DataType` | if `bReturnPeaksets` is set to `TRUE`, the class of object that peaksets should be returned as: DBA_DATA_GRANGES DBA_DATA_RANGEDDATA DBA_DATA_FRAME Can be set as default behavior by setting DBA$config$DataType. Alternatively, this can be set to: DBA_DATA_DBAOBJECT to return a results-based DBA object, if a `contrast` is specified.

### Value

Either a list of peaksets is returned invisibly (as decribed in `dba.overlap`), or, if `DataType=DBA_DATA_DBAOBJECT`, a results-based DBA object.

### Note

When working with results overlaps (a least one `contrast` is specified), and results-oriented DBA object is generated internally (as decribed in `dba.report`). In some cases, it may be better to generate the DBA object explicitly (using `dba.report` or setting `bReturnPeaksets=TRUE` and `DataType=DBA_DATA_DBAOBJECT`). This include the case where mseveral plots are being made of the same results set, and it takes a long time to generate the results-based DBA object, as well as the case where there are more than four results peaksets and a mask needs to be specified. I

This function relies on `vennPlot` in the `systemPipeR` package, written by Thomas Girke.

### Author(s)

Rory Stark

### See Also

`dba.analyze`, `dba.overlap`, `dba.report`, `dba.plotPCA`, `vennPlot`

### Examples

    data(tamoxifen_peaks)

    par(mfrow=c(2,2))
    # 2-way Venn
    dba.plotVenn(tamoxifen,6:7)
    dba.plotVenn(tamoxifen,tamoxifen$masks$ZR75)

    # 3-way Venn (done two different ways)
    dba.plotVenn(tamoxifen,tamoxifen$masks$MCF7&tamoxifen$masks$Responsive)
    olaps <- dba.overlap(tamoxifen,tamoxifen$masks$MCF7&tamoxifen$masks$Responsive)
    dba.plotVenn(tamoxifen,overlaps=olaps,
                 label1="Rep 1",label2="Rep 2",label3="Rep 3",main="MCF7 (Responsive) Replicates")

    #Venn of overlaps
    Responsive=dba(tamoxifen,tamoxifen$masks$Responsive)
    Responsive
    Responsive <- dba.peakset(Responsive,1:3,sampID="MCF7")
    Responsive <- dba.peakset(Responsive,4:5,sampID="T47D")
    Responsive <- dba.peakset(Responsive,6:7,sampID="ZR75")
    par(mfrow=c(1,1))
    dba.plotVenn(Responsive,Responsive$masks$Consensus)

    #4-way overlap
    data(tamoxifen_peaks)
    tamoxifen <- dba.peakset(tamoxifen, consensus=DBA_TISSUE)
    par(mfrow=c(1,1))
    dba.plotVenn(tamoxifen,tamoxifen$masks$Consensus,main="Tissue consensus overlaps")

    #Venns of differentially bound sites
    data(tamoxifen_analysis)
    tamoxifen <- dba.contrast(tamoxifen,categories=DBA_CONDITION,block=tamoxifen$masks$MCF7)
    tamoxifen <- dba.analyze(tamoxifen,method=c(DBA_EDGER,DBA_DESEQ2))
    dba.plotVenn(tamoxifen,contrast=1,method=DBA_ALL_METHODS_BLOCK)
    dba.plotVenn(tamoxifen,contrast=1,method=DBA_ALL_BLOCK,bAll=FALSE,bGain=TRUE,bLoss=TRUE)
    par(mfrow=c(2,1))
    dba.plotVenn(tamoxifen,contrast=1,method=DBA_ALL_BLOCK,bAll=FALSE,bGain=TRUE,bLoss=FALSE)
    dba.plotVenn(tamoxifen,contrast=1,method=DBA_ALL_BLOCK,bAll=FALSE,bGain=FALSE,bLoss=TRUE)

[Package DiffBind version 2.10.0 Index]