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

Support for CRAM beta coding #309

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

athos
Copy link
Member

@athos athos commented May 10, 2024

This PR adds support for CRAM beta coding.

For more information on beta coding, see the CRAM specification.

The core of this PR is the BitStreamDecoder, which is a bit stream decoder. The BitStreamDecoder manages two states buffer (the byte value already read) and nbits (indicating how many bits of the buffer are still "alive") and prepares for reading the next bit sequence.

The CRAM reader creates a BitStreamDecoder based on the core block (the only bit-encoded data block) and shares it between data series that are declared to be beta-encoded (Although the CRAM specification does not explicitly state that a core block may be associated with multiple data series, it seems to be guaranteed by the fact that a test file (1101_BETA.cram) provided by hts-specs is encoded as such).

@athos athos self-assigned this May 10, 2024
@athos athos requested review from alumi and a team as code owners May 10, 2024 07:58
@athos athos requested review from r6eve and removed request for a team May 10, 2024 07:58
@athos athos assigned alumi and r6eve May 10, 2024
Copy link

codecov bot commented May 10, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 88.49%. Comparing base (1dd64cd) to head (e00b3fa).

Files Patch % Lines
src/cljam/io/cram/bit_stream.clj 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #309      +/-   ##
==========================================
+ Coverage   88.48%   88.49%   +0.01%     
==========================================
  Files          94       95       +1     
  Lines        8148     8173      +25     
  Branches      505      506       +1     
==========================================
+ Hits         7210     7233      +23     
- Misses        433      434       +1     
- Partials      505      506       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alumi alumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this feature!
I checked both implementation and tests.
LGTM 👍 👍

Copy link
Contributor

@r6eve r6eve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the PR.

@r6eve r6eve merged commit 90227f3 into master May 14, 2024
18 checks passed
@r6eve r6eve deleted the feature/cram-bit-encoding-support branch May 14, 2024 02:15
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.

3 participants