rajewsky-lab / novosparc

BSD 3-Clause "New" or "Revised" License
125 stars 41 forks source link

how can I save a tissue object #58

Closed shermas closed 2 years ago

shermas commented 2 years ago

Hey,

I would like to save the tissue object I generated, but I couldn't clearly find what type of object it is. Could you explain how to save this object?

Thanks, Shachar

enessenel commented 2 years ago

Hello,

you can use pickle functions to save the Tissue object.

For example:

tissue = novosparc.cm.Tissue(dataset, locations, output_folder)

import pickle
with open('my_tissue.pkl', 'wb') as output_file:
    pickle.dump(tissue, output_file, pickle.HIGHEST_PROTOCOL)

Then you can load it as follows:

with open('my_tissue.pkl', 'rb') as input_file:
    tissue = pickle.load(input_file)

Best, Enes