This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get overlapping features with certain fraction max

Hi, Given two bed files, I want to get the overlapping feature which has at most x bp overlap. Probably I should use closest bed but how to restrict the overlap to some x bp at most?

genome bedtools

1 answer

pipe the output of bedtools intersect into awk to filter on the overlapsize:

awk '{x1=int($2);x2=int($5);B=x1<x2?x2:x1; x1=int($3);x2=int($6);E=x1<x2?x1:x2;if(E-B<20) print}'

Log in to answer this question.