I'm sorry, I'm having a very basic issue and for the life of me can not resolve it. This is what I run:
```
adata = st.read(file_name= 'stem.txt', workdir= './Stream')
adata
```
The above is my count file. Then I pass :
```
st.add_cell_colors(adata, file_name = 'simplecolour.txt')
st.add_cell_labels(adata, file_name = 'lineage.txt')
```
Where 'simplecolour' is a text file (no headers) where column 1 is the name of the cells as they appear in the count file, and column two is the colour that that cell should have (I've used hex codes).
'lineage' is again all the cells, as named in the count file in column 1 and in column 2 is their appropriate lineage. These two commands passed together throw the following error :
```
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2896 try:
-> 2897 return self._engine.get_loc(key)
2898 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: 'label'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-252-a08df3834e60> in <module>
----> 1 st.add_cell_colors(adata, file_name = 'simplecolour.txt')
2 st.add_cell_labels(adata, file_name = 'lineage.txt')
~/anaconda3/lib/python3.7/site-packages/stream/core.py in add_cell_colors(adata, file_path, file_name)
289
290 _fp = lambda f: os.path.join(file_path,f)
--> 291 labels_unique = adata.obs['label'].unique()
292 if(file_name!=None):
293 df_colors = pd.read_csv(_fp(file_name),sep='\t',header=None,index_col=None,names=['label','color'],
~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
2993 if self.columns.nlevels > 1:
2994 return self._getitem_multilevel(key)
-> 2995 indexer = self.columns.get_loc(key)
2996 if is_integer(indexer):
2997 indexer = [indexer]
~/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2897 return self._engine.get_loc(key)
2898 except KeyError:
-> 2899 return self._engine.get_loc(self._maybe_cast_indexer(key))
2900 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2901 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: 'label'
```
I'm sorry if im being dumb. I tried doing the obvious thing of adding in the header for the appropriate column as 'label' and 'label_color' but that hasnt worked either. Would anyone have a suggestion? or be able to share even a screenshot of how they present their data so I can replicate it? Thanks
Can you post the first ~5 lines of each file so we can replicate?
gives me :
.
gives:
I also tried a different colour file where I named every sequenced cell individually with a colour based on the group they belong to but that gave the same error too. It looked something like :
Also tried with hex code colours....same error.