ventolab / CellphoneDB

CellPhoneDB can be used to search for a particular ligand/receptor, or interrogate your own HUMAN single-cell transcriptomics data.
https://www.cellphonedb.org/
MIT License
304 stars 52 forks source link

Unexpected error in cellphonedb: AttributeError: Can only use .str accessor with string values! #180

Closed starfallin closed 2 months ago

starfallin commented 2 months ago

Hi! I am a junior learner in Bioinformatics. Recently, I met a mistake when I ran cellphonedb with the command line below. I don't know what is going wrong and how to solve this problem. Could anyone help me ? Sincerely!

cellphonedb method statistical_analysis cellphonedb_meta.txt cellphonedb_count.txt --database ./.cpdb/releases/v5.0.0 --counts-data=gene_name

That's the output information. Thanks !

[ ][APP][06/04/24-18:57:39][INFO] User selected database /home/.cpdb/releases/v5.0.0 is available, using it [ ][CORE][06/04/24-18:57:39][INFO] Initializing SqlAlchemy CellPhoneDB Core [ ][CORE][06/04/24-18:57:39][INFO] Using custom database at /home/.cpdb/releases/v5.0.0 [ ][APP][06/04/24-18:57:40][INFO] Launching Method cpdb_statistical_analysis_local_method_launcher [ ][APP][06/04/24-18:57:40][INFO] Launching Method _set_paths [ ][APP][06/04/24-18:57:40][INFO] Launching Method _load_meta_counts [ ][APP][06/04/24-19:38:55][INFO] Launching Method _check_counts_data [ ][APP][06/04/24-19:38:55][ERROR] Unexpected error Traceback (most recent call last): File "/home/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/api_endpoints/terminal_api/method_terminal_api_endpoints/method_terminal_commands.py", line 150, in statistical_analysis debug, File "/home/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 55, in cpdb_statistical_analysis_local_method_launcher self._check_counts_data(counts, counts_data) File "/home/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 325, in _check_counts_data if ~np.all(counts.index.str.startswith("ENSG0")) and counts_data=="ensembl": File "/home/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/accessor.py", line 187, in get accessor_obj = self._accessor(obj) File "/home/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/strings.py", line 2100, in init self._inferred_dtype = self._validate(data) File "/home/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/strings.py", line 2157, in _validate raise AttributeError("Can only use .str accessor with string values!") AttributeError: Can only use .str accessor with string values!

starfallin commented 2 months ago

Sorry, I had checked my input data, and found that my count data lacked necessary gene name for seurat v5 omits gene id in count data layer. After revising the input data, cellphonedb works