swapRanges {CAGEfightR} | R Documentation

## Swap ranges in a GRanges.

### Description

Swap out the range of a GRanges-object with another IRanges-object stored inside the same object. I.e., swapping cluster widths with cluster peaks.

### Usage

    swapRanges(object, ...)

    ## S4 method for signature 'GenomicRanges'
    swapRanges(object, inputColumn = "thick",
      outputColumn = NULL)

    ## S4 method for signature 'RangedSummarizedExperiment'
    swapRanges(object, ...)

### Arguments

`object` | GRanges or RangedSummarizedExperiment: Primary ranges to be swapped out.
`...` | additional arguments passed to methods.
`inputColumn` | character: Name of column holding IRanges to be swapped in.
`outputColumn` | character or NULL: Name of column to hold swapped out ranges, if NULL original ranges are not saved.

### Value

GRanges with inputColumn swapped in as ranges.

### See Also

Other Swapping functions: `swapScores`

### Examples

    data(exampleUnidirectional)
    gr <- rowRanges(exampleUnidirectional)

    # Swap in peaks as main ranges
    peaks <- swapRanges(gr)
    head(width(gr))
    head(width(peaks))

    # swapRanges() can also be directly called on a RangedSummarizedExperiment:
    swapRanges(exampleUnidirectional)

    # The original can optionally be saved in the output object
    swapRanges(gr, outputColumn = 'swapped')

[Package CAGEfightR version 1.6.0 Index]