Answers.Body: <p>GATK cannot combine VCF files generated by Sniffles, the variant caller that I used to call structural variants (answer from the GATK team).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-11T23:55:06.153Z
Answers.LastActivityDate: 2018-05-11T23:55:06.153Z
Answers.UserDisplayName: Biomagician
Answers.Body: <p>Answered in the <a href="https://gatkforums.broadinstitute.org/gatk/discussion/11918/gatk-combinevariants-complains-the-contig-order-in-the-vcf-files" rel="nofollow noreferrer">GATK forum</a></p>
  
  <blockquote>
    <p>Try regenerating the index files for your VCFs. Picard SortVcf doesn't do it for you iirc, so when GATK looks at the index files (before opening the VCFs themselves) it sees the old order and complains.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-06T22:35:37.433Z
Answers.Text: Hi, thanks for the answer, it's already helpful. However, It would be even nicer for community to write the actual answer and to provide the link just as the source (you can [edit] your answer).
Answers.UserDisplayName: Kamil S Jaron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-06T22:12:09.937Z
Answers.LastActivityDate: 2018-05-08T07:41:45.797Z
Answers.LastEditDate: 2018-05-08T07:41:45.797Z
Answers.UserDisplayName: Geraldine_VdAuwera
Body: <p>I have called variants on two strains of <em>C. elegans</em> separately. I now want to merge the VCF files into one using the following code:</p>
  
  <ul>
  <li>Create a sequence dictionary of the reference sequence</li>
  <li>Sort the VCF files with Picard</li>
  <li>Merge the sorted VCF files using GATK</li>
  </ul>
  
  <p>&nbsp;</p>
  
  <pre><code>picard CreateSequenceDictionary \
      REFERENCE=c_elegans.PRJNA13758.WS263.genomic.fa \
      OUTPUT=c_elegans.PRJNA13758.WS263.genomic.dict
  
  picard SortVcf INPUT=strain1.vcf \
      OUTPUT=strain1sorted.vcf \
      SEQUENCE_DICTIONARY=c_elegans.PRJNA13758.WS263.genomic.dict
  
  picard SortVcf INPUT=strain2.vcf \
      OUTPUT=strain2sorted.vcf  \     
      SEQUENCE_DICTIONARY=c_elegans.PRJNA13758.WS263.genomic.dict
  
  GATK --analysis_type CombineVariants \
      -R c_elegans.PRJNA13758.WS263.genomic.fa \
      --variant strain1sorted.vcf \
      --variant strain2sorted.vcf \
      -o all.vcf \
      -genotypeMergeOptions UNIQUIFY
  </code></pre>
  
  <p>The last command gives me the following error message:</p>
  
  <pre><code>ERROR MESSAGE: Input files variant and reference have incompatible contigs. Please see https://www.broadinstitute.org/gatk/guide/article?id=63 for more information. Error details: The contig order in variant and reference is not the same; to fix this please see: (https://www.broadinstitute.org/gatk/guide/article?id=1328),  which describes reordering contigs in BAM and VCF files..
  ##### ERROR   variant contigs = [I, II, III, IV, MtDNA, V, X]
  ##### ERROR   reference contigs = [I, II, III, IV, V, X, MtDNA]
  </code></pre>
  
  <p>But I have sorted the VCF files using Picard, so I don't know what else to do.</p>
  
  <p>Your help is appreciated.</p>
  
  <p>Update: I asked this question on the <a href="https://gatkforums.broadinstitute.org/gatk/discussion/11918/gatk-combinevariants-complains-the-contig-order-in-the-vcf-files/p1?new=1" rel="nofollow noreferrer">GATK</a> forum on 4th May 2018 (today).</p>
  
Tags: <vcf><variant-calling><gatk><picard><variation>
Title: GATK CombineVariants complains the contig order in the VCF files
ThreadText: # GATK CombineVariants complains the contig order in the VCF files
  
  (Asked by: username_0 on 2018-05-03)
  
  I have called variants on two strains of *C. elegans* separately. I now want to merge the VCF files into one using the following code:
  
  * Create a sequence dictionary of the reference sequence
  * Sort the VCF files with Picard
  * Merge the sorted VCF files using GATK
  
  ```
  picard CreateSequenceDictionary \
      REFERENCE=c_elegans.PRJNA13758.WS263.genomic.fa \
      OUTPUT=c_elegans.PRJNA13758.WS263.genomic.dict
  
  picard SortVcf INPUT=strain1.vcf \
      OUTPUT=strain1sorted.vcf \
      SEQUENCE_DICTIONARY=c_elegans.PRJNA13758.WS263.genomic.dict
  
  picard SortVcf INPUT=strain2.vcf \
      OUTPUT=strain2sorted.vcf  \     
      SEQUENCE_DICTIONARY=c_elegans.PRJNA13758.WS263.genomic.dict
  
  GATK --analysis_type CombineVariants \
      -R c_elegans.PRJNA13758.WS263.genomic.fa \
      --variant strain1sorted.vcf \
      --variant strain2sorted.vcf \
      -o all.vcf \
      -genotypeMergeOptions UNIQUIFY
  
  ```
  
  The last command gives me the following error message:
  
  ```
  ERROR MESSAGE: Input files variant and reference have incompatible contigs. Please see https://www.broadinstitute.org/gatk/guide/article?id=63 for more information. Error details: The contig order in variant and reference is not the same; to fix this please see: (https://www.broadinstitute.org/gatk/guide/article?id=1328),  which describes reordering contigs in BAM and VCF files..
  ##### ERROR   variant contigs = [I, II, III, IV, MtDNA, V, X]
  ##### ERROR   reference contigs = [I, II, III, IV, V, X, MtDNA]
  
  ```
  
  But I have sorted the VCF files using Picard, so I don't know what else to do.
  
  Your help is appreciated.
  
  Update: I asked this question on the [GATK](https://gatkforums.broadinstitute.org/gatk/discussion/11918/gatk-combinevariants-complains-the-contig-order-in-the-vcf-files/p1?new=1) forum on 4th May 2018 (today).
  
  **Tags:** vcf, variant-calling, gatk, picard, variation
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-05-11. Score: 2 | Accepted answer
  
  GATK cannot combine VCF files generated by Sniffles, the variant caller that I used to call structural variants (answer from the GATK team).
  
  
  ---
  
  ### Answer by username_1 on 2018-05-06. Score: 3
  
  Answered in the [GATK forum](https://gatkforums.broadinstitute.org/gatk/discussion/11918/gatk-combinevariants-complains-the-contig-order-in-the-vcf-files)
  
  > Try regenerating the index files for your VCFs. Picard SortVcf doesn't do it for you iirc, so when GATK looks at the index files (before opening the VCFs themselves) it sees the old order and complains.
  
  > **Comments:**
  > **username_2**: Hi, thanks for the answer, it's already helpful. However, It would be even nicer for community to write the actual answer and to provide the link just as the source (you can [edit] your answer).  
  
  ---
  
  