YangLabHKUST / STitch3D

Construction of a 3D whole organism spatial atlas by joint modeling of multiple slices
https://stitch3d-tutorial.readthedocs.io/en/latest/index.html#
MIT License
52 stars 2 forks source link

Cannot run the code in "Visualizing results in 2D" and save "clustering_result.csv" #7

Closed cristalliao closed 1 year ago

cristalliao commented 1 year ago

Dear Professor, I want to know what is the problem with Example 2 in "Visualizing results in 2D". I encountered several problems when I try this great STitch3D in Example 2. sc.pp.neighbors(model.adata_st, use_rep='latent', n_neighbors=30) sc.tl.louvain(model.adata_st, resolution=0.5) model.adata_st.obs["louvain"].to_csv(os.path.join(save_path, "clustering_result.csv")) for i, adata_st_i in enumerate(result): adata_st_i.obs["louvain"] = model.adata_st.obs.loc[adata_st_i.obs_names, ]["louvain"] color = ['#7570b3', '#1b9e77', '#d95f02', '#66a61e', '#e7298a'] plt.rcParams["figure.figsize"] = (4, 4) for i, adata_st_i in enumerate(result): sc.pl.spatial(result[i], img_key="hires", color=["louvain"], palette=color, size=1.5) in this part "Run STitch3D on the human heart dataset". The following pictures are my encountered problems:

Screen Shot 2023-04-25 at 12 41 03 pm

Thanks in advance!

gefeiwang commented 1 year ago

Hi Cristal,

I found a similar error in leiden, caused by different versions of python-igraph package, see https://github.com/atarashansky/SAMap/issues/93. Could you try this solution to see whether it works or not?

cristalliao commented 1 year ago

Hi Geifei, I tried this many times, but it still does not work for my server computer. Is there any solution for me to solve this problem? The error message: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. leidenalg 0.9.1 requires igraph<0.11,>=0.10.0, but you have igraph 0.9.9 which is incompatible. Thanks in advance! Very appreciated! Best regards, Cristal

gefeiwang commented 1 year ago

Hi Cristal,

It seems that the leigenalg package version 0.9.1 is incompatible with igraph 0.9.9. You can try to also downgrade leigenalg. We have tested STitch3D using python-igraph==0.9.1, louvain==0.7.0, leidenalg==0.7.0, which do not have the issue you reported.

Best, Gefei

cristalliao commented 1 year ago

Dear Gefei, Thanks a lot! This problem has been solved! Very appreciated! Best regards, Cristal