Subsetting anndata using genelist

Hi there, I want to subset my anndata using a list of gene names. I have about 2000 genes to extract from the original anndata. Is there a way to do this?
Any suggestions/help would be much appreciated!
Thanks

Hi @skoturan,

You can index into the anndata’s columns with the gene names, like adata[:, ["gene1", "gene2", ...]]. You may also want to check out this page from the anndata docs:

https://anndata-tutorials.readthedocs.io/en/latest/getting-started.html#Subsetting-AnnData

Thank you! It worked :smile:

1 Like