YosefLab / Hotspot

https://hotspot.readthedocs.io/en/latest/
MIT License
95 stars 14 forks source link

saving hotspot result (hs and module) #33

Open parkjooyoung99 opened 1 year ago

parkjooyoung99 commented 1 year ago

Dear developer,

I am trying to save the hotspot objects but have no idea how to do this. I have tried converting it to df and save as csv, and saving it as h5f file which i thought is a standard way to save file. However, converting it to csv seems to change the structure where i cannot draw correlation plot, and saving as hdf file gives me the error as inappropriate file type.

Are there any way to save the objects? Thank you1

yangqianq commented 7 months ago

hi, you can saving the objects by using "pickle" packages

save the objects where hs is a hotspot objects

with open('./hotspots_test.pkl', 'wb') as f: pickle.dump(hs, f)

open the objects

with open('./hotspots_test.pkl', 'rb') as f: hs = pickle.load(f)