I created a VCF file as below which bcftools cannot parse the header. Can anyone tell me what is wrong with my VCF file? Thanks!
bcftools query -f '%CHROM %POS [%DS1]\n' haha.vcf >haha.DS1.out
[E::bcf_hdr_parse_sample_line] Could not parse the "#CHROM.." line, either the fields are incorrect or spaces are present instead of tabs:
#CHROM POS FORMAT A-BCT-WA403-CT A-BCT-DF87-WA
Failed to read from haha.vcf: could not parse header
Below is haha.vcf
##fileformat=VCFv4.2
##filedate=20240926
##FORMAT=<ID=DS1,Number=1,Type=Float,Description="EUR dosage">
##FORMAT=<ID=DS2,Number=1,Type=Float,Description="EAS dosage">
##FORMAT=<ID=DS3,Number=1,Type=Float,Description="AFR dosage">
##FORMAT=<ID=DS4,Number=1,Type=Float,Description="SAS dosage">
##FORMAT=<ID=DS5,Number=1,Type=Float,Description="AMR dosage">
##ANCESTRY=<EUR=0,EAS=1,AFR=2,SAS=3,AMR=4>
#CHROM POS FORMAT A-BCT-WA403-CT A-BCT-DF87-WA
chr22 10550966 DS1:DS2:DS3:DS4:DS5 0.95:0:0:0:0.05 0.99:0:0:0:0.01
chr22 10586957 DS1:DS2:DS3:DS4:DS5 0.90:0:0:0:0.01 0.93:0:0:0:0.07
chr22 10550966 DS1:DS2:DS3:DS4:DS5 0.97:0:0:0:0.03 0.99:0:0:0:0.01
Following is the output of R readLine("haha.vcf")
. Tabs were used to separate fields.
a <-readLines("haha.vcf")
a
[1] "##fileformat=VCFv4.2"
[2] "##filedate=20240926"
[3] "##FORMAT=<ID=DS1,Number=1,Type=Float,Description=\"EUR dosage\">"
[4] "##FORMAT=<ID=DS2,Number=1,Type=Float,Description=\"EAS dosage\">"
[5] "##FORMAT=<ID=DS3,Number=1,Type=Float,Description=\"AFR dosage\">"
[6] "##FORMAT=<ID=DS4,Number=1,Type=Float,Description=\"SAS dosage\">"
[7] "##FORMAT=<ID=DS5,Number=1,Type=Float,Description=\"AMR dosage\">"
[8] "##ANCESTRY=<EUR=0,EAS=1,AFR=2,SAS=3,AMR=4>"
[9] "#CHROM\tPOS\tFORMAT\tA-BCT-WA403-CT\tA-BCT-DF87-WA"
[10] "chr22\t10550966\tDS1:DS2:DS3:DS4:DS5\t0.95:0:0:0:0.05\t0.99:0:0:0:0.01"
[11] "chr22\t10586957\tDS1:DS2:DS3:DS4:DS5\t0.90:0:0:0:0.01\t0.93:0:0:0:0.07"
[12] "chr22\t10550966\tDS1:DS2:DS3:DS4:DS5\t0.97:0:0:0:0.03\t0.99:0:0:0:0.01"
Thanks. It worked after I added these additional columns!
Nice. Thank you for letting me know.