consolidateClusters {csaw} | R Documentation

## Consolidate DB clusters

### Description

Consolidate DB results from multiple analyses with cluster-level FDR control.

### Usage

    consolidateClusters(data.list, result.list, equiweight=TRUE, ...)

### Arguments

`data.list` | a list of RangedSummarizedExperiment and/or GRanges objects
`result.list` | a list of data frames containing the DB test results for each entry of `data.list`
`equiweight` | a logical scalar indicating whether equal weighting from each analysis should be enforced
`...` | arguments to be passed to `clusterWindows`

### Details

This function consolidates DB results from multiple analyses, typically involving different window sizes. The aim is to provide comprehensive detection of DB at a range of spatial resolutions. Significant windows from each analysis are identified and used for clustering with `clusterWindows`. This represents the post-hoc counterpart to `consolidateSizes`.

Some effort is required to equalize the contribution of the results from each analysis. This is done by setting `equiweight=TRUE`, where the weight of each window is inversely proportional to the number of windows from that analysis. These weights are used as frequency weights for window-level FDR control (to identify DB windows prior to clustering). Otherwise, the final results would be dominated by large number of small windows.

Users can cluster by the sign of log-fold changes, to obtain clusters of DB windows of the same sign. However, note that nested windows with opposite signs may give unintuitive results - see `mergeWindows` for details.

### Value

A named list is returned containing:

`id` | a list of integer vectors indicating the cluster ID for each window in `data.list`
`region` | a GRanges object containing the coordinates for each cluster
`FDR` | a numeric scalar containing the cluster-level FDR estimate

### Author(s)

Aaron Lun

### See Also

`clusterWindows`, `consolidateSizes`

### Examples

    # Making up some GRanges.
    low <- GRanges("chrA", IRanges(runif(100, 1, 1000), width=5))
    med <- GRanges("chrA", IRanges(runif(40, 1, 1000), width=10))
    high <- GRanges("chrA", IRanges(runif(10, 1, 1000), width=20))

    # Making up some DB results.
    dbl <- data.frame(logFC=rnorm(length(low)), PValue=rbeta(length(low), 1, 20))
    dbm <- data.frame(logFC=rnorm(length(med)), PValue=rbeta(length(med), 1, 20))
    dbh <- data.frame(logFC=rnorm(length(high)), PValue=rbeta(length(high), 1, 20))
    result.list <- list(dbl, dbm, dbh)

    # Consolidating.
    cons <- consolidateClusters(list(low, med, high), result.list, tol=20)
    cons$region
    cons$id
    cons$FDR

    # Without weights.
    cons <- consolidateClusters(list(low, med, high), result.list, tol=20, equiweight=FALSE)
    cons$FDR

    # Using the signs.
    cons <- consolidateClusters(list(low, med, high), result.list, tol=20, fc.col="logFC")

[Package csaw version 1.16.1 Index]