Hi Pierre, Thanks for your help. I have added the chromosome lengths into the header using:
> $ awk '/^#CHROM/ {printf("##contig=<ID=chr1,length=263206000>\n##contig=<ID=chr2,length=347119000>\n##contig=<ID=chr3,length=309664000>\n##contig=<ID=chr4,length=340129330>\n##contig=<ID=chr5,length=275007000>\n##contig=<ID=chr6,length=214272000>\n##contig=<ID=chr7,length=255482000>\n");} {print;}' file.vcf > file_header.vcf
after compressing and indexing the file_header.vcf like previously, i still get an Exec error message:
bcftools query -r 4:58000000-59000000 -f '[ %GT]\n' file_header.vcf.gz.tbi
[E::hts_hopen] Failed to open file file_header.vcf.gz.tbi [E::hts_open_format] Failed to open file "file_header.vcf.gz.tbi" : Exec format error Failed to read from file_header.vcf.gz.tbi: Exec format error
I have full permissions and am using samtools 1.10-98-gfaab8b0 + htslib 1.10.2-135-gf4f7f24. Any other suggestions on why samtools cant read my file?