STOmics / Stereopy

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

AttributeError when doing Multi-sample batch qc #274

Closed Mr-grasscarp closed 4 months ago

Mr-grasscarp commented 4 months ago

Hello!When I was following the tutorial of multi-sample batch qc, and run this code ms_data.plt.show_batch_qc_report(scope=slice_generator[:], mode='integrate', res_key='batch_qc') I met this AttributeError AttributeError: No attribute named 'StPipeline.batch_qc' I want to know how to solve this problem,Thanks!

tanliwei-coder commented 4 months ago

I try to run this function but no errors, could you show me all the codes of your pipeline?

Mr-grasscarp commented 4 months ago

ok, here's the code I used

import stereo as st from stereo.core.ms_data import MSData from stereo.core.ms_pipeline import slice_generator

import warnings warnings.filterwarnings('ignore')

data1 = st.io.read_gef("D:\devlr\offline_stereopy\multisample\lr4.gef",bin_type='bins', bin_size=15) data2 = st.io.read_gef("D:\devlr\offline_stereopy\multisample\lr8.gef",bin_type='bins', bin_size=15)

ms_data = MSData(_relationship='time_series', _var_type='intersect')

ms_data += data1 ms_data += data2

ms_data.integrate() ms_data

ms_data.tl.cal_qc(scope=slice_generator[:],mode='integrate') ms_data.tl.raw_checkpoint()

ms_data.tl.normalize_total(scope=slice_generator[:],mode='integrate') ms_data.tl.log1p(scope=slice_generator[:],mode='integrate') ms_data.tl.scale(scope=slice_generator[:],mode='integrate', zero_center=False, max_value=10)

ms_data.tl.pca(scope=slice_generator[:],mode='integrate', use_highly_genes=False, n_pcs=30, res_key='pca') ms_data.tl.neighbors(scope=slice_generator[:],mode='integrate', pca_res_key='pca', res_key='neighbors') ms_data.tl.umap(scope=slice_generator[:],mode='integrate', pca_res_key='pca', neighbors_res_key='neighbors', res_key='umap')

ms_data.tl.leiden(scope=slice_generator[:],mode='integrate', neighbors_res_key='neighbors', res_key='leiden')

ms_data.tl.batch_qc(scope=slice_generator[:],mode='integrate', cluster_res_key='leiden', report_path="D:\devLr\offline_stereopy\multisample", res_key='batch_qc')

tanliwei-coder commented 4 months ago

Which version of your stereopy? BatchQC was added start from version 0.13.0b1, If lower than this version, you need to upgrade to latest version 1.2.0.

Mr-grasscarp commented 4 months ago

well,I just update the software to 1.2.0 but the error persists

tanliwei-coder commented 4 months ago

Did you run it on jupyter-notebook or use python script to run on shell? If run on shell, what was the script file name? The script file name can not be batch_qc.py, it will be conflict with the package name in Stereopy.