This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while merging multiple vcf files using Picard MergeVcfs

Hello all,

I am trying to merge multiple vcf files using MergeVcfs from Picard tools. Here is my command:

java -jar ./picard.jar I=input1.vcf I=input2.vcf I=inputx.vcf O=combined.vcf

However, I am getting the following error:

Input file .vcf has sample entries that don't match the other files.

This is what I used to call the variants:

gatk HaplotypeCaller -I input.sorted.bam -O .vcf -R reference.fasta

Is this is a problem as I did not output as GVCF? What tool can I use to merge it successfully?

Thanks!

snp genome picard gatk

1 answer

I encountered similar problems.

I have two GVCF files generated by HaplotypeCaller, each one for a different sample. When I tried to merge them into a multi-sample VCF file using the following command:

gatk MergeVcfs -I M11189W.chr21.common.g.vcf.gz -I N11189.chr21.common.g.vcf.gz -O merged.picard.vcf.gz

I got this error message:

java.lang.IllegalArgumentException: Input file /pylon5/mc5plcp/haizizh/cofrag/stash/N11189.chr21.common.g.vcf.gz has sample entries that don't match the other files.
    at picard.vcf.MergeVcfs.doWork(MergeVcfs.java:203)
    at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:301)
    at org.broadinstitute.hellbender.cmdline.PicardCommandLineProgramExecutor.instanceMain(PicardCommandLineProgramExecutor.java:37)
    at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:160)
    at org.broadinstitute.hellbender.Main.mainEntry(Main.java:203)
    at org.broadinstitute.hellbender.Main.main(Main.java:289)

However, when I turned to CombineGVCFs, the command went through successfully:

gatk --java-options -Xmx2G CombineGVCFs \
-G StandardAnnotation -G StandardHCAnnotation -G AS_StandardAnnotation \
-R ../data/ref_genome/hs37-1kg/human_g1k_v37.fasta \
-V M11189W.chr21.common.g.vcf.gz -V N11189.chr21.common.g.vcf.gz \
-O merged.g.vcf.gz

I guess this is because HaplotypeCaller generates GVCF files, which are not exactly the same with standard VCF files.

Log in to answer this question.