File ~\anaconda3\envs\ngtools\lib\site-packages\pandas\core\indexes\base.py:6644, in Index.drop(self, labels, errors)
6642 if mask.any():
6643 if errors != "ignore":
-> 6644 raise KeyError(f"{list(labels[mask])} not found in axis")
6645 indexer = indexer[~mask]
6646 return self.delete(indexer)
Hi Fursham, I got this error after clustering when I trying to show cells:
obj.showCells(RGB_contrasts=[4,3,4], n=5, ch2show={'red':'lamB', 'green':'b3'}, filter = "leiden == '2'")
KeyError Traceback (most recent call last) Input In [42], in <cell line: 1>() ----> 1 obj.showCells(RGB_contrasts=[4,3,4], n=5, ch2show={'red':'lamB', 'green':'b3'}, filter = "leiden == '2'")
File c:\users\bb_lab\documents\github2\ng_tools\ngtools\analyzer.py:736, in Analyzor.showCells(self, n, cells, ch2show, order_by, ascending, fig_height, fig_width, show_nucleus, RGB_contrasts, uniqID, filter) 734 obj = self.copy() 735 if type(filter) is str: --> 736 obj.filterCells(filter = filter) 738 show_cell(obj.data['raw'], order_by, fig_height, fig_width, show_nucleus, RGB_contrasts, uniqID, ch2show, n, 739 obj.meta['channels'], ascending, cells)
File c:\users\bb_lab\documents\github2\ng_tools\ngtools\analyzer.py:903, in Analyzor.filterCells(self, filter, data_type, cells, inplace) 901 self.data['raw'] = self.data['raw'].loc[cells,] 902 self.data['norm'] = self.data['norm'].loc[cells,] --> 903 self.updateAData() 904 else: 905 dat = self.copy()
File c:\users\bb_lab\documents\github2\ng_tools\ngtools\analyzer.py:524, in Analyzor.updateAData(self) 523 def updateAData(self): --> 524 self.buildAData(self.excfeat) 525 self.normAData()
File c:\users\bb_lab\documents\github2\ng_tools\ngtools\analyzer.py:985, in Analyzor.buildAData(self, excluded_features) 983 dat_vars = self.data['norm'].copy() 984 dat_vars = dat_vars.select_dtypes(include=['float64', 'int64', 'float32']) --> 985 dat_vars = dat_vars.drop(columns=to_drop) 987 # get obs data 988 dat_obs = self.data['norm'].copy()
File ~\anaconda3\envs\ngtools\lib\site-packages\pandas\util_decorators.py:311, in deprecate_nonkeyword_arguments..decorate..wrapper(*args, *kwargs)
305 if len(args) > num_allow_args:
306 warnings.warn(
307 msg.format(arguments=arguments),
308 FutureWarning,
309 stacklevel=stacklevel,
310 )
--> 311 return func(args, **kwargs)
File ~\anaconda3\envs\ngtools\lib\site-packages\pandas\core\frame.py:4954, in DataFrame.drop(self, labels, axis, index, columns, level, inplace, errors) 4806 @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"]) 4807 def drop( 4808 self, (...) 4815 errors: str = "raise", 4816 ): 4817 """ 4818 Drop specified labels from rows or columns. 4819 (...) 4952 weight 1.0 0.8 4953 """ -> 4954 return super().drop( 4955 labels=labels, 4956 axis=axis, 4957 index=index, 4958 columns=columns, 4959 level=level, 4960 inplace=inplace, 4961 errors=errors, 4962 )
File ~\anaconda3\envs\ngtools\lib\site-packages\pandas\core\generic.py:4267, in NDFrame.drop(self, labels, axis, index, columns, level, inplace, errors) 4265 for axis, labels in axes.items(): 4266 if labels is not None: -> 4267 obj = obj._drop_axis(labels, axis, level=level, errors=errors) 4269 if inplace: 4270 self._update_inplace(obj)
File ~\anaconda3\envs\ngtools\lib\site-packages\pandas\core\generic.py:4311, in NDFrame._drop_axis(self, labels, axis, level, errors, consolidate, only_slice) 4309 new_axis = axis.drop(labels, level=level, errors=errors) 4310 else: -> 4311 new_axis = axis.drop(labels, errors=errors) 4312 indexer = axis.get_indexer(new_axis) 4314 # Case for non-unique axis 4315 else:
File ~\anaconda3\envs\ngtools\lib\site-packages\pandas\core\indexes\base.py:6644, in Index.drop(self, labels, errors) 6642 if mask.any(): 6643 if errors != "ignore": -> 6644 raise KeyError(f"{list(labels[mask])} not found in axis") 6645 indexer = indexer[~mask] 6646 return self.delete(indexer)
KeyError: "['leiden'] not found in axis"