I have 3 VCF files.


I want to get the common SNPs that are present in all these three files. And output must be in vcf format.


  • 1
    $\begingroup$ Do you mean SNPs in terms of shared variants or shared positions? $\endgroup$
    – user438383
    Commented Apr 17, 2021 at 13:16
  • $\begingroup$ google intersect or overlap between VCF files, -> bcftools isec $\endgroup$
    – JRodrigoF
    Commented Apr 19, 2021 at 21:18
  • $\begingroup$ I have tried isec, but the produced files do not contains the VCF file contains common file $\endgroup$ Commented May 23, 2023 at 16:47

1 Answer 1


A potential solution is to compress and index the files using bgzip and tabix, then use bcftools isec to find SNPs common to all three files, e.g.

for files in A1.vcf A2.vcf A3.vcf
  bgzip "$files"
  tabix "$files"

bcftools isec -n=3 -c all -o all_common_SNPs.vcf A1.vcf.gz A2.vcf.gz A3.vcf.gz
  • $\begingroup$ Hi @Jared_mamrot - can you please explain -c all I've seen -c none -c all/both I'm unable to understand/follow this flag. $\endgroup$ Commented Aug 24, 2023 at 22:59
  • 1
    $\begingroup$ As I understand it @Death-Metal, if you have two vcfs, one with the variant T->CCA at chr1 pos10001 and the other with the variant T->A at chr1 pos10001 , the -c all flag will treat these as a 'common to the two files' (i.e. there is a variant at chr1:10001 and it will be 'kept' when you isec). If you specify -c none, the REF/ALTs need to match exactly (i.e. both vcfs need to be e.g. T->A to be kept). With -c both, the variant must be the same type e.g. both SNPs or both INDELs, regardless of the ALTs. More details here: samtools.github.io/bcftools/bcftools.html#common_options $\endgroup$ Commented Aug 24, 2023 at 23:29

Your Answer

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

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