joachimwolff / scHiCExplorer

Single-cell Hi-C data analysis toolbox
https://schicexplorer.readthedocs.io/
MIT License
23 stars 2 forks source link

TypeError: unhashable type: 'csr_matrix' #13

Open janemd2012 opened 2 years ago

janemd2012 commented 2 years ago

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 commented 2 years ago

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.

nitishnih commented 2 years ago

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

orangeSi commented 5 months ago

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