single positional indexer is out-of-bounds
I am trying to run CellphoneDB but I am getting error messages "single positional indexer is out-of-bounds" and "Error processing Meta data". please see the messages below and let me know how to fix thiss error.
cellphonedb method statistical_analysis cellphonedb_meta.txt cellphonedb_count.txt
/usr/local/lib/python3.7/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.cluster.k_means_ 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)
[ ][APP][20/06/21-23:25:54][WARNING] Latest local available version is v2.0.0, using it
[ ][APP][20/06/21-23:25:54][WARNING] User selected downloaded database v2.0.0 is available, using it
[ ][CORE][20/06/21-23:25:54][INFO] Initializing SqlAlchemy CellPhoneDB Core
[ ][CORE][20/06/21-23:25:54][INFO] Using custom database at /Users/kate/.cpdb/releases/v2.0.0/cellphone.db
[ ][APP][20/06/21-23:25:54][INFO] Launching Method cpdb_statistical_analysis_local_method_launcher
[ ][APP][20/06/21-23:25:54][INFO] Launching Method _set_paths
[ ][APP][20/06/21-23:25:54][INFO] Launching Method _load_meta_counts
[ ][CORE][20/06/21-23:28:56][INFO] Launching Method cpdb_statistical_analysis_launcher
[ ][APP][20/06/21-23:28:56][ERROR] Unexpected error
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/cellphonedb/src/core/preprocessors/method_preprocessors.py", line 28, in meta_preprocessor
meta = pd.DataFrame(data={'cell_type': meta_raw.iloc[:, 1]})
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 873, in getitem
return self._getitem_tuple(key)
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1443, in _getitem_tuple
self._has_valid_tuple(tup)
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 702, in _has_valid_tuple
self._validate_key(k, i)
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1352, in _validate_key
self._validate_integer(key, axis)
File "/usr/local/lib/python3.7/site-packages/pandas/core/indexing.py", line 1437, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
IndexError: single positional indexer is out-of-bounds
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/cellphonedb/src/api_endpoints/terminal_api/method_terminal_api_endpoints/method_terminal_commands.py", line 144, in statistical_analysis subsampler, File "/usr/local/lib/python3.7/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 64, in cpdb_statistical_analysis_local_method_launcher subsampler File "/usr/local/lib/python3.7/site-packages/cellphonedb/src/core/methods/method_launcher.py", line 50, in cpdb_statistical_analysis_launcher meta = method_preprocessors.meta_preprocessor(raw_meta) File "/usr/local/lib/python3.7/site-packages/cellphonedb/src/core/preprocessors/method_preprocessors.py", line 35, in meta_preprocessor raise ProcessMetaException cellphonedb.src.core.exceptions.ProcessMetaException.ProcessMetaException: Error processing Meta data
Hi @singcell, sounds like either an error with either your meta file or with pandas. Could you please:
a) provide your version of CellPhoneDB and pandas? (pip show pandas cellphonedb)
b) check that you're using the right separator for the file? (if it's .txt then it should be \t (tab)
Thank you for your reply. Please see below.
Name: pandas Version: 1.1.4 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Author: None Author-email: None License: BSD Location: /usr/local/lib/python3.7/site-packages Requires: pytz, python-dateutil, numpy Required-by: CellPhoneDB, anndata
Name: CellPhoneDB Version: 2.1.7 Summary: Inferring cell-cell communication Home-page: https://cellphonedb.org Author: TeichLab Author-email: [email protected] License: MIT Location: /usr/local/lib/python3.7/site-packages Requires: Flask-Testing, anndata, geosketch, h5py, numpy, Flask-RESTful, click, PyYAML, rpy2, requests, pika, flask, SQLAlchemy, boto3, tqdm, pandas, scikit-learn Required-by:
b) I tried both and comma.
Hi @singcell thank you for checking the versions. I think the issue comes from the formatting of that file. Without having a closer look at your input files is hard to tell. Could you share your cellphonedb_meta.txt?