STOmics / Stereopy

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

No attribute named 'StPipeline.batch_qc' in Batch QC #195

Closed TaoyuJoshua closed 9 months ago

TaoyuJoshua commented 10 months ago

I've tried the pipeline Batch QC under 0.13 and 0.14 editions, but the same problem occured File ~/miniconda3/envs/Stereopy13/lib/python3.8/site-packages/stereo/algorithm/algorithm_base.py:89, in AlgorithmBase.get_attribute_helper(item, stereo_exp_data, res) 88 try: ---> 89 import(f"stereo.algorithm.{item}") 90 except:

File ~/miniconda3/envs/Stereopy13/lib/python3.8/site-packages/stereo/algorithm/batch_qc/init.py:1 ----> 1 from .main import BatchQc 2 from .plot_batch_qc import ShowBatchQcReport

File ~/miniconda3/envs/Stereopy13/lib/python3.8/site-packages/stereo/algorithm/batch_qc/main.py:4 3 from stereo.algorithm.algorithm_base import AlgorithmBase ----> 4 from .batchqc_raw import batchqc_raw 6 class BatchQc(AlgorithmBase):

File ~/miniconda3/envs/Stereopy13/lib/python3.8/site-packages/stereo/algorithm/batch_qc/batchqc_raw.py:20 19 import matplotlib ---> 20 from .test import * 21 from .module import domain_variance_score

File ~/miniconda3/envs/Stereopy13/lib/python3.8/site-packages/stereo/algorithm/batch_qc/test/init.py:11 10 from .distribution_fitting import distribution_fitting ---> 11 from .heatmap import sample_heatmap 12 from .joint_plot import joint_plot ... 93 # TODO: this may be not the best way to get sub-class 94 # num of subclasses may be like 100-200 at most 95 for sub_cls in AlgorithmBase.subclasses():

AttributeError: No attribute named 'StPipeline.batch_qc' I'd like to know how to solve it. Thanks.

tanliwei-coder commented 10 months ago

Hi!! Could you give the error infomation at the bottom?

TaoyuJoshua commented 10 months ago

File ~/miniconda3/envs/Stereopy13/lib/python3.8/site-packages/stereo/algorithm/batch_qc/test/init.py:11 10 from .distribution_fitting import distribution_fitting ---> 11 from .heatmap import sample_heatmap 12 from .joint_plot import joint_plot ... 93 # TODO: this may be not the best way to get sub-class 94 # num of subclasses may be like 100-200 at most 95 for sub_cls in AlgorithmBase.subclasses():

AttributeError: No attribute named 'StPipeline.batch_qc' I think it's the bottom

tanliwei-coder commented 10 months ago

@TaoyuJoshua

I had tried to run this workflow, but never met this error, could you show me your codes?

TaoyuJoshua commented 10 months ago

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

import warnings warnings.filterwarnings('ignore')

prepara for input directory

data1 = st.io.read_h5ad('/home/zijin/Stereopy/Stereopy_Demo_Data/Demo_MouseEmbryo/AnnData_0.8.0/Embyro_E9.5.h5ad',bin_type='bins', bin_size=1) data2 = st.io.read_h5ad('/home/zijin/Stereopy/Stereopy_Demo_Data/Demo_MouseEmbryo/AnnData_0.8.0/Embyro_E10.5.h5ad',bin_type='bins', bin_size=1)

construct MSData object

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

ms_data += data1 ms_data += data2 ms_data.integrate() ms_data

preprocessing

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)

embedding

ms_data.tl.pca(scope=slice_generator[:],mode='integrate', use_highly_genes=False, n_pcs=50, 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')

clustering

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='./batch_qc', res_key='batch_qc') Here is my code, and after running the last row, the problem occurs.

14MBD4 commented 9 months ago

@TaoyuJoshua

I had tried to run this workflow, but never met this error, could you show me your codes?

Hello, I met this problem with stereopy13 too. May I ask what is your stereopy version?

tanliwei-coder commented 9 months ago

@TaoyuJoshua so weird, your codes looks no problem, try to reinstall stereopy to latest version by running pip install --force-reinstall stereopy==0.14.0b1 and run again.

tanliwei-coder commented 9 months ago

@14MBD4 0.14.0b1, you need to install it by specifying version number explicitly.