We've moved!
This site is now read-only. You can find our new documentation site and support forum for posting questions here.
Be sure to read our welcome blog!

In regards to Intersecting vcf files

sagipolanisagipolani Member
edited March 2013 in Ask the GATK team

Hi all,

I would appreciate your thoughts on the following pipeline:
I'm currently working on a number of WGS of non-human vertebrates. My approach for calling variants is to maximize the sensitivity of the calls by using two callers (GATK's UnifiedGenotyper + samtools' mpileup) per chromosome regardless of / ingnoring all filters. Next, I would like to merge (not intersect) the two vcf files (GATK+samtools) per each chromosome, then merge (not intersect) all the vcf files pertaining to all chromosomes in order to retrieve a final vcf dataset per individual:

For merging the GATK and samtools:

$ java -Xmx10g -jar GenomeAnalysisTK.jar -T CombineVariants -R ref.fasta 
--variant:GATK chr#.GATK.vcf --variant:samtools chr#.samtools.vcf 
-o chr#.GATK_samtools.union.vcf 
-genotypeMergeOptions PRIORITIZE -priority GATK,samtools --filteredrecordsmergetype KEEP_UNCONDITIONAL

For merging all chromosomes per individual:

$ java -Xmx10g -jar GenomeAnalysisTK.jar -T CombineVariants -R ref.fasta 
--variant:chr1 chr1.GATK_samtools.union.vcf --variant:chr2 chr2.GATK_samtools.union.vcf --variant:chr3 chr3.GATK_samtools.union.vcf 
-o Individual1.union.vcf 
-genotypeMergeOptions PRIORITIZE -priority chr1,chr2,chr3 --filteredrecordsmergetype KEEP_UNCONDITIONAL

Finally I would like to intersect between two individuals and keep only the variants that are common to both individuals:

Uniting / merging two individuals:

$ java -Xmx10g -jar GenomeAnalysisTK.jar -T CombineVariants -R ref.fasta 
--variant:individual1 Individual1.union.vcf --variant:Individual2 Individual2.union.vcf -o Individual1_2.union.vcf 
-genotypeMergeOptions PRIORITIZE -priority Indiviual1,Individual2 --filteredrecordsmergetype KEEP_UNCONDITIONAL

Intersecting the two indiviuals in order to keep only common variants:

$  java -Xmx10g -jar GenomeAnalysisTK.jar -T SelectVariants -R ref.fasta 
--variant Individual1_2.union.vcf -select 'set == "Intersection";' 
-o Intersected.vcf

Am I doing this right? I'm afraid I may be losing variants or something else along this pipeline. Remember that I want to keep only the common variants while ignoring the filters in order to increase sensitivity as much as possible.



Post edited by Geraldine_VdAuwera on

Best Answer


  • bmartinezbmartinez EEUUMember

    Hi everyone,

    I would like to merge two different vcf files, one is a gvcf file generated with GATK Haplotype caller and one vcf generated with FREEBAYES. My first question is whether I can merge a gvcf with a vcf. My second question is if the commands that sagipolani used for merging GATK and Samtools files are also ok for merging the GATK gvcf file and the FREEBAYES vcf file.
    My genomes are in scaffolds, not in chromosomes.

    Thanks to all in advance!

    Begoña Martinez

  • SheilaSheila Broad InstituteMember, Broadie ✭✭✭✭✭

    Hi Begoña Martinez,

    You really should not be merging a GVCF and a VCF. A GVCF is an intermediate file that is not to be used in final analysis. You should first run GenotypeGVCFs to obtain the final VCF, then you can use CombineVariants to merge the two VCFs.


  • bmartinezbmartinez EEUUMember

    Hi Sheila,

    Thanks a lot for your answer.



Sign In or Register to comment.