4dn-dcic / hic2cool

Lightweight converter between hic and cool contact matrices.
MIT License
66 stars 7 forks source link

Hic2cool convert error #41

Open Captaincapture opened 4 years ago

Captaincapture commented 4 years ago

Hi, i want to convert my matrice in .hic to .cool but i have always this problem :

hic2cool -v
hic2cool 0.7.3
hic2cool convert Pvam_2.0.hic Pvam_2.0.cool
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/hic2cool", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hic2cool/__main__.py", line 80, in main
    hic2cool_convert(args.infile, args.outfile, args.resolution, args.warnings, args.silent)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hic2cool/hic2cool_utils.py", line 830, in hic2cool_convert
    pair_footer_info, expected, factors, norm_info = read_footer(req, buf, masteridx)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hic2cool/hic2cool_utils.py", line 115, in read_footer
    nBytes = struct.unpack(b'<i', f.read(4))[0]
struct.error: unpack requires a buffer of 4 bytes
pkerpedjiev commented 4 years ago

I got that same error a little while ago. It turned out the .hic file I was trying to convert hadn't downloaded completely and was corrupt. Not sure if there's an integrity check that can be done first but I would recommend making sure that the hic file is valid and complete.

SooLee commented 4 years ago

Thanks, @pkerpedjiev! Yes, I think the hic file is likely truncated since it doesn't seem to have a footer (can't retrieve the first 4 bytes of a footer).