This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Intersectbed Overlap

Hi,

I've a question about intersectBed. Is it possible to extract only alignment like this :

chromosome ===============================================================
BED/BAM A               ==============              =================
BED FILE B               ============
RESULT                  ==============

But no alignment like this (even if the read overlapp 100% of the feature, I don't want to extract these reads)

chromosome ===============================================================
BED/BAM A    =========================              =================
BED FILE B               =============
RESULT

So, only extracting reads that have 90-95% of its sequence overlapping 90-95% of the feature.

Is it clear ?

Thanks,

N.

bedtools intersect overlap

2 answers

There are these options in intersectBed:

-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.

Thanks I didn't see the -t parameter. Sorry

Thanks I didn't see the -r parameter. Sorry – NicoBxl 0 secs ago

Thanks I didn't see the -r parameter. Sorry

Another option is the use of the bedops tool in the BEDOPS suite, in which you can perform set operations on two (or more) BED files.

For example:

$ bedops -e -90% B.bed A.bed

will return all elements of B.bed which overlap elements in A.bed by 90 or more percent. You can also specify overlap criteria by bases, instead of percent.

There are other set operations and the documentation for bedops provides examples for them, but please let me know if you have any questions.

Log in to answer this question.