findStretches {CAGEfightR} | R Documentation

## Find stretches of clusters

### Description

Finds stretches or groups of clusters along the genome, where each cluster is within a certain distance of the next. Once stretches have been identified, the average pairwise correlation between all clusters in the stretch is calculated. A typical use case is to look for stretches of enhancers, often refered to as "super enhancers".

### Usage

    findStretches(object, ...)

    ## S4 method for signature 'GRanges'
    findStretches(object, mergeDist = 10000L,
      minSize = 3L)

    ## S4 method for signature 'RangedSummarizedExperiment'
    findStretches(object, inputAssay,
      mergeDist = 10000L, minSize = 3L, corFun = cor, ...)

### Arguments

`object` | GRanges or RangedSummarizedExperiment: Clusters, possibly with expression for calculating correlations.
`...` | additional arguments passed to methods or ultimately corFun.
`mergeDist` | integer: Maximum distance between clusters to be merged into stretches.
`minSize` | integer: Minimum number of clusters in stretches.
`inputAssay` | character: Name of assay holding expression values (if object is a RangedSummarizedExperiment)
`corFun` | function: Function for calculating correlations. Should behave and produce output similar to cor().

### Value

A GRanges containing stretches with number of clusters and average pairwise correlations calculated. The revmap can be used to retrieve the original clusters (see example below.)

### See Also

Other Spatial functions: `findLinks`, `trackLinks`

### Examples

    # Calculate TPM values for bidirectional clusters
    data(exampleBidirectional)
    BCs <- calcTPM(exampleBidirectional)

    # Find stretches
    pearson_stretches <- findStretches(BCs, inputAssay="TPM")

    # Use Kendall instead of pearson and require bigger stretches
    kendall_stretches <- findStretches(BCs, inputAssay="TPM",
                                       minSize=5, method="kendall")

    # Use the revmap to get stretches as a GRangesList
    grl <- extractList(rowRanges(BCs), kendall_stretches$revmap)
    names(grl) <- names(kendall_stretches)

[Package CAGEfightR version 1.2.0 Index]