This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Broken vcf header, no column name?

Hi,

Trying to use VCF tool's vcf-compare function.

I have bgzipped and tabixed indexed my files

bgzip -c file.vcf > file.vcf.gz
tabix -p vcf file.vcf.gz

I then call vcf-compare file1.vcf.gz file2.vcf.gz but get the error:

Broken VCF header, no column names?
 at /usr/share/perl5/Vcf.pm line 172.
    Vcf::throw(Vcf4_2=HASH(0x25c1df8), "Broken VCF header, no column names?") called at /usr/share/perl5/Vcf.pm line 866
    VcfReader::_read_column_names(Vcf4_2=HASH(0x25c1df8)) called at /usr/share/perl5/Vcf.pm line 601
    VcfReader::parse_header(Vcf4_2=HASH(0x25c1df8)) called at /usr/bin/vcf-compare line 198
    main::compare_vcfs(HASH(0x1fa1850)) called at /usr/bin/vcf-compare line 19

What can I do about this?

vcf vcftools

what's the output of grep "#CHROM" -m1 file.vcf ?

2 answers

bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n' file.vcf.gz

To understand more: https://samtools.github.io/hts-specs/VCFv4.2.pdf

And more: https://samtools.github.io/bcftools/bcftools.html (go to "query" subcommand and -f option)

Out of curiosity: what happens when you do a grep "#CHROM" on your vcf file? Do you get any line?

Thanks I fixed it - I had to gunzip the .gz files provided to me from the pipeline and rezip them. Once I tabixed them after this it worked fine.

Log in to answer this question.