This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Intersection of 3 multi-sampled vcf files

Hi,

I have 3 vcf files from different samples and would like to get a file with an intersection of common SNPs found in all 3 samples.

I have used bcftools isec for 2 samples first, took the intersection (either 0002.vcf or 0003.vcf generated from this) and then did another bcftools isec with the 3rd sample. However, I realised that only the samples present only belonged to the last sample group.

Could anyone advise on a way where I could receive an intersection of common SNPs found in all 3 samples with all samples present in the file?

Thank you very much!

vcf bcftools

Are your VCF files single-sample files? Your phrasing makes it sound that way.

You could take the file that you got after your intersections and then use BEDtools intersect:

bedtools intersect -a your.intersections -b *.vcf -wb | cut -f11-

-wb will make BEDtools print the intersection and the entire entry of the vcf in which the isec was found. *.vcf are the three original VCF files. The cut should then print the output of -wb, so the entries from B that isec with -A.

EDIT: Not sure if -f11-, so check the output from which column on the B entries start.

0 answers

No answers yet.

Log in to answer this question.