0
$\begingroup$

I have 3 VCF files.

A1.vcf
A2.vcf
A3.vcf

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

output:

common_A.vcf
$\endgroup$
2
  • 1
    $\begingroup$ Do you mean SNPs in terms of shared variants or shared positions? $\endgroup$
    – user438383
    Apr 17 at 13:16
  • $\begingroup$ google intersect or overlap between VCF files, -> bcftools isec $\endgroup$
    – JRodrigoF
    Apr 19 at 21:18
1
$\begingroup$

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
  do
  bgzip "$files"
  tabix "$files"
done

bcftools isec -n=3 -c all -o all_common_SNPs.vcf A1.vcf.gz A2.vcf.gz A3.vcf.gz
```
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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