aristoteleo / dynamo-release

Inclusive model of expression dynamics with conventional or metabolic labeling based scRNA-seq / multiomics, vector field reconstruction and differential geometry analyses
https://dynamo-release.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
417 stars 59 forks source link

Perturbation with non-PCA gene? #352

Closed valarauko closed 2 years ago

valarauko commented 2 years ago

Thank you for this excellent tool!

In trying the perturbation function, I see it’s restricted to only PCA genes. Is there a way to run a perturbation workflow on genes that aren’t part of the PCA genes?

Xiaojieqiu commented 2 years ago

hey @valarauko thanks for using dynamo. To predict the effects of genetic perturbation, we will need to use the learned vector field in PCA space and that is the fundamental reason that we can only use PCA genes for predictions.

However, you can still add any gene of interests as part of the pca gene set when using recipe_monocle, using something like the following:

dyn.pp.recipe_monocle(
    adata,
    genes_to_use=selected_genes_to_use, # set pca genes as your genes of interests
    genes_to_append=your_genes_of_interests, # or add gene here
    n_top_genes=len(selected_genes_to_use),
    # feature_selection_layer="new",
    maintain_n_top_genes=True,
)

Pleasecheck the documentation of recipe_monocle for additional information https://dynamo-release.readthedocs.io/en/latest/_autosummary/dynamo.pp.recipe_monocle.html#dynamo.pp.recipe_monocle

Xiaojieqiu commented 2 years ago

with such, then you can calculate RNA velocity, learn vector field and eventually use dynamo to predict the cell fate diversions after genetic perturbation with any genes of your interests. Hope this solves your problem!

valarauko commented 2 years ago

Thank you for the prompt reply! Yes, passing the list of genes of interest via the reciple_monocle allows me to project the perturbations for the genes. Thank you so much!

I hope it's OK for me to ask some related questions here.

Xiaojieqiu commented 2 years ago

thanks for the two additional questions. Because of my crazy time schedules, let me briefly answer you here:

  1. adata.layers['j_delta_x_perturbation'] stores the results of the perturbation effects after the in silico perturbation for each gene in each cell. you can use this matrix for any differential analyses
  2. please use ?dyn.pd.predictions to see the documentation. I will fix the readthedocs issue when I get some free time. you are welcoem to help on this regard too.
Xiaojieqiu commented 2 years ago

@valarauko the API has updated: https://dynamo-release.readthedocs.io/en/latest/API.html