bai index
gatozee opened this issue · comments
Is there a way to use hts-him to index a BAM file (generate the .bai file)? I looked at the API but didn't find any.
The simplest way would be to expose:
int sam_index_build3(const char *fn, const char *fnidx, int min_shift, int nthreads) HTS_RESULT_USED;
in hts-nim, this would look something like:
proc xam_index*(fn:string, fnidx:string="", min_shift:int=14, nthreads:int=1): Status =
...
would this meet your needs?
Yeah, that'd be nice if it's implemented. Thank!
this is now available in master and tagged as v0.3.5
Thank you very much!
When I use
xam_index(BAMFILE)
an index .bai is generated, but when I open the BAM file in IGV, it complains "invalid file header in BAM index"
OK. I see why, the header file in htslib says:
@param min_shift Positive to generate CSI, or 0 to generate BAI
so the way I wrote it, it is actually generating CSI, which igv doesn't know about. I will make a fix this week.
ok. this is fixed in master and tagged as v0.3.7 thanks for reporting.
It works. Now I don't need to run "samtools index" separately. Thanks!