GuangyuWangLab2021 / cellDancer

Predict RNA velocity through deep learning
https://guangyuwanglab2021.github.io/cellDancer_website/
BSD 3-Clause "New" or "Revised" License
60 stars 11 forks source link

Computing Cell_velocities projections between CellDancer vs Dynamo #14

Closed willey2020 closed 11 months ago

willey2020 commented 1 year ago

Hello! Thank you so much for providing this great package.

I did meet a similar issue for a long time for the late lineage's arrow being reversed. Follow the upstream computation and with the parameters in the example of the CellDancer package in (https://guangyuwanglab2021.github.io/cellDancer_website/notebooks/case_study_gastrulation.html):

(cd.compute_cell_velocity(cellDancer_df=cellDancer_df_filtered, projection_neighbor_choice='gene', expression_scale='power10', ),

I see that the late lineage arrow direction in my dataset is correct now as the erythroid tutorial shows, which points to the end but not reversed. (Thanks to CellDancer!)

However, once I try the following Dynamo steps for computing vector field, in the initial steps, I import the CellDancer's RNA velocities into the Dynamo anndata, then Dynamo needs to recalculate its cell_velocities by "dyn.tl.cell_velocities".nd tried its few parameters following the CellDancer tutorial, such as method="pearson" etc, then following dyn.pl.streamline_plot, I found the arrow is reversed again and it is quite different than CellDancer's cell_velocity calculation.

I tried to compare these two, and found one thing, the parameter of "projection_neighbor_choice='gene'", in CellDancer cd.compute_cell_velocity, is very crucial, as once I changed it back to "=' embedding", the arrow is reversed again in CellDancer. expression_scale='power10' is also very helpful and necessary.

Could you help to troubleshoot what the meaning and role of "projection_neighbor_choice='gene'" do here and how to make a unified cell_velocity calculation between CellDancer and Dynamo? Thank you very much!

Abclisy commented 1 year ago

Hello, thank you for using cellDancer and reaching out! "projection_neighbor_choice='gene'" means to use the distance between cells in the dimension of all genes' expression to obtain the neighbors when projecting the RNA velocity instead of using the embedding space such as UMAP.

To help you solve the problem, just want to make sure which formatting transfer function did you use. If the one you used is celldancer.export_velocity_to_dynamo, which is in our case study notebook, probably this is the reason. Because in this notebook, we used the function of dynamo to project the RNA velocity to the UMAP. We also have a function celldancer.to_dynamo to help users export all information to adata including the projection of cell transition direction. Another thing is that, after the transfer, the functions below need basis = "cdr" instead of the original basis = "umap". Hope the answer will be helpful to you. If you have any question, please don't hesitate to tell us.

dyn.pl.streamline_plot
dyn.pl.topography
willey2020 commented 1 year ago

Thank you very much @Abclisy! Yes, I did go through it by using the notebook example but didn't know about the celldancer.to_dynamo; I will try it asap and see what happened. Thank you again!

Abclisy commented 11 months ago

Hello, it's been a while since we heard back from you regarding this issue. We will be closing this issue. However, please don't hesitate to reopen it or create a new issue if you have further questions or concerns. Thank you for your understanding.