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 opening .hic files with only 1 bin per chromosome #180

Merged
merged 4 commits into from
May 24, 2024

Conversation

robomics
Copy link
Contributor

Fix integer overflow in .hic cache estimation

Fixes #178

This overflow occurs when trying to estimate the block cache size of .hic files using chromosomes that are smaller than the file resolution.

The overflow is caused by the implicit (and incorrect!) assumption that there are always at least two relative bin IDs mapping to each chromosome, and that is thus always safe to decrement the last chromosome bin ID by 1.

This overflow occurs when trying to estimate the block cache size of
.hic files using chromosomes that are smaller than the file resolution.
The overflow is caused by the implicit (and incorrect!) assumption that
there are always at least two relative bin IDs mapping to each
chromosome, and that is thus always safe to decrement the last
chromosome bin ID by 1.
Fix a bug that could occur when converting .mcool with small genomes and
coarse resolutions to .hic.
When the resolution is sufficiently low, the bin table for small genomes
will consist of one bin per chromosome.
When creating .cool files, cooler flags the bin table for such files as
tables with variable bin size.
This is achieved by setting bin_size to NULL in the HDF5 file.
hictk represents resolutions with integers, and cannot thus represent
null values. Instead, when opening a .cool file with a table with
variable bins, hictk returns 0 as file resolution.
.hic files with BP unit do not support tables of variable bin sizes, thus
we have to treat bin tables described above as fixed bin tables (i.e.
tables with a resolution other than 0).

This commit implements a workaround to for the above issue.
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.91%. Comparing base (9f426e7) to head (929aafd).
Report is 21 commits behind head on main.

Current head 929aafd differs from pull request most recent head 4ce7f54

Please upload reports for the commit 4ce7f54 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #180   +/-   ##
=======================================
  Coverage   84.91%   84.91%           
=======================================
  Files         119      119           
  Lines       10076    10079    +3     
=======================================
+ Hits         8556     8559    +3     
  Misses       1520     1520           

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

@robomics robomics merged commit 131ccc2 into main May 24, 2024
51 checks passed
@robomics robomics deleted the fix/small-genomes branch May 24, 2024 07:50
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.

Error creating All:All matrix
2 participants