brentp / hts-nim

nim wrapper for htslib for parsing genomics data files

Home Page:https://brentp.github.io/hts-nim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any way to get the variant's row index when using the iterator query()

ruqianl opened this issue · comments

Hi Brent,

I have been looking at the source code of hts-nim and hts-lib libraries and trying to find whether such information is recorded (Haven't got a solution).

To be clearer, for example, I have the following code :

for rec in ivcf.query(chrom): 
    # how to get the row index for this rec (row index correspond to the ith row in the supplied VCF file

Best regards,
Ruqian

No, that's not possible in VCF without additional information. You'd need an external index (like grabix) to know the line number.

Right, thanks for the link Brent! and saved my time from digging into htslib more.