You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When posting an issue, please look up previous issues with potentially the same topic. This is addressed in issue #21. A recent Anndata update now solves an issue I was addressing with 2 lines in the script. You can now comment those out.
Hi,
When I try to run the following line (on the case study) I receive an error:
adata.var['gene_id'] = adata.var['gene_id-1']
KeyError Traceback (most recent call last)
//anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2656 try:
-> 2657 return self._engine.get_loc(key)
2658 except KeyError:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'gene_id-1'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
in
31 # Concatenate to main adata object
32 adata = adata.concatenate(adata_tmp, batch_key='sample_id')
---> 33 adata.var['gene_id'] = adata.var['gene_id-1']
34 #adata.var.drop(columns = ['gene_id-1', 'gene_id-0'], inplace=True)
35 #adata.obs.drop(columns=['sample_id'], inplace=True)
//anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in getitem(self, key)
2925 if self.columns.nlevels > 1:
2926 return self._getitem_multilevel(key)
-> 2927 indexer = self.columns.get_loc(key)
2928 if is_integer(indexer):
2929 indexer = [indexer]
//anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2657 return self._engine.get_loc(key)
2658 except KeyError:
-> 2659 return self._engine.get_loc(self._maybe_cast_indexer(key))
2660 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2661 if indexer.ndim > 1 or indexer.size > 1:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'gene_id-1'
Seems like the 'adata.concatenate' function does not create any variables as 'gene_id-1' or 'gene_id-0'. Can you please check this?
The text was updated successfully, but these errors were encountered: