mergeRegions {htSeqTools} | R Documentation

## Merge nearby chromosomal regions.

### Description

Merges regions that are less than `maxDist` bases apart.

### Usage

    mergeRegions(intervals, chromosome, score, annot, aggregateFUN='median', maxDist=300)

### Arguments

`intervals` | Object indicating start and end of each region. It can either be a `matrix`, `data.frame`, `IRanges`, `RangedData` or an `RleViews` object. If a `matrix` or `data.frame`, it must have columns named `start` and `end`.
`chromosome` | Chromosome that the region belongs to (optional). If supplied, must be of the same length as `start` and `end`.
`score` | Numerical score for each interval. Scores in merged intervals are aggregated using function `aggregateFUN`. If `intervals` is of class `RangedData`, this should be a character vector of length 1 indicating the name of the variable in `values(x)` containing the score.
`annot` | Character indicating annotation information for each interval. Annotations in merged intervals are pasted in a single string (annotations appearing in more than one interval are only reported once in the merged interval).
`aggregateFUN` | Function to aggregate `score`.
`maxDist` | Regions less than `maxDist` apart are merged into a single region

### Value

The result is returned in a `data.frame` indicating the start and end of each merged interval. If the arguments were provided, the information in `chromosome`, `score` and `annot` is provided in additional columns. If the input argument `intervals` was of class `RangedData`, the results are returned in a `RangedData` object.

### Methods

`signature(intervals = "data.frame")`

  `intervals$start` and `intervals$end` give the interval start/end positions.

`signature(intervals = "IRanges")`

  `start(intervals)` and `end(intervals)` give the interval start/end positions.

`signature(intervals = "matrix")`

  The columns `start` and `end` in `intervals` give the interval start/end positions

`signature(intervals = "RangedData")`

  `start(intervals)` and `end(intervals)` give the interval start/end positions.

`signature(intervals = "RleViews")`

  `start(intervals)` and `end(intervals)` give the interval start/end positions.

### Author(s)

David Rossell

### Examples

    st <- c(10,20,1000)
    intervals <- RangedData(IRanges(st,st+10),space='chr1')

    intervals
    mergeRegions(intervals,maxDist=300)

[Package htSeqTools version 1.28.3 Index]