4dn-dcic / hic2cool

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

hic2cool update #29

Closed imerelli closed 5 years ago

imerelli commented 5 years ago

Hi, hic2cool update is not working for me (both specifying the output or not). The software ask yes/no for writing, but in both cases it raises an error. Here the error:

$ hic2cool -v
hic2cool 0.6.0

$ hic2cool update inter_30.mcool 
#########################
### hic2cool / update ###
#########################
### Info from input file
... File path: inter_30.mcool
... Found creation timestamp: 2019-05-03 at 16:07:31
... Found update timestamp: None
... Found resolutions: [u'10000', u'100000', u'1000000', u'25000', u'250000', u'2500000', u'5000', u'50000', u'500000']
... Found version: 0.5.1
... Target version: 0.6.0
### Updates found. Will upgrade hic2cool file to version 0.6.0
### This is what will change:
- Add cooler schema version
    - Effect: Add a couple important cooler schema attributes
    - Detail: Adds format-version and storage-mode attributes to hdf5 for compatibility with cooler schema v3.
### Will write to inter_30.mcool
### Continue? [y/n]
[y/n] y
Traceback (most recent call last):
  File "/bin/hic2cool", line 9, in <module>
    load_entry_point('hic2cool==0.6.0', 'console_scripts', 'hic2cool')()
  File "build/bdist.linux-x86_64/egg/hic2cool/__main__.py", line 82, in main
  File "build/bdist.linux-x86_64/egg/hic2cool/hic2cool_utils.py", line 1204, in hic2cool_update
  File "<string>", line 1, in <module>
NameError: name 'y' is not defined
carlvitzthum commented 5 years ago

Hi @imerelli

Thank you for reporting this issue. It was due to a python 2/3 incompatibility and should currently work with python 3. I will work on a fix for python 2 and keep you updated.

imerelli commented 5 years ago

Honestly I have problems also with python3


$ python --version
Python 3.6.6
$ hic2cool -v
hic2cool 0.6.0
$ hic2cool update inter_30.mcool_old 
#########################
### hic2cool / update ###
#########################
Traceback (most recent call last):
  File "/opt/anaconda3/bin/hic2cool", line 11, in <module>
    load_entry_point('hic2cool==0.6.0', 'console_scripts', 'hic2cool')()
  File "/opt/anaconda3/lib/python3.6/site-packages/hic2cool-0.6.0-py3.6.egg/hic2cool/__main__.py", line 82, in main
  File "/opt/anaconda3/lib/python3.6/site-packages/hic2cool-0.6.0-py3.6.egg/hic2cool/hic2cool_utils.py", line 1178, in hic2cool_update
TypeError: strptime() argument 1 must be str, not bytes
carlvitzthum commented 5 years ago

This is likely because you originally created inter_30.mcool_old using hic2cool with python 2. I will add a quick fix for that as well.

carlvitzthum commented 5 years ago

@imerelli

I have released hic2cool 0.7.0, which should fix python 2 issues with hic2cool update. Additionally, any further files run through update using python 2 will be compatible with python 3. However, files created using python 2 and any previous version of hic2cool will continue to have the issue you pointed out above when updating them with python 3 -- the problem was that some attributes were not being written in unicode format as expected.

Please let me know if you have any questions or further issues.

Best, Carl