2
$\begingroup$

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?

$\endgroup$

2 Answers 2

2
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ This could resolve some of the cases if the input files are not normalized. However, there could be indels that are normalized and 1 bp away from each other (i.e. close but not touching each other). In my understanding, the OP wants to consider these cases as genuine matches. $\endgroup$
    – dariober
    Jan 7, 2018 at 10:13
  • $\begingroup$ I will let the OP clarify but it seemed to me that these were matching variants just with alignment artifacts. If that is true then they should normalize out. $\endgroup$
    – Bioathlete
    Jan 7, 2018 at 14:19
-1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ You have to be careful here that you are not matching a snp with an indel or vise versa. $\endgroup$
    – Bioathlete
    Jan 7, 2018 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.