scanorama icon indicating copy to clipboard operation
scanorama copied to clipboard

Error when taking the union of genes

Open brianhie opened this issue 1 year ago • 0 comments

Discussed in https://github.com/brianhie/scanorama/discussions/154

Originally posted by haiderabbas678 February 20, 2024

KeyError Traceback (most recent call last) Cell In[213], line 4 2 lis=[Nuc1, Nuc2, R_Ctrl, R_14B, R_14C, R_70B, R_70C, R_120A, R_120B] 3 corrected=scanorama.integrate_scanpy(lis, union=True) ----> 4 corrected=scanorama.correct_scanpy(lis, union=True)

File ~/miniconda3/lib/python3.11/site-packages/scanorama/scanorama.py:249, in correct_scanpy(adatas, **kwargs) 245 adata.var_names = genes 246 gene2idx = { gene: idx for idx, gene in 247 zip(adatas[i].var.index, 248 adatas[i].var_names.values) } --> 249 var_idx = [ gene2idx[gene] for gene in genes ] 250 adata.var = adatas[i].var.loc[var_idx] 252 adata.uns = adatas[i].uns

File ~/miniconda3/lib/python3.11/site-packages/scanorama/scanorama.py:249, in (.0) 245 adata.var_names = genes 246 gene2idx = { gene: idx for idx, gene in 247 zip(adatas[i].var.index, 248 adatas[i].var_names.values) } --> 249 var_idx = [ gene2idx[gene] for gene in genes ] 250 adata.var = adatas[i].var.loc[var_idx] 252 adata.uns = adatas[i].uns

KeyError: '0610005C13Rik'

So I took the union of genes in my anndata sample but i got this error and do not understand what the problem is. Plz advise? corrected=scanorama.integrate_scanpy(lis, union=True) corrected=scanorama.correct_scanpy(lis, union=True)

brianhie avatar Feb 20 '24 21:02 brianhie