Fraction of bases covered by each element in bed
I am stuck in finding special kind of intersect of 2 bed files. I want to find for each entry of a.bed fraction (or number) of base-pairs overlapping at least one element of b.bed ( ignoring strand). b.bed itself can have overlapping entries. E.g.
a.bed
chr1 1 21 A
chr1 13 24 B
b.bed
chr1 4 11 + 1
chr1 6 12 - 2
chr1 7 15 - 3
output should be
chr1 1 20 A 11 (7+1+3)
chr1 13 24 B 2
Even if I can get unique overlap A those intersect one entry of B I can collapse them. However, bedtools-intersect reports non-unique overlap if b.bed entries are overlapping. Any solution?
• 2,813 views
•
link
1 answer
Log in to answer this question.