doganlab / scmags

Marker Gene Selection Tool For Spatial Transcriptomics
https://scmags.readthedocs.io/en/latest/
Apache License 2.0
7 stars 1 forks source link

How to save and load scmags object #1

Open RenchaoChen opened 1 year ago

RenchaoChen commented 1 year ago

Thank you for providing this useful tool, wondering how to save and load the scmags object, thanks.

bashalo commented 1 year ago

Hello Sir,

I hope this tool will help you study more efficiently.

There isn't a built-in function that can save the scmags object, but you can use the following code:

import pandas as pd
file_name = 'scmags_object.pkl'
with open(file_name, 'wb') as file:
# You should add your scmags object name instead of pollen
    pd.to_pickle(pollen, file)

Additionally, to read written files:

pollen = pd.read_pickle("scmags_object.pkl") 
RenchaoChen commented 1 year ago

Thank you!