hts-nim icon indicating copy to clipboard operation
hts-nim copied to clipboard

Adjust header on load to prevent failing [QUESTION]

Open edg1983 opened this issue 6 months ago • 1 comments

Hi Brent,

I'm wondering if there is a way to manipulate the header while/before opening an uncompressed VCF file to prevent errors and process the file.

The use case here is that I'd like to use hts-nim in a tool to process pvar files (part of the plink2 binary file set). These are essentially perfectly formatted VCF files, without the FORMAT column and sample genotypes, but they lack the standard VCF first line ##fileformat=VCFv4.2.

This causes hts-nim to fail when trying open(v, "pvar_file.pvar"), giving a header-related error `[hts-nim/vcf] error reading VCF header from 'pvar_test.pvar' [OSError].

When I manually insert the missing first line, then everything works perfectly.

Do you see any way to get around this directly in the code without manipulating the file manually to add the missing line?

Thanks a lot!

edg1983 avatar Aug 21 '24 10:08 edg1983