Learn R Programming

regioneR (version 1.4.0)

mergeRegions: 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.

See Also

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

Examples

Run this code
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)

Run the code above in your browser using DataLab