How do I do a bedtools like intersection in GenomicRanges?
1
1
Entering edit mode
endrebak85 ▴ 40
@endrebak85-10660
Last seen 4.7 years ago
github.com/endrebak/

GenomicRanges intersect is more like what I would call set intersect - first the sets of A and B are computed, then intersection is done.

Bedtools intersect finds the intersect of each interval in A with each interval in B which means that in the worst case, the number of output regions is the size of the cartesian product of A B as in the example below:

$ cat A.bed
chr1  10  32
chr1  30  40

$ cat B.bed
chr1  15   35

$ bedtools intersect -a A.bed -b B.bed
chr1  15   32
chr1  30   35

Is this type of intersect possible in genomicranges? Thanks.

Edit: fixed example

genomicranges • 1.8k views
ADD COMMENT
4
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States

See the HelloRanges package for this.

ADD COMMENT
0
Entering edit mode

Brilliant. Thanks!

ADD REPLY
0
Entering edit mode

It is just pintersect, no?

ADD REPLY
0
Entering edit mode

No. pintersect() after findOverlaps()

ADD REPLY

Login before adding your answer.

Traffic: 845 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6