This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Intersect multiple VCF files

Hey guys,

Is there any way to use bedtools intersect on multiple VCF files to get only variants that are common for all those files? From the manual I counclude that in standard use output would be variants that are present in query and at least one database file, while I need those that would be present in all databse files.

All the best, Agata

snp vcf intersect vcftools bedtools

1 answer

I think you need to use bcftools isec

Creates intersections, unions and complements of VCF files. Depending on the options, the program can output records from one (or more) files which have (or do not have) corresponding records with the same position in the other files.

assuming that you have 3 files
bcftools isec -p dir -n=3 A.vcf.gz B.vcf.gz C.vcf.gz

read more

Note: vcf-isec do the same work

Log in to answer this question.