Question: Intersection of 3 multi-sampled vcf files
gravatar for michelle.zl.kee
2.7 years ago by
michelle.zl.kee0 wrote:


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!

bcftools vcf • 1.2k views
ADD COMMENTlink written 2.7 years ago by michelle.zl.kee0

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

ADD REPLYlink written 2.7 years ago by RamRS27k

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.

ADD REPLYlink modified 2.7 years ago • written 2.7 years ago by ATpoint36k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1106 users visited in the last hour