Hi I wonder how I can perform a test of differentially expressed genes between two Leiden clusters in scvi totalVI. I can do this in Scanpy using rank_genes_groups. Thanks!
Hi taopeng1100. Thanks for reaching out. We have a tutorial that explains how to perform DE with the TOTALVI model. You can find it here: CITE-seq analysis with totalVI — scvi-tools. It is similar to scanpy’s DE API.
Let us know if that doesn’t help.
The link leads to DEG for one versus all other clusters. How can I do one cluster versus another one for DEG? Thx!
Something is not exactly related to DEG here. When I save my analysis results in h5ad and read it into Jupyter notebook, the vae file is NOT available? vae generation is very time consuming, how can I save vae results so I can load it again next time for analysis?
Thx!
Tao
You can use the groupby
parameter the differential_expression
method, by passing the set of the two clusters you want to compare to each other.
groupby
The key of the observations grouping to consider.
group1
Subset of groups, e.g. [`'g1'`, `'g2'`, `'g3'`], to which comparison
shall be restricted, or all groups in `groupby` (default).
group2
If `None`, compare each group in `group1` to the union of the rest of the groups
in `groupby`. If a group identifier, compare with respect to this group.
Thank you so much for you prompt reply!
Can I ask you this question?
For this step: sc.pp.highly_variable_genes, the tutorial is like this:
n_top_genes=4000,
flavor=“seurat_v3”,
I used to do like this:
sc.pp.highly_variable_genes(adata, min_mean=0.0125, max_mean=3, min_disp=0.5)
What are the best practice to select highly_variable_genes?
I appreciate your insights!
Tao
There are some helpful resources on scanpy’s discourse (such as this post), although they do not address your question specifically. @adamgayoso is likely to have good insights on this front so I delegate to him.
A good discussion on gene selection is this article on M3Drop: https://academic.oup.com/bioinformatics/article/35/16/2865/5258099
Original repository of M3Drop: GitHub - tallulandrews/M3Drop
If interested in using their method it is implemented in scvi with the poisson_gene_selection
function: scvi-tools/_preprocessing.py at master · YosefLab/scvi-tools · GitHub