subsetRegion: Extract region from loops object

Description Usage Arguments Details Value Examples

Description

subsetRegion takes a loops object and a GRanges object and returns a loops object where both anchors map inside the GRanges coordinates by default. Once can specify where only one anchor is in the region instead.

Usage

1
2
3
4
5
6
7
subsetRegion(dlo, region, nanchors)

## S4 method for signature 'loops,GRanges,numeric'
subsetRegion(dlo, region, nanchors)

## S4 method for signature 'loops,GRanges,missing'
subsetRegion(dlo, region, nanchors)

Arguments

dlo

A loops object to be subsetted

region

A GRanges object containing region of interest

nanchors

Number of anchors to be contained in GRanges object. Default 2

Details

By default, nachors = 2, meaning both anchors need to be in the region for the loop to be preserved when extracting. However, by specifying a numeric 1, interactions with either the left or right anchor will be extracted. Loops with both anchors in the region will be excluded (exclusive or). To get an inclusive or, take the union of subsetting both with 1 and 2.

Value

A loops object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Grab region chr1:36000000-36100000
library(GenomicRanges)
regA <- GRanges(c('1'),IRanges(c(36000000),c(36100000)))
rda<-paste(system.file('rda',package='diffloop'),'loops.small.rda',sep='/')
load(rda)
# Both anchors in region
loops.small.two <- subsetRegion(loops.small, regA)
#Only one anchor in region
loops.small.one <- subsetRegion(loops.small, regA, 1)
#Either one or two anchors in region
loops.small.both <- union(loops.small.one, loops.small.two)

aryeelab/diffloop documentation built on May 12, 2019, 3:42 a.m.