subsetRegion {diffloop} | R Documentation |
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.
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)
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 |
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.
A loops object
# 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)