2
$\begingroup$

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=<ID=PASS,Description="All filters passed">
##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.<init>(TribbleIndexedFeatureReader.java:104)
        at htsjdk.tribble.TribbleIndexedFeatureReader.<init>(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!

$\endgroup$
0

1 Answer 1

3
$\begingroup$

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
$\endgroup$
1
  • 1
    $\begingroup$ Nice on the od -c. I generally use cat -te, but this looks easier to eyeball $\endgroup$
    – Ram RS
    Commented Mar 8 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.