dpeerlab / Palantir

Single cell trajectory detection
https://palantir.readthedocs.io
GNU General Public License v2.0
226 stars 52 forks source link

Are diffusion components used in visualizations? #151

Closed miloAhn closed 1 week ago

miloAhn commented 1 week ago

Hi, I've been studying Palantir a lot lately. Thank you for creating such an awesome package.

In the Palantir paper and tutorial, tSNE maps are generated using diffusion components, so I thought that if I follow the tutorial, UMAPs are also generated using diffusion components.

However, after trying some things, the UMAPs and FDL generated after calculating only PCA were the same as the tutorial. I looked more in details at the sc.tl.umap and sc.tl.draw_graph functions, and it seems that if I don't set any parameters, they are calculated with the neighbor information calculated by sc.pp.neighbors. It seems that sc.pp.neighbors also computes with PCA embeddings if I don't set any parameters.

This means that if I follow the tutorial, the UMAPs or FDL will be computed as PCs, not diffusion components. Is my understanding correct?

Calculating diffusion maps in Palantir is not for differentiating visualizations, but for the next step, MAGIC imputation or Running Palantir?

katosh commented 1 week ago

Hi @miloAhn, thank you for reaching out.

You are correct, diffusion map results are only used for downstream computations like fate probabilities, pseudotime, and MAGIC imputation. We do generally not recommend using them for UMAPs since the resulting structures might be misleading. However, you can technically run UMAPs on our result by first computing neighbor distances based on the diffusion map representation through sc.pp.neighbors(ad, use_rep="DM_EigenVectors", metric='euclidean').