theislab / ncem

Learning cell communication from spatial graphs of cells
https://ncem.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
102 stars 13 forks source link

Work with 10X Visium Estimator #149

Open junyho486 opened 1 year ago

junyho486 commented 1 year ago

Question

Dear @AnnaChristina and ncem developers, thank you for creating this impressive tool! I am studying immune signalling in the visium data. For this reason, I deconvoluted a single cell reference atlas into the visium anndata and created anndatas containing the cell specific expression as shown here: https://github.com/theislab/ncem_benchmarks/blob/main/notebooks/data_preparation/deconvolution/cell2location_human_lymphnode.ipynb.

I did not find any further explanation in the documentation or the tutorials and could not figure it by looking into the functions available but am I correct to analyze the visium signaling like this eg.

## Initialize ncem model for deconvoluted Visium
          ncem_ip = InterpreterDeconvolution()

          ncem_ip.data = customLoaderDeconvolution(
              adata=adata, patient=None, library_id='library_id', radius=None
          )

          print("Load the data for visium")
          get_data_custom(interpreter=ncem_ip, deconvolution=True)

          print("Get sender and receiver effects")

          ncem_ip.get_sender_receiver_effects()

            ## Get type coupling
            type_coupling = ncem_ip.type_coupling_analysis_circular(edge_width_scale=0.3,edge_attr='magnitude', figsize=(20,20), text_space=1.28, de_genes_threshold=150,suffix=f"{niche}_type_coupling_analysis_circular.pdf")

            type_coupling.to_csv(f."/#{sample}_T_ST_{niche}_NCEM_Object_type_coupling.csv")

            ## Get type coupling
            ncem_ip.type_coupling_analysis(figsize=(15, 15),suffix=f"{niche}_type_coupling_analysis_Heatmap.pdf")

or should I first train the estimator and then load the model into the interpreter.

Either way, how can I access, or plot features learned by the estimator for deconvoluted visium?

Thanks in advance for your help!