-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to original iterator API by keeping a pointer to the header
On reading the SAM header, store a pointer to it in the htsFile struct for use by the iterators. Allows the existing iterator API to work with SAM files, which means programs that use BAM indexes don't need to be modified for SAM. The one disadvantage is that the header may be kept in memory for longer than is expected (although reading SAM needs it anyway, so it shouldn't be a huge issue). The header is currently only kept for SAM files. CRAM does its own thing, and some programs (notably samtools sort) expect to be able to drop the original header after reading it. As sort can currently have thousands of BAM files open at once, keeping all their headers could lead to excessive memory consumption. To allow a NULL header in bam, the checks on core.tid and core.mtid in sam_read1 have to be relaxed a little (although it's no worse than before when the iterator used bam_read1). Reference counting is used to prevent the header from being deleted prematurely.
- Loading branch information
Showing
5 changed files
with
86 additions
and
119 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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