deeptools / HiCExplorer

HiCExplorer is a powerful and easy to use set of tools to process, normalize and visualize Hi-C data.
https://hicexplorer.readthedocs.org
GNU General Public License v3.0
233 stars 70 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte #344

Closed hwick closed 5 years ago

hwick commented 5 years ago

Hello, I am getting a unicode error similar to the one that appears in issue #174 when trying to run hicBuildMatrix. None of my file names have non-ASCII/non-standard characters as far as I am aware, though, so I'm unsure what the origin of the error is (the author of #174 got around it by omitting a title, which does not seem relevant in this case):

hicBuildMatrix --samFiles /path/to/Ctrl_R1_hg19.bwt2merged.bam /path/to/Ctrl_R2_hg19.bwt2merged.bam \
                 --binSize 10000 \
                 --restrictionSequence AAGCTT \
                 --threads 4 \
                 --inputBufferSize 100000 \
                 --outBam /path/to/Ctrl.bam \
                 -o /path/to/Ctrl_matrix.h5 \
                 --QCfolder /path/to/hicQC

error:

Traceback (most recent call last):
  File "/cm/shared/jhmi/apps/HiCExplorer/python2.7.6/64/2.0/bin/hicBuildMatrix", line 7, in <module>
    main()
  File "/cm/shared/jhmi/apps/python/gcc/64/2.7.6/lib/python2.7/site-packages/hicexplorer/hicBuildMatrix.py", line 1465, in main
    QC.main("-l {} -o {}".format(log_file_name, args.QCfolder).split())
  File "/cm/shared/jhmi/apps/python/gcc/64/2.7.6/lib/python2.7/site-packages/hicexplorer/hicPrepareQCreport.py", line 284, in main
    read_orientation_table, table)
  File "/cm/shared/jhmi/apps/python/gcc/64/2.7.6/lib/python2.7/site-packages/hicexplorer/hicPrepareQCreport.py", line 65, in save_html
    .format(lambda x: '{:,}'.format(x) if x > 1 else '{:.2%}'.format(x)).render())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1241: ordinal not in range(128)

I saw that a related ascii error was fixed for a different HiCExplorer function in #175, but perhaps not for this/other functions? Please advise how to resolve this error. Thanks, ~ Heather

joachimwolff commented 5 years ago

Hi Heather,

Two remarks:

Best,

Joachim

hwick commented 5 years ago

I am using version 2.1. I will try to update to version 2.2 using python 3 and rerun.

joachimwolff commented 5 years ago

Could you solve the issue?

hwick commented 5 years ago

Hi, We could not get pip to install version 2.2, so we installed 2.1.1 on python 3 and reran. We ran into this error:

Traceback (most recent call last):
  File "/cm/shared/jhmi/apps/HiCExplorer/python3.5.6/bin/hicBuildMatrix", line 7, in <module>
    main()
  File "/cm/shared/jhmi/apps/python3.5.6/lib/python3.5/site-packages/hicexplorer/hicBuildMatrix.py", line 1465, in main
    QC.main("-l {} -o {}".format(log_file_name, args.QCfolder).split())
  File "/cm/shared/jhmi/apps/python3.5.6/lib/python3.5/site-packages/hicexplorer/hicPrepareQCreport.py", line 284, in main
    read_orientation_table, table)
  File "/cm/shared/jhmi/apps/python3.5.6/lib/python3.5/site-packages/hicexplorer/hicPrepareQCreport.py", line 61, in save_html
    html = open(os.path.join(root, "qc_template.html"), "r")
FileNotFoundError: [Errno 2] No such file or directory: '/cm/shared/jhmi/apps/python3.5.6/lib/python3.5/site-packages/hicexplorer/qc_template.html'

We had gotten this same error before switching to python 3, and worked around it by manually downloading qc_template.html and moving it to the proper folder, so we have done that and are currently rerunning with the hopes that both this and the ascii error goes away with this run (if not, we will have to figure out some way to install 2.2). I'll keep you posted. Thanks!

joachimwolff commented 5 years ago

Hi,

I have to apologize, the pip version is not that well updated from our side. I will try to update this soon. However, we prefer to use conda and in the bioconda channel the newest HiCExplorer version is always available. See http://bioconda.github.io/#using-bioconda

Best,

Joachim

joachimwolff commented 5 years ago

Hi,

I updated the Python 2 version in pip to 2.2.1. Please let me know if it works and solves your issues.

Best,

Joachim