Produce separate matrices from clustering expression data using scanpy
0
0
Entering edit mode
20 months ago
el24 ▴ 40

Hi all,

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!

Edit: I think I can find cell names and their clusters using adata.obs['leiden'].

RNA-Seq scanpy clustering leiden • 1.1k views
ADD COMMENT
0
Entering edit mode

Hi! I have not used scanpy, but have used Seurat and also developed my own scRNA-seq package. You seem to have already found the answer, correct?

ADD REPLY
1
Entering edit mode

Thanks, Kevin! I think I did, but I was a little unsure that my approach is the best way, I hope someone more familiar with scanpy package can assure me. Thanks for checking!

ADD REPLY

Login before adding your answer.

Traffic: 1253 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6