Get completely overlapping features
1
0
Entering edit mode
9.9 years ago
iraun 6.2k

Hi all,

One simple question, I want to retrieve all features in A that overlap completely (not partially) in B.

Is there anyway to do this using bedtools intersect? I've tried using the following command:

bedtools intersect -a file.gff3 -b file.bed -wa > output

But checking the output, I get this line and actually one base is outside my desired region so I would like discard it.

file.gff3
SL2.40ch01    ITAG_eugene    gene    65436585    65439158

file.bed
SL2.40ch01    65436585    65442158

output
SL2.40ch01    ITAG_eugene    gene    65436585    65439158

Thanks!

bedtools intersect • 2.5k views
ADD COMMENT
3
Entering edit mode
9.9 years ago

What version of bedtools are you using?

In bedtools v2.22.0 there are these two options, which combined should give you what you need:

intersectBed -h
...
    -f    Minimum overlap required as a fraction of A.
        - Default is 1E-9 (i.e., 1bp).
        - FLOAT (e.g. 0.50)

    -r    Require that the fraction overlap be reciprocal for A and B.
        - In other words, if -f is 0.90 and -r is used, this requires
          that B overlap 90% of A and A _also_ overlaps 90% of B.
ADD COMMENT

Login before adding your answer.

Traffic: 774 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