I have three tables with differing genomic intervals. Here is an example:
> a
chr interval.start interval.end names
1 chr1 5 10 a
2 chr1 6 10 b
3 chr2 7 10 c
4 chr3 8 10 d
> b
chr interval.start interval.end names
1 chr1 6 15 e
2 chr1 7 15 f
3 chr1 8 15 g
> c
chr interval.start interval.end names
1 chr1 7 12 h
2 chr1 8 12 i
3 chr5 9 12 j
4 chr10 10 12 k
5 chr20 11 12 l
I am trying to find the common intervals between all tables after converting info to GRanges. Essentially I want to do something like intersect(c,intersect(a,b)). However, because I am using genomic coordinates, I have to do this with GRanges and GenomicRanges package, which I am not familiar with.
I can do findOverlaps(gr, gr1) or findOverlaps(gr1, gr2), but is there an easy way to overlap multiple GRanges at once like findOverlaps(gr, gr1, gr2)?
Any help would be appreciated. If this question was asked elsewhere, I apologize in advance.
Thanks