samtools/htslib — pull request #124 by dpryan79 (2014-08-26 12:17:34+00:00)
Title: Make hts_idx_push no longer return 0 after the first unmapped read. This...

This ends up being a fix for samtools issue #283, which is due to htslib created indexes.

Currently, hts_idx_push returns 0 after the first met unmapped alignment. This causes bam_index to immediately return and unmapped reads to essentially not be included in the resulting index. This ends up breaking the last line of samtools idxstats.

There are two alternative fixes. Firstly, samtools idxstats could be changed to not include unmapped reads. This, however, would be a change from previous versions that will likely break a few pipelines. The alternative would be to alter bam_index() to not return when hts_idx_push returns 0. Someone familiar with VCF/tabix indexing should review this to determine which is the better solution.