subtractRegions {regioneR} | R Documentation

## Subtract Regions

### Description

Function for subtracting a region set from another region set.

### Usage

    subtractRegions(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...)

### Details

This function returns the regions in A minus the parts of them overlapping the regions in B. Overlapping regions in the result will be fused.

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

### Value

A GenomicRanges object

### Examples

    A <- data.frame(chr=1, start=c(1, 15, 24, 31), end=c(10, 20, 30, 35))

    B <- data.frame(chr=1, start=c(2, 12, 24, 35), end=c(5, 25, 29, 40))

    subtract <- subtractRegions(A, B)

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

[Package regioneR version 1.24.0 Index]