You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Historically this code was like this because for BAM files hts_itr_next() used its BGZF *fp argument (and ignored its void *data argument) and called bam_readrec() which used bam_read1() with the BGZF *fp argument. Meanwhile for CRAM files hts_itr_next() used the void *data argument but ignored the BGZF *fp argument.
This changed — and this bug was introduced — when iterating over SAM files was added and bam_readrec() (using bam_read1() and BGZF *fp) was replaced by sam_readrec() (using sam_read1() and void *data aka htsFile *).
Since then for BAM files, hts_itr_next() has mixed up seeking on the BGZF * with reading from the htsFile *. This works more by luck than design!
So IMHO this bug report is an indication that this code needs a careful review and, if moving to htsFile * everywhere in hts_itr_next(), streamlining and removal of the legacy BGZF * parameter (ABI issues notwithstanding). And/or more heavily deprecating the legacy bam_itr_* functions.
Well, the bam_itr_* interface has now effectively gone as it just calls the sam_itr_* equivalents. You're right, though, the iterator code is quite hairy and would benefit from some simplification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bam_itr_nextnow sets thedataargument ofhts_itr_nextto the BAM file pointer (ofhtsFile *type).Fixes #1179