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

Possible straw.py issue for older hic versions #21

Closed
carlvitzthum opened this issue Oct 18, 2017 · 3 comments
Closed

Possible straw.py issue for older hic versions #21

carlvitzthum opened this issue Oct 18, 2017 · 3 comments

Comments

@carlvitzthum
Copy link
Contributor

carlvitzthum commented Oct 18, 2017

I'm working on developing a converter from .hic to .cool files (hic2cool) and came across a possible issue with a test file of hic version 6. The binX, binY, and counts values were not correct within the readBlock function.

The file is IMR90.hic and can be found here: https://bcm.app.box.com/v/aidenlab/folder/11235404320.

I was able to get the correct counts (i.e. ones that matched the output of juice_tools dump) by changing the lines 323 to 325 in python/straw.py. https://github.com/theaidenlab/straw/blob/65f0e94bf7cc11cfa6a9e7ddaf50205591bb6069/python/straw.py#L323-L325

Looking closely, the binX value == nRecords for i=0 in the loop over range(nRecords), which explains the problem. I changed the range of bytes read and it seems to work:

x = struct.unpack(b'<i', uncompressedBytes[(12i+4):(12i+8)])[0]
y = struct.unpack(b'<i', uncompressedBytes[(12i+8):(12i+12)])[0]
c = struct.unpack(b'<f', uncompressedBytes[(12i+12):(12i+16)])[0]

Just thought I would let you know in case this is a valid issue you want to fix.

Best,
Carl

@nchernia
Copy link
Contributor

nchernia commented Oct 18, 2017 via email

@carlvitzthum
Copy link
Contributor Author

carlvitzthum commented Oct 18, 2017

Certainly. #22

Apologies for the number of whitespace changes, which were added automatically by my linter. Only lines 323-325 were meaningfully changed.

@theaidenlab
Copy link
Member

Thanks!

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

No branches or pull requests

3 participants