mergeRegions {regioneR} | R Documentation

## Merge Regions

### Description

Merges the overlapping regions from two region sets. The two region sets are first merged into one and then overlapping regions are fused.

### Usage

    mergeRegions(A, B)

### Arguments

`A` | a region set in any of the accepted formats by `toGRanges` (`GenomicRanges`, `data.frame`, etc...)
`B` | a region set in any of the accepted formats by `toGRanges` (`GenomicRanges`, `data.frame`, etc...)

### Value

It returns a `GenomicRanges` object with the regions resulting from the merging process. Any two overlapping regions from any of the two sets will be fused into one.

### Note

All metadata (additional columns in the region set in addition to chromosome, start and end) will be ignored and not present in the returned region set.

The implementation relies completely in the `reduce` function from `IRanges` package.

### See Also

`plotRegions`, `toDataframe`, `toGRanges`, `subtractRegions`, `splitRegions`, `extendRegions`, `joinRegions`, `commonRegions`, `overlapRegions`

### Examples

    A <- data.frame("chr1", c(1, 5, 20, 30), c(8, 13, 28, 40), x=c(1,2,3,4), y=c("a", "b", "c", "d"))

    B <- data.frame("chr1", 25, 35)

    merges <- mergeRegions(A, B)

    plotRegions(list(A, B, merges), chromosome="chr1", regions.labels=c("A", "B", "merges"), regions.colors=3:1)

[Package regioneR version 1.22.0 Index]