Subsetting anndata on basis of louvain clusters
1
1
Entering edit mode
3.6 years ago

Hello, I want to subset anndata on basis of clusters, but i am not able to understand how to do it.

I am running scVelo pipeline, and in that i ran tl.louvain function to cluster cells on basis of louvain. I got around 32 clusters, of which cluster 2 and 4 is of my interest, and i have to run the pipeline further on these clusters only. (Initially i had the loom file which i read in scVelo, so i have now the anndata.)

I tried using adata.obs["louvain"] which gave me the cluster information, but i need to write a new anndata with only 2 clusters and process further.

Please help on how to subset anndata. Any help is highly appreciated. (Being very new to it, i am finding it difficult to get)

python scanpy anndata R RNA-Seq • 5.4k views
ADD COMMENT
2
Entering edit mode
3.2 years ago

adata = adata[adata.obs['louvain'].isin(['2','4'])]

ADD COMMENT

Login before adding your answer.

Traffic: 2630 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