Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply m_cram_reference to bams #38

Merged
merged 1 commit into from
Jan 25, 2019
Merged

Conversation

agraubert
Copy link
Contributor

See #34

The value of _Bam::m_cram_reference is never meaningfully propagated to the underlying htslib bam constructs.

If BamReader::SetCramReference is called before any crams are opened, BamReader::m_cram_reference is never passed to new bams in BamReader::Open, so the new _Bam never calls htslib::cram_load_reference.

This PR adds a single line so that m_cram_reference is passed into new bams when opened.

This PR does not fix the case where bams have already opened via BamReader::Open before setting a reference. It will probably involve copying this code segment into BamReader::SetCramReference, but I didn't want to just start duplicating code blocks in case you wanted to move that into it's own function.

@walaj walaj merged commit 5de6590 into walaj:master Jan 25, 2019
@walaj
Copy link
Owner

walaj commented Jan 25, 2019

Yikes, you're right, it seems my test cases first set the CRAM reference so I never noticed this. Thanks for the fix! Not an easy bug to find.

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