Hello everyone
I'm trying to select the interactions that lie inside of a given region, but my problem is that this doesn't work properly because it gives me interactions that one anchor of the interactions lies outside of the given region.
I prepared a toy example, there are 2 interactions and one given region. The second interaction starts inside the region but finishes outside the region, so subsetByOverlaps
with the argument type="within"
should filter out this interaction, but it doesn't.
a1 <- GRanges(seqnames = 1,ranges = IRanges(start = c(100,150),end = c(110,160)))
a2 <- GRanges(seqnames = 1,ranges = IRanges(start = c(200,250),end = c(210,260)))
gi <- GenomicInteractions(a1,a2)
region <- GRanges(seqnames = 1,raenter code herenges = IRanges(start = 1,end = 230))
subsetByOverlaps(gi,region,type = "within")
# GenomicInteractions object with 2 interactions and 1 metadata column:
# seqnames1 ranges1 seqnames2 ranges2 | counts
# <Rle> <IRanges> <Rle> <IRanges> | <integer>
# [1] 1 100-110 --- 1 200-210 | 1
# [2] 1 150-160 --- 1 250-260 | 1
# -------
# regions: 4 ranges and 0 metadata columns
# seqinfo: 1 sequence from an unspecified genome; no seqlengths
If I apply separately subsetByOverlaps
to the regions of each anchor, it works, but when I try to do it to the GenomicInteractions
object it doesn't.
Is this a bug or how can I solve this and obtained only the interactions that really lie inside the region?
Thanks