STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
184 stars 64 forks source link

data.plt.grn_dotplot() TypeError: unhashable type: 'DataFrame' #181

Closed Biomamba closed 10 months ago

Biomamba commented 11 months ago

Dear author: I have successed performed the GRN prediction and the heatmap visualization worked. However, the function data.plt.grn_dotplot of latest version has changed. The first parameter should be a str rather than DataFrame. data.plt.grn_dotplot(data.tl.result['leiden'],network_res_key='regulatory_network_inference') image

data.plt.grn_dotplot(data.tl.result['leiden'],network_res_key='regulatory_network_inference')

However, when I change it to str. I still met the following TypeError: data.plt.grn_dotplot(cluster_res_key='leiden', network_res_key='regulatory_network_inference')
image

Cloud you please tell me how to solved it?

tanliwei-coder commented 11 months ago

Sorry, the tutorial makes a little mistake, the first parameter of grn_dotplot is only needed to set to 'leiden' which specifies the clustering result.

Biomamba commented 11 months ago

Sorry, the tutorial makes a little mistask, the first parameter of grn_dotplot is only need to set to 'leiden' which specifies the clustering result.

Thank you for your reply, but it still doesn't work when I change data.tl.result['leiden'] into 'leiden'.

Biomamba commented 11 months ago

Sorry, the tutorial makes a little mistask, the first parameter of grn_dotplot is only need to set to 'leiden' which specifies the clustering result.

Thank you for your reply, but it still doesn't work when I change data.tl.result['leiden'] into 'leiden'. Following is the error: image

tanliwei-coder commented 11 months ago

Sorry, a bug is catched by you, there is a temporary solution, you can enter into the installed directory of stereopy and find out the file where grn_dotplot is located to eliminate this bug, you can do it like below:

import os
import stereo as st
root_dir = os.path.dirname(st.__file__)
print(os.path.join(root_dir, 'algorithm/regulatory_network_inference/plot_grn.py'))

Now, you can get the path of file containing grn_dotplot, and then, open this file and locate to line 321, change the 'bin' to 'bins', i think it can work.