Teichlab / cellphonedb

MIT License
342 stars 105 forks source link

KeyError: 'ENSG00000182985' #205

Closed CHENGHAO-WANG closed 4 years ago

CHENGHAO-WANG commented 4 years ago

Hi, When I ran CellPhoneDB on my scRNA data, I got the following error messages on some samples.

[ ][APP][10/09/20-22:19:17][ERROR] Unexpected error /nas/longleaf/apps/python/3.6.6/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.cluster.kmeans module is deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.cluster. Anything that cannot be imported from sklearn.cluster is now part of the private API. warnings.warn(message, FutureWarning) Traceback (most recent call last): File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3078, in get_loc return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'ENSG00000182985'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/api_endpoints/terminal_api/method_terminal_api_endpoints/method_terminal_commands.py", line 144, in statistical_analysis subsampler, File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 64, in cpdb_statistical_analysis_local_method_launcher subsampler File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/core/methods/method_launcher.py", line 75, in cpdb_statistical_analysis_launcher self.separator) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_method.py", line 35, in call result_precision, File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_simple_method.py", line 59, in call counts_data=counts_data) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py", line 246, in percent_analysis counts_data=counts_data) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py", line 413, in cluster_interaction_percent percent_receptor = percent_cluster_receptors[interaction['{}{}'.format(counts_data, suffixes[0])]] File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/pandas/core/frame.py", line 2688, in getitem return self._getitem_column(key) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/pandas/core/frame.py", line 2695, in _getitem_column return self._get_item_cache(key) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/pandas/core/generic.py", line 2489, in _get_item_cache values = self._data.get(item) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/pandas/core/internals.py", line 4115, in get loc = self.items.get_loc(item) File "/nas/longleaf/apps/cellphonedb/2.1.4/cpdb/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'ENSG00000182985'

Does anyone know any solutions to this? Thanks!

bobermayer commented 4 years ago

Hi, I had likely the same error (for me it read KeyError: 'KLRG2') on some samples, although KLRG2 is present in the count files. turns out I had some NA values in the cell_type column, after removing them the error wasn't raised again.