jianhuupenn / TESLA

Deciphering tumor ecosystems at super-resolution from spatial transcriptomics with TESLA
MIT License
38 stars 10 forks source link

[TESLA] Step5. Annotation (Assertion Error) #14

Closed jpark27 closed 4 months ago

jpark27 commented 4 months ago

Dear @jianhuupenn and Tesla team,

Hi, all! Thank you so much for sharing great tool with community. I have been testing TESLA with in-house and toy data you provided, but keep encountering 'assertion error' as follows on step5.

[0] Dependent package versions scanpy==1.9.8 anndata==0.10.6 umap==0.5.5 numpy==1.26.4 scipy==1.12.0 pandas==2.2.1 scikit-learn==1.4.1.post1 statsmodels==0.14.1 pynndescent==0.5.11

[1] Code and Error tried both target_size="small" and "large"

image

Computing image band... Computing gene band... Running TESLA...

AssertionError Traceback (most recent call last) Cell In[107], line 7 5 genes=list(set([i for i in genes if i in enhanced_exp_adata.var.index ])) 6 #target_size can be set to "small" or "large". ----> 7 pred_refined, target_clusters, c_m=tesla.annotation(img=img, 8 binary=binary, 9 sudo_adata=enhanced_exp_adata, 10 genes=genes, 11 resize_factor=resize_factor, 12 num_required=1, 13 target_size="large") 14 #Plot 15 ret_img=tesla.visualize_annotation(img=img, 16 binary=binary, 17 resize_factor=resize_factor, 18 pred_refined=pred_refined, 19 target_clusters=target_clusters, 20 c_m=c_m)

File /lustre/scratch126/cellgen/team283/jp27/02_tools/TESLA/TESLA_package/TESLA/annotation.py:77, in annotation(img, sudo_adata, genes, resize_factor, binary, res, num_required, pooling, rseed, tseed, nseed, nChannel, threshold, radius, minLabels, train_refine, plot_intermedium, target_size, min_UMI) 75 #-------------------------------TESLA-------------------------------------------------# 76 print("Running TESLA...") ---> 77 assert np.max(img_band1)==1 and np.min(img_band1)==0 and np.max(gene_band1)==1 and np.min(gene_band1)==0 78 data=np.concatenate((img_band1, gene_band1), axis=2) 79 random.seed(rseed)

AssertionError:

[3] Up until Step4, plotting super-resolution image was without any issue with both in-house and toy data. image

[4] I ran diagnosis function you provided and it throws following: image

I think previous user come across same issue but I couldn't find any solution on this. https://github.com/jianhuupenn/TESLA/issues/4

Can you guide us what/how to modify step(s) to resolve this issue?

beset wishes, J

jianhuupenn commented 4 months ago

Thanks for your interest in TESLA. The error arises because some genes in your list exhibit very low UMI counts. Please try to add one parameter in the annotation function:

pred_refined, target_clusters, c_m=tesla.annotation(...,min_UMI=1)