<p>That sounds like your header isn't tab separated. You can check for the presence of tabs with <code>od -c</code>. So, to check the header, do</p>
<pre><code>zgrep '^#C' my.vcf.gz | od -c
</code></pre>
<p>Then check the output, it should show <code>\t</code> between each header field, like this:</p>
<pre><code>$ zgrep '^#C'  variants.vcf.gz | od -c
0000000   #   C   H   R   O   M  \t   P   O   S  \t   I   D  \t   R   E
0000020   F  \t   A   L   T  \t   Q   U   A   L  \t   F   I   L   T   E
0000040   R  \t   I   N   F   O  \t   F   O   R   M   A   T  \t   E   D
0000060   2   0   0   1   3   9   6  \n
0000070
</code></pre>

CC BY-SA 4.0
2024-03-08T18:00:38.270Z
Nice on the `od -c`. I generally use `cat -te`, but this looks easier to eyeball
Ram RS
CC BY-SA 4.0
2024-03-08T14:44:24.027Z
2024-03-09T11:58:09.213Z
2024-03-09T11:58:09.213Z
terdon
<p>I'm stuck on what seems to be a banal problem, but I can't work out where the issue is. I need to create some customised VCF files that specify particular variants of interest.</p>
<p>This is a custom VCF I created for this <a href="http://www.ensembl.org/Homo_sapiens/Variation/Explore?r=20:4699252-4700252;v=rs74315403;vdb=variation;vf=1054935347" rel="nofollow noreferrer">variant</a>:</p>
<pre><code>##fileformat=VCFv4.3
##FILTER=&lt;ID=PASS,Description=&quot;All filters passed&quot;&gt;
##fileDate=20240308
##source=Ensembl
##reference=GRCh38
#CHROM  POS ID  REF ALT QUAL  FILTER    INFO
20  4699752 rs74315403  G   A   .   .  .
</code></pre>
<p>The formatting seems correct to me; the values are separated by tabs, all relevant column headers are present, there is a value for every header. I try to use it in the Mutect2 <code>--alleles</code> and <code>-L</code> options, as follows:</p>
<pre><code>gatk Mutect2 \
  -R ref.fa \
  --alleles my.vcf.gz  \
  -L my.vcf.gz\
  -I input.bam \
  -O output.vcf
</code></pre>
<p>This gives me the following error:</p>
<pre><code>Caused by: htsjdk.tribble.TribbleException<span class="math-container">$MalformedFeatureFile: Unable to parse header with error: Your input file has a malformed header: there are not enough columns present in the header line: #CHROM     POS     ID      REF     ALT     QUAL  FILTER    INFO, for input source: path/to/my.vcf
        at htsjdk.tribble.TribbleIndexedFeatureReader.readHeader(TribbleIndexedFeatureReader.java:265)
        at htsjdk.tribble.TribbleIndexedFeatureReader.&lt;init&gt;(TribbleIndexedFeatureReader.java:104)
        at htsjdk.tribble.TribbleIndexedFeatureReader.&lt;init&gt;(TribbleIndexedFeatureReader.java:129)
        at htsjdk.tribble.AbstractFeatureReader.getFeatureReader(AbstractFeatureReader.java:121)
        at org.broadinstitute.hellbender.engine.FeatureDataSource.getTribbleFeatureReader(FeatureDataSource.java:433)
        ... 15 more
Caused by: htsjdk.tribble.TribbleException$</span>InvalidHeader: Your input file has a malformed header: there are not enough columns present in the header line: #CHROM       POS     ID      REF    ALT      QUAL  FILTER    INFO
        at htsjdk.variant.vcf.AbstractVCFCodec.parseHeaderFromLines(AbstractVCFCodec.java:149)
        at htsjdk.variant.vcf.VCFCodec.readActualHeader(VCFCodec.java:117)
        at htsjdk.tribble.AsciiFeatureCodec.readHeader(AsciiFeatureCodec.java:79)
        at htsjdk.tribble.AsciiFeatureCodec.readHeader(AsciiFeatureCodec.java:37)
        at htsjdk.tribble.TribbleIndexedFeatureReader.readHeader(TribbleIndexedFeatureReader.java:263)
</code></pre>
<p>Supposedly there's something wrong with the header. Can you spot the issue? Thanks!</p>

<vcf><genomics><mutect2>
Creating custom VCF file
# Creating custom VCF file

(Asked by: username_0 on 2024-03-08)

I'm stuck on what seems to be a banal problem, but I can't work out where the issue is. I need to create some customised VCF files that specify particular variants of interest.
This is a custom VCF I created for this variant:
##fileformat=VCFv4.3
##FILTER=
##fileDate=20240308
##source=Ensembl
##reference=GRCh38
#CHROM  POS ID  REF ALT QUAL  FILTER    INFO
20  4699752 rs74315403  G   A   .   .  .

The formatting seems correct to me; the values are separated by tabs, all relevant column headers are present, there is a value for every header. I try to use it in the Mutect2 --alleles and -L options, as follows:
gatk Mutect2 \
  -R ref.fa \
  --alleles my.vcf.gz  \
  -L my.vcf.gz\
  -I input.bam \
  -O output.vcf

This gives me the following error:
Caused by: htsjdk.tribble.TribbleException$MalformedFeatureFile: Unable to parse header with error: Your input file has a malformed header: there are not enough columns present in the header line: #CHROM     POS     ID      REF     ALT     QUAL  FILTER    INFO, for input source: path/to/my.vcf
        at htsjdk.tribble.TribbleIndexedFeatureReader.readHeader(TribbleIndexedFeatureReader.java:265)
        at htsjdk.tribble.TribbleIndexedFeatureReader.(TribbleIndexedFeatureReader.java:104)
        at htsjdk.tribble.TribbleIndexedFeatureReader.(TribbleIndexedFeatureReader.java:129)
        at htsjdk.tribble.AbstractFeatureReader.getFeatureReader(AbstractFeatureReader.java:121)
        at org.broadinstitute.hellbender.engine.FeatureDataSource.getTribbleFeatureReader(FeatureDataSource.java:433)
        ... 15 more
Caused by: htsjdk.tribble.TribbleException$InvalidHeader: Your input file has a malformed header: there are not enough columns present in the header line: #CHROM       POS     ID      REF    ALT      QUAL  FILTER    INFO
        at htsjdk.variant.vcf.AbstractVCFCodec.parseHeaderFromLines(AbstractVCFCodec.java:149)
        at htsjdk.variant.vcf.VCFCodec.readActualHeader(VCFCodec.java:117)
        at htsjdk.tribble.AsciiFeatureCodec.readHeader(AsciiFeatureCodec.java:79)
        at htsjdk.tribble.AsciiFeatureCodec.readHeader(AsciiFeatureCodec.java:37)
        at htsjdk.tribble.TribbleIndexedFeatureReader.readHeader(TribbleIndexedFeatureReader.java:263)

Supposedly there's something wrong with the header. Can you spot the issue? Thanks!

**Tags:** vcf, genomics, mutect2

---

## 1 answers

### Answer by username_1 on 2024-03-08. Score: 3 | Accepted answer

That sounds like your header isn't tab separated. You can check for the presence of tabs with od -c. So, to check the header, do
zgrep '^#C' my.vcf.gz | od -c

Then check the output, it should show \t between each header field, like this:
$ zgrep '^#C'  variants.vcf.gz | od -c
0000000   #   C   H   R   O   M  \t   P   O   S  \t   I   D  \t   R   E
0000020   F  \t   A   L   T  \t   Q   U   A   L  \t   F   I   L   T   E
0000040   R  \t   I   N   F   O  \t   F   O   R   M   A   T  \t   E   D
0000060   2   0   0   1   3   9   6  \n
0000070

> **Comments:**
> **username_2**: Nice on the `od -c`. I generally use `cat -te`, but this looks easier to eyeball  

---

