scHiCExplorer icon indicating copy to clipboard operation
scHiCExplorer copied to clipboard

TypeError: unhashable type: 'csr_matrix'

Open janemd2012 opened this issue 3 years ago • 3 comments

Hi There,

Firstly, thanks for the great tools to explore the sc HiC data! I tested scHiCExplorer pipe following the instruction. I started from Download of the fastq files. Everything went on very well until Correction The command line used: scHicCorrectMatrices -m nagano2017_normalized.scool -o nagano2017_corrected.scool --threads 20 Error messages:(both python3.6 and 3.8 did not work and got the similar error) _ image _

Any suggestion on how to fix hashing errors in scHiCExplorer? Many thanks!

janemd2012 avatar Sep 26 '22 21:09 janemd2012

I googled how to fix this issue.I found a similar issue in a different SparseLSH years ago. It mentioned that

Mutable data like CSR matrices in python 3+ don't have a hashable type because it can't guarantee a unique mapping. You can either override hash with some key scheme that will ensure a unique mapping based on its data or use a non-hashing data structure.

I'm just wondering anyone can help and show me how to fix the issue? Many thanks.

janemd2012 avatar Sep 28 '22 00:09 janemd2012

I have the same issue in python3.8 at the same step.

Traceback (most recent call last):
File "/opt/conda/bin/scHicCorrectMatrices", line 7, in <module>
main()
File "/opt/conda/lib/python3.8/site-packages/schicexplorer/scHicCorrectMatrices.py", line 169, in main
matrixFileHandler.save(args.outFileName, pSymmetric=True, pApplyCorrection=False)
File "/opt/conda/lib/python3.8/site-packages/hicmatrix/lib/matrixFileHandler.py", line 57, in save
self.matrixFile.save(pName, pSymmetric, pApplyCorrection)
File "/opt/conda/lib/python3.8/site-packages/hicmatrix/lib/scool.py", line 46, in save
bins_dict[coolObject.matrixFile.matrixFileName] = bins_data_frame
TypeError: unhashable type: 'csr_matrix'

As the last traceback error suggest, the error is in the hicmatrix library here

nitishnih avatar Sep 28 '22 14:09 nitishnih

I get the same error when use schicexplorer v7, finally fixed by change to v5.

orangeSi avatar Jun 01 '24 16:06 orangeSi