arq5x / bedtools

A powerful toolset for genome arithmetic.
http://code.google.com/p/bedtools/
GNU General Public License v2.0
140 stars 85 forks source link

Feature request - intersect minimal fraction in either interval #110

Closed michael-imbeault closed 9 years ago

michael-imbeault commented 9 years ago

So I have a use case for an easy-to-implement functionality in the intersect tool.

Currently there is the f parameter to ask for interval A to overlap at least a user-defined fraction of interval B.

There is also the parameter r to ask that A should overlap a defined fraction of B, and B should overlap at least the same fraction of A (an AND operation).

I need the same but with an OR operation (either A overlaps at least a defined fraction of B OR B overlaps at least the same fraction of A).

Use case is intervals of wildly variable length in both A and B, and with f = 0.5 I would miss cases where the B interval is fully contained within A but represent only a small fraction of it, since A is large. With r = True I would miss everything. With an hypothetical parameter that ask if either A or B are intersecting with at least a defined fraction, I would get everything.

Hope that that was clear!