dba.report {DiffBind} | R Documentation

## Generate a report for a differential binding affinity analysis

### Description

Generates a report for a differential binding affinity analysis

### Usage

    dba.report(DBA, contrast, method=DBA$config$AnalysisMethod,
               th=DBA$config$th, bUsePval=DBA$config$bUsePval,
               fold=0, bNormalized=TRUE, bFlip=FALSE, precision,
               bCalled=FALSE, bCounts=FALSE, bCalledDetail=FALSE,
               bDB, bNotDB, bAll=TRUE, bGain=FALSE, bLoss=FALSE,
               file,initString=DBA$config$reportInit,ext='csv',
               DataType=DBA$config$DataType)

### Arguments

`DBA` | DBA object. A differential binding affinity analysis needs to have been previously carried out (see `dba.analyze`).

`contrast` | contrast number to report on. When generating a report-based DBA object, this can be a vector of contrast numbers. If missing, defaults to first contrast for reports, and all contrasts when generating a report-based DBA object. See `dba.show(DBA, bContrast=T)` to get contrast numbers.
`method` | method used for analysis: `DBA_DESEQ2` `DBA_DESEQ2_BLOCK` `DBA_EDGER` `DBA_EDGER_BLOCK` When generating a report-based DBA object (see `bDB` and `bNotDB` parameters below), a vector of methods may be supplied, including the shortcuts `DBA_ALL_METHODS` `DBA_ALL_BLOCK` `DBA_ALL_METHODS_BLOCK`
`th` | significance threshold; all sites with FDR (or p-values, see `bUsePval`) less than or equal to this value will be included in the report. A value of `1` will include all binding sites in the report.
`bUsePval` | logical indicating whether to use FDR (`FALSE`) or p-value (`TRUE`) for thresholding.
`fold` | only sites with an absolute log Fold value greater than equal to this will be included in the report.
`bNormalized` | logical indicating that normalized data (using normalization factors computed b y differential analysis method) should be reported. `FALSE` uses raw count data.
`bFlip` | logical indicating that order of groups in contrast should be "flipped", allowing control of which sample group will have positive and which will have negative fold changes.
`precision` | If present, alters the default precision for the `Concentration`, `Fold`, `p-value`, and `FDR` values in the returned report. A value of `0` indicates maximum precision. Otherwise, it should be a 2-value vector. The first value controls how many digits to the right of the decimal to include for concentration and fold values. These second value control how many digits to the right of the decimal to include for the p-value and FDRs. Default is `precision=2:3`, unless `DataType=DBA_DATA_SUMMARIZED_EXPERIMENT`, in which case the default is `0` (full precision).
`bCalled` | logical indicating that peak caller status should be included. This will add a column for each group, each indicating the number of samples in the group identified as a peak in the original peaksets. Note that this option is only available if the consensus peakset was calculated by `dba.count`; if a consensus peakset was passed in explicitly using the `peaks` parameter, original peak origins are lost.
`bCounts` | logical indicating that count data for individual samples should be reported as well as group statistics. Columns are added for each sample in the first group, followed by columns for each sample in the second group.
`bCalledDetail` | logical indicating that peak caller status should be included for each sample (if available). Columns are added for each sample in the first group, followed by columns for each sample in the second group.
`bDB` | logical indicating that a report-based DBA object should be generated, and that it should include Differentially Bound (DB) sites (respecting the `th`, `bUsePval`, and `fold` parameters).
`bNotDB` | logical indicating that a report-based DBA object should be generated, and that it should include non-Differentially Bound (non-DB) sites (respecting the `th`, `bUsePval`, and `fold` parameters).
`bAll` | logical indicating that a report-based DBA object should be generated, and that it should include peaksets combining peaks with both positive and negative fold changes.
`bGain` | logical indicating that a report-based DBA object should be generated, and that it should include peaksets with only positive fold changes.
`bLoss` | logical indicating that a report-based DBA object should be generated, and that it should include peaksets with only negative fold changes.
`file` | if present, also save the report to a comma separated value (csv) file, using this filename.
`initString` | if saving to a file, pre-pend this string to the filename.
`ext` | if saving to a file, append this extension to the filename.
`DataType` | The class of object for returned report: `DBA_DATA_GRANGES` `DBA_DATA_RANGEDDATA` `DBA_DATA_FRAME` If set to `DBA_DATA_SUMMARIZED_EXPERIMENT`, the result will be a `SummarizedExperiment` object, with all the count data and sample metadata for the experiment. The contrast statistics will be included as metadata columns in the `rowData` of the object. Can be set as default behavior by setting `DBA$config$DataType`.

### Value

if neither `bDB` or `bNotDB` is set to `TRUE`, a report dataframe or `GRanges` object is returned, with a row for each binding site within the thresholding parameters, and the following columns:

``Chr`` | Chromosome of binding site
``Start`` | Starting base position of binding site
``End`` | End base position of binding site
``Conc`` | Concentration – mean (log) reads across all samples in both groups
``Conc_group1`` | Group 1 Concentration – mean (log) reads across all samples first group
``Conc_group2`` | Group 2 Concentration – mean (log) reads across all samples in second group
``Fold`` | Fold difference – mean fold difference of binding affinity of group 1 over group 2 (Conc1 - Conc2). Absolute value indicates magnitude of the difference, and sign indicates which one is bound with higher affinity, with a positive value indicating higher affinity in the first group
``p-value`` | p-value calculation – statistic indicating significance of difference (likelihood difference is not attributable to chance)
``FDR`` | adjusted p-value calculation – p-value subjected to multiple-testing correction

If `bCalled` is `TRUE` and caller status is available, two more columns will follow:

``Called1`` | Number of samples in group 1 that identified this binding site as a peak
``Called2`` | Number of samples in group 2 that identified this binding site as a peak

If `bCounts` is `TRUE`, a column will be present for each sample in group 1, followed by each sample in group 2, if present. The `SampleID` will be used as the column header. This column contains the read counts for the sample.

If `bCalledDetail` is `TRUE`, a column will be present for each sample in group 1, followed by each sample in group 2, if present. The `SampleID` will be used as the column header. This column contains a "+" to indicate for which sites the sample was called as a peak, and a "-" if it was not so identified.

If `bDB` or `bNotDB` is set to `TRUE`, a special `DBA object` is returned, containing peaksets based on sites determined to be differentially bound (or not) as specified using the `bDB`, `bNotDB`, `bGain`, `bLoss`, and `bAll` parameters. In this `DBA object`, the `Tissue` value will specify the direction of the change (`Gain` for positive fold changes, `Loss` for negative fold changes, and `All` for any fold change). The `Factor` value specifies if the peaks are differentially bound (`DB`) or not (`!DB`). The `Condition` value specifies the analysis method (e.g. `edgeR`), and the `Treatment` value is blank for unblocked analyses and set to `block` for blocked analyses.

### Author(s)

Rory Stark

### See Also

`dba.analyze`, `DBA.config`.

### Examples

    data(tamoxifen_analysis)

    #Retrieve DB sites with FDR <  0.05
    tamoxifen.DB <- dba.report(tamoxifen)
    tamoxifen.DB

    #Retrieve DB sites with p-value <  0.05 and Fold > 2
    tamoxifen.DB <- dba.report(tamoxifen, th=.05, bUsePval=TRUE, fold=2)
    tamoxifen.DB

    #Retrieve all sites with confidence stats
    # and how many times each site was identified as a peak
    tamoxifen.DB <- dba.report(tamoxifen, th=1, bCalled=TRUE)
    tamoxifen.DB

    #Retrieve all sites with confidence stats and normalized counts
    tamoxifen.DB <- dba.report(tamoxifen, th=1, bCounts=TRUE)
    tamoxifen.DB

    #Retrieve all sites with confidence stats and raw counts
    tamoxifen.DB <- dba.report(tamoxifen, th=1, bCounts=TRUE,bNormalized=FALSE)
    tamoxifen.DB

    #Retrieve report as a SummarizedObject
    tamoxifen.sset <- dba.report(tamoxifen, DataType=DBA_DATA_SUMMARIZED_EXPERIMENT)
    tamoxifen.sset

    #Retrieve report-based DBA object
    data(tamoxifen_analysis)
    tamoxifen <- dba.analyze(tamoxifen,method=DBA_ALL_METHODS)
    tamoxifen.DB <- dba.report(tamoxifen,method=c(DBA_EDGER,DBA_DESEQ2),
                              bDB=TRUE)
    tamoxifen.DB
    dba.plotVenn(tamoxifen.DB,1:2)

[Package DiffBind version 3.2.7 Index]