I am using scanpy package to perform the clustering of single-cell data. I followed the tutorial on scanpy and now, I have my adata as follows:
AnnData object with n_obs × n_vars = 492 × 2225
obs: 'n_genes', 'percent_mito', 'n_counts', 'leiden' var: 'gene_ids', 'feature_types', 'n_cells', 'highly_variable', 'means', 'dispersions', 'dispersions_norm' uns: 'leiden', 'leiden_colors', 'neighbors', 'pca', 'rank_genes_groups', 'umap' obsm: 'X_pca', 'X_tsne', 'X_umap' varm: 'PCs'
I would like to group cells based on their cluster membership and put all their expression data together. For example, if we have the following scRNA-seq data:
E = cell1 cell2 cell3 cell4 cell5 cell6 gene1 gene2 gene3 ... ... ...
Imagine we have cell1 cell5 are in cluster 1, and cell2 and cell3 in cluster 2, and cell4 and cell6 in cluster 3. Then I want to have 3 matrices to store their scRNA-seq separately as following:
E1 = cell1 cell5 gene1 gene2 gene3 ....
E2 = cell2 cell3 gene1 gene2 gene3 ....
E3 = cell4 cell6 gene1 gene2 gene3 ....
My first concern is that I wasn't able to figure out which cells are in any of the clusters using the result of scanpy Leiden clustering. I appreciate any recommendations!
Could you please tell me how I can produce E1, E2, and E3? If I know the above question, I think I can solve this one. Thanks!