theislab / single-cell-tutorial

Single cell current best practices tutorial case study for the paper:Luecken and Theis, "Current best practices in single-cell RNA-seq analysis: a tutorial"
1.39k stars 458 forks source link

Subclustering #65

Closed lu77777777 closed 3 years ago

lu77777777 commented 3 years ago

Hi, Thank you for your excellent tutorial to help me understand the whole processing of single-cell analysis. I have a question. when I ran

Subcluster enterocytes

sc.tl.louvain(adata, restrict_to=('louvain_r0.5', ['Enterocyte']), resolution=0.2, key_added='louvain_r0.5_entero_sub') It has no error information. But the outcome is running Louvain clustering using the "louvain" package of Traag (2017) finished: found 9 clusters and added 'louvain_r0.5_entero_sub', the cluster labels (adata.obs, categorical) (0:00:00) I watched the adata.obs['louvain_r0.5_entero_sub'] adata.obs['louvain_r0.5_entero_sub']

AAACATACAGCGGA Paneth AAACATACCTTACT Goblet AAACATACTTTGCT TA AAACCGTGCAGTCA EP (early) AAACGCTGCAGTCA EP (stress) ...
TTTCAGTGACCAGT TA TTTCGAACAGAACA Goblet TTTCTACTGCTCCT Stem TTTGACTGCGCCTT Stem TTTGCATGGAGGAC Goblet Name: louvain_r0.5_entero_sub, Length: 12457, dtype: category Categories (9, object): ['EP (early)', 'EP (stress)', 'Enterocyte,0', 'Enteroendocrine', ..., 'Paneth', 'Stem', 'TA', 'Tuft'] It seems not subclustering the Enterocyte. Do you know whats the problem?

LuckyMD commented 3 years ago

Hi @lu77777777, This is a bit strange. Could you show the output you have for adata before running this command, and after? And also please print the output of adata.obs['louvain_r0.5].value_counts() and adata.obs['louvain_r0.5_entero_sub].value_counts() after running the command.

lu77777777 commented 3 years ago

Hi, the outcome of adata.obs['louvain_r0.5'].value_counts() TA 3729 EP (early) 2707 Stem 1789 Goblet 1366 EP (stress) 941 Enterocyte 698 Paneth 682 Enteroendocrine 288 Tuft 257 Name: louvain_r0.5, dtype: int64

the outcome of adata.obs['louvain_r0.5_entero_sub'].value_counts() TA 3729 EP (early) 2707 Stem 1789 Goblet 1366 EP (stress) 941 Enterocyte,0 698 Paneth 682 Enteroendocrine 288 Tuft 257 Name: louvain_r0.5_entero_sub, dtype: int64

LuckyMD commented 3 years ago

So the code is working as intended. You did get a subclustering of Enterocytes, but only into 1 cluster (Enterocyte,0). If you increase the resolution, you will get more.

lu77777777 commented 3 years ago

Hi, Thank you so much.