Scanpy: gene find with visualization functions but not with subsetting

Created on 16 Jan 2020  路  2Comments  路  Source: theislab/scanpy


I am looking for the expression of 'NCAM1'. It works when I am plotting my data (umap, violin plot, matrix plot) but I cant find it in the adata.var and I am not able to subset adata for this particular gene while it is working with the other genes.


#what works:
marker_genes = ['NCAM1']
ax = sc.pl.violin(adata, marker_genes, groupby='timepoint')

# what doesnt work:
subset_NCAM = adata[:, 'NCAM1']


"None of [Index(['NCAM1'], dtype='object', name='index')] are in the [index]"

Versions:

1.4.4

bug

All 2 comments

Hi @shendong124,

My guess is that 'NCAM1' is in your adata.raw.var_names but not in adata.var_names. Could it be that you have filtered your adata after assigning adata.raw? When you plot gene expression, adata.raw is used to plot expression values by default.

This was very helpful! thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

koalap-2018 picture koalap-2018  路  3Comments

falexwolf picture falexwolf  路  4Comments

zhangguy picture zhangguy  路  5Comments

erikadudki picture erikadudki  路  3Comments

giovp picture giovp  路  4Comments