# Approximate matches with bedtools intersect

I am using bedtools to test whether a set of variant calls produced by a new method is missing any variants from a set of known validated variants.

bedtools intersect -v -a newcalls.vcf -b goldstandard.vcf


It's working as intended for SNV calls, but it occasionally misses indels due to a single base pair discrepancy. It's usually an alignment artifact that doesn't affect the interpretation of the variant.

My first thought was to make a BED file with intervals that extend a few bp beyond each variant call, and comparing this BED file to the known variants. However, I was wondering whether approximate matching is possible with bedtools intersect?

You can use bedtools intersect but first use bcftools norm. bcftools norm will left-align and normalize indels to get both vcf files consistent with each other. This should resolve the matching if they are truly matching variants.
You could use bedtools closest with -d option (-d: In addition to the closest feature in B, report its distance to A as an extra column.). Indels that have no match in file A would be those where the closest indel in file B is more than x bases away.