This is a test version of Biostars. For the public version, visit https://www.biostars.org.
COmparing two SNV vcf files using bedtools

I have two SNV vcf files A.vcf and B.vcf I would like to find the

  • common SNVs between A and B
  • SNVs unique for A
  • SNVs unique for B

I tried bedtools intersect option for finding common between A and B.

bedtools intersect -a A.vcf -b B.vcf > ABcommon.vcf

Can anyone suggest how to find - SNVs unique for A SNVs unique for B

vcf bedtools intersect

2 answers

The example is right in the documentation, you want to use the -v flag which gives you those features in A that are not in B. For the reverse, just flip your A and B files.

Please be aware that bedtools does not verify that the allele is common between both samples when doing intersection. It is looking only at positions. This will inflate your concordance. Rather, I would use bcftools isec

Log in to answer this question.