ma-compbio / Higashi

single-cell Hi-C, scHi-C, Hi-C, 3D genome, nuclear organization, hypergraph
MIT License
78 stars 11 forks source link

ValueError: setting an array element with a sequence. #50

Closed Accompany0313 closed 6 months ago

Accompany0313 commented 6 months ago

Hi Dr. Zhang,

When I execute Higashi's higashi_model.train_for_imputation_nbr_0(), I get the following error:

Traceback (most recent call last): File "/home/zzl/.conda/envs/higashi/lib/python3.9/concurrent/futures/process.py", line 246, in _process_worker r = call_item.fn(*call_item.args, **call_item.kwargs) File "/home/ygc/Higashi/higashi/Higashi_wrapper.py", line 324, in one_thread_generate_neg to_neighs = np.array(to_neighs)[:-1] ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2515,) + inhomogeneous part.

I tried to change the Numpy version, but when I changed to 1.22.0, 1.19.2, 1.24.6, the problem still did not resolve. Could you help me solve this problem? Thank you very much

ruochiz commented 6 months ago

Ah, I think it's from numpy stop autobroadcasting for dtype='object'. So the fix should be to_neighs = np.array(to_neighs, dtype='object')[:-1]

But I think that fix has been updated in the repo, just not in the conda version. Could you try to git clone the repo and do pip install ./ instead to see if the latest version fix that error? Thx!