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
308 stars 51 forks source link

numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U21'), dtype('<U21')) -> dtype('<U21') #78

Closed Inbarpl closed 1 year ago

Inbarpl commented 1 year ago

Dear ventolab, I was using Cellphone db previously, it is running well with test and old files but not with new ones I create ( I use a small python script to replace gene mouse gene ids into human homologues gene ids and remove ones without homologues - it woked in the past). What was changed in my side? Different normalization techniq Could you please advise what is the problem? Many thanks in advance Inbar I get this error: cellphonedb method statistical_analysis clusters_WT.txt data_h_WT.txt [ ][CORE][24/11/22-09:44:02][INFO] Initializing SqlAlchemy CellPhoneDB Core [ ][CORE][24/11/22-09:44:02][INFO] Using custom database at /sci/home/inbar.p/.cpdb/releases/v2.0.0/cellphone.db [ ][APP][24/11/22-09:44:02][INFO] Launching Method cpdb_statistical_analysis_local_method_launcher [ ][APP][24/11/22-09:44:02][INFO] Launching Method _set_paths [ ][APP][24/11/22-09:44:02][WARNING] Output directory (/sci/labs/sharona/inbar.p/projects_new/Ophir/out) exist and is not empty. Result can overwrite old results [ ][APP][24/11/22-09:44:02][INFO] Launching Method _load_meta_counts [ ][APP][24/11/22-09:44:05][INFO] Launching Method _check_counts_data [ ][CORE][24/11/22-09:44:05][INFO] Launching Method cpdb_statistical_analysis_launcher [ ][CORE][24/11/22-09:44:05][INFO] Launching Method _counts_validations [ ][CORE][24/11/22-09:44:05][INFO] Launching Method get_interactions_genes_complex [ ][CORE][24/11/22-09:44:05][INFO] [Cluster Statistical Analysis] Threshold:0.1 Iterations:1000 Debug-seed:-1 Threads:4 Precision:3 [ ][CORE][24/11/22-09:44:06][INFO] Running Real Analysis [ ][APP][24/11/22-09:44:06][ERROR] Unexpected error Traceback (most recent call last): File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/ops/array_ops.py", line 143, in na_arithmetic_op result = expressions.evaluate(op, left, right) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/computation/expressions.py", line 233, in evaluate return _evaluate(op, op_str, a, b) # type: ignore File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/computation/expressions.py", line 68, in _evaluate_standard return op(a, b) numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U21'), dtype('<U21')) -> dtype('<U21')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/sci/home/inbar.p/A/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 "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 75, in cpdb_statistical_analysis_local_method_launcher output_path File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/method_launcher.py", line 111, in cpdb_statistical_analysis_launcher output_path) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_method.py", line 43, in call output_path File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_complex_method.py", line 73, in call separator) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py", line 361, in mean_analysis columns=(pd.Series(cluster1_names) + separator + pd.Series(cluster2_names)).values) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/ops/common.py", line 65, in new_method return method(self, other) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/ops/init.py", line 343, in wrapper result = arithmetic_op(lvalues, rvalues, op) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/ops/array_ops.py", line 190, in arithmetic_op res_values = na_arithmetic_op(lvalues, rvalues, op) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/ops/array_ops.py", line 150, in na_arithmetic_op result = masked_arith_op(left, right, op) File "/sci/home/inbar.p/A/miniconda3/envs/cpdb/lib/python3.7/site-packages/pandas/core/ops/array_ops.py", line 112, in masked_arith_op result[mask] = op(xrav[mask], y) numpy.core._exceptions._UFuncNoLoopError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U21'), dtype('<U21')) -> dtype('<U21')

prete commented 1 year ago

Hi @Inbarpl thank you for using CellphoneDB.

Could you check that the cluster/cell types on your meta file are not just numbers? if they are, could you please try changing them to strings by renaming them to something like cluster_1instead of just simply 1.

Inbarpl commented 1 year ago

Thank you @prete very much. It solved the issue Inbar