Skip to content

update for filters which refer header data#1959

Merged
whitwham merged 2 commits into
samtools:developfrom
vasudeva8:filter1
Oct 23, 2025
Merged

update for filters which refer header data#1959
whitwham merged 2 commits into
samtools:developfrom
vasudeva8:filter1

Conversation

@vasudeva8

@vasudeva8 vasudeva8 commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Filter expressions which needs header information, like rname, mrname, rnext and library, will not work well when used along with iterators. Filter processing uses fp->bam_header but it will be empty except for sam files and causes this.
This PR sets htsFile's bam_header with header that is read on sam_hdr_read api. This ensures that the bam_header field is not empty and available for filter evaluation.
To keep the bam_header in sync with data, the same is released and reset on header write.

Added get/set methods that header can be set and retrieved from file pointer.

@whitwham whitwham merged commit 86f0c83 into samtools:develop Oct 23, 2025
9 checks passed
@vasudeva8 vasudeva8 deleted the filter1 branch October 30, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants