STOmics / Stereopy

A toolkit of spatial transcriptomic analysis.
MIT License
180 stars 59 forks source link

Can I read h5ad file, and convert it into different bin resolution? #228

Closed YuchiQiu closed 5 months ago

YuchiQiu commented 6 months ago

Hi, I have a h5ad stored for a raw stereo-seq data in bin1 resolution. I found using st.io.read_ann_h5ad cannot change its bin resolution. Here are my codes:

for bin_size in [10,20,50,100]:
    adata=st.io.read_ann_h5ad(file_path=filepath,
                              spatial_key='spatial',
                              bin_type='bins',
                              bin_size=bin_size,)
    st.io.stereo_to_anndata(adata,flavor='scanpy',output='bin='+str(bin_size)+'.h5ad')

All files I got have the identical number of cells in bin1. Do I have to read gef file instead of the h5ad file?

Thank you!

tanliwei-coder commented 6 months ago

No,h5ad file can not be parsed into different bin size, the parameter bin_size in read_ann_h5ad is only used to specify the bin size of the data stored in file, only gef or gem can be parsed into different bin size.