# CellAssign keyword error: After Integration

**URL:** <https://discourse.scverse.org/t/cellassign-keyword-error-after-integration/493>\
**Category:** scvi-tools\
**Tags:** scvi\
**Created:** [May 26, 2022, 8:38pm UTC](https://discourse.scverse.org/t/cellassign-keyword-error-after-integration/493 "2022-05-26T20:38:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AkilaRanjith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/akilaranjith/32/255_2.png) [@AkilaRanjith](https://discourse.scverse.org/u/AkilaRanjith)\
**Post date:** [May 26, 2022, 8:38pm UTC](https://discourse.scverse.org/t/cellassign-keyword-error-after-integration/493/1 "2022-05-26T20:38:02Z")

</div>

Hello All,

I have done integration using scvi protocol. Total cell count 65,785 from 4 batches.

I would like to Annotate the clusters using CellAssign module.  
error message  
raise KeyError(KeyError: “Values [‘PLP1’, ‘MOG’, ‘ST18’, ‘MBP’, ‘OLIG1’, ‘ACTN2’, ‘COL18A1’, ‘DHCR24’, ‘LRRC63’,], are not valid obs/ var names or indices.”

I have also looked inside my adata.var these listed genes are present in the adata.var.

```auto
type or paste code here
import scvi
import anndata
import scanpy as sc
import numpy as np
import pandas as pd
##read annadata
adata=anndata.read_h5ad("/home/akila/adata_scvi.h5ad")
adata.var_names_make_unique()
adata.obs_names_make_unique()

##read marker gene list
marker_gene_mat = pd.read_csv('/home/Akila/Shell/celltype.csv', index_col=0)

## copy marker gene list to adata object
bdata = adata[:, marker_gene_mat.index].copy()

```

---

<div class="post-metadata">

**Author:** ![Justin\_Hong](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/justin_hong/32/85_2.png) [@Justin\_Hong](https://discourse.scverse.org/u/Justin_Hong)\
**Post date:** [May 26, 2022, 10:14pm UTC](https://discourse.scverse.org/t/cellassign-keyword-error-after-integration/493/2 "2022-05-26T22:14:17Z")

</div>

Hi,

Thanks for using scvi-tools. This sounds like an issue with your AnnData object rather than an scvi-tools issue. Could you show the output of adata.var\_names[:5]? Its possible your call to adata.var\_names\_make\_unique() altered the gene names such that your indexing no longer works.

---

<div class="post-metadata">

**Author:** ![AkilaRanjith](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/akilaranjith/32/255_2.png) [@AkilaRanjith](https://discourse.scverse.org/u/AkilaRanjith)\
**Post date:** [May 26, 2022, 11:03pm UTC](https://discourse.scverse.org/t/cellassign-keyword-error-after-integration/493/3 "2022-05-26T23:03:37Z")

</div>

> [@Justin\_Hong](#):
>
> adata.var\_names[:5]

Thanks for your reply.  
Here is the screen shot of the adata.var (before/after indexing)

 ![var_output](https://canada1.discourse-cdn.com/flex035/uploads/forum11/original/1X/b16d2ee04aaf7771e6b1d033c765d4f6ef028355.png)

---

<div class="post-metadata">

**Author:** ![Justin\_Hong](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/justin_hong/32/85_2.png) [@Justin\_Hong](https://discourse.scverse.org/u/Justin_Hong)\
**Post date:** [May 26, 2022, 11:37pm UTC](https://discourse.scverse.org/t/cellassign-keyword-error-after-integration/493/4 "2022-05-26T23:37:01Z")

</div>

Looks like your var\_names are the gene ids (e.g. ENSG00000186827.11) rather than the gene names. To filter the columns by gene names you have to do something like this: `adata[:, adata.var["gene_name"] == marker_gene_mat.index]`.
