Teichlab / cellphonedb

MIT License
345 stars 105 forks source link

Unable to call cellphonedb functions after install #351

Closed aokhan closed 3 years ago

aokhan commented 3 years ago

Hi guys - let me preface this by saying I am not a bioinformatician, and very new to this so apologies in advance if any of the below is painfully dumb!

I've installed cellphonedb via conda as described and everything seems fine (package is installed when you run conda list)

I can import cellphone db, but the problem starts after this I can't seem to call 'method' or run it in anyway.

I've uninstalled and reinstalled the conda environment, tried it using virtual env but no luck. I'm running the latest CellPhoneDB (2.1.7) on python 3.7.

Thanks - any help much appreciated!

cechlauren commented 3 years ago

I used this package with no issues yesterday, but today I am having the same issue that you mentioned. I'm picking up an error in the site-packages (cellphonedb and pandas) within my virtual environment...I do not know if a dependency is no longer compatible with cellphonedb methods or if its some other update that I cannot see. I've tried troubleshooting with force installing an earlier version of pandas within my vent but this did not resolve the issue. I'll try to install an earlier version of cellphonedb and let you know if it works.

prete commented 3 years ago

Hi @aokhan and @cechlauren, thank you for trying CellPhoneDB. Could you describe a bit more the error you're getting? any message you see on the terminal?

I've just tried

conda create -n cpdb python=3.8
conda activate cpbd
pip install cellphonedb

that installed wihtout any issues (I've tried both macOS and Ubuntu) after that I download the example files and run the analysis method:

curl https://raw.githubusercontent.com/Teichlab/cellphonedb/master/in/example_data/test_counts.txt --output test_counts.txt
curl https://raw.githubusercontent.com/Teichlab/cellphonedb/master/in/example_data/test_meta.txt --output test_meta.txt
cellphonedb method analysis test_meta.txt test_counts.txt 
cechlauren commented 3 years ago

cpdb-venv) (base) PCD-H63L40Y-LT:CPDB lcech$ cellphonedb method statistical_analysis ./cellphonedbFT_meta.txt ./cellphonedbFT_count.txt --project-name=TF_IM06_CPDB --output-path=./CPDB --counts-data=gene_name /Users/lcech/sqlite/cpdb-venv/lib/python3.8/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) [ ][APP][29/09/21-11:36:41][WARNING] Latest local available version is v2.0.0, using it [ ][APP][29/09/21-11:36:41][WARNING] User selected downloaded database v2.0.0 is available, using it [ ][CORE][29/09/21-11:36:41][INFO] Initializing SqlAlchemy CellPhoneDB Core [ ][CORE][29/09/21-11:36:41][INFO] Using custom database at /Users/lcech/.cpdb/releases/v2.0.0/cellphone.db [ ][APP][29/09/21-11:36:41][INFO] Launching Method cpdb_statistical_analysis_local_method_launcher [ ][APP][29/09/21-11:36:41][INFO] Launching Method _set_paths [ ][APP][29/09/21-11:36:41][INFO] Launching Method _load_meta_counts [ ][CORE][29/09/21-11:37:05][INFO] Launching Method cpdb_statistical_analysis_launcher [ ][CORE][29/09/21-11:37:05][INFO] Launching Method _counts_validations [ ][CORE][29/09/21-11:37:07][INFO] [Cluster Statistical Analysis] Threshold:0.1 Iterations:1000 Debug-seed:-1 Threads:4 Precision:3 [ ][APP][29/09/21-11:37:09][ERROR] Unexpected error Traceback (most recent call last): File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/cellphonedb/src/api_endpoints/terminal_api/method_terminal_api_endpoints/method_terminal_commands.py", line 127, in statistical_analysis LocalMethodLauncher(cpdb_app.create_app(verbose, database)). \ File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 54, in cpdb_statistical_analysis_local_method_launcher self.cellphonedb_app.method.cpdb_statistical_analysis_launcher( File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/cellphonedb/src/core/methods/method_launcher.py", line 62, in cpdb_statistical_analysis_launcher cpdb_statistical_analysis_method.call(meta, File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_method.py", line 23, in call cpdb_statistical_analysis_complex_method.call(meta.copy(), File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_complex_method.py", line 65, in call clusters = cpdb_statistical_analysis_helper.build_clusters(meta, counts_filtered, complex_composition_filtered) File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py", line 76, in build_clusters clusters['means'][cluster_name] = cluster_count.apply(lambda count: count.mean(), axis=1) File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/pandas/core/frame.py", line 6928, in apply return op.get_result() File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/pandas/core/apply.py", line 180, in get_result return self.apply_empty_result() File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/pandas/core/apply.py", line 216, in apply_empty_result return self.obj._constructor_sliced(np.nan, index=self.agg_axis) File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/pandas/core/series.py", line 314, in init data = sanitize_array(data, index, dtype, copy, raise_cast_failure=True) File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/pandas/core/internals/construction.py", line 712, in sanitize_array subarr = construct_1d_arraylike_from_scalar(value, len(index), dtype) File "/Users/lcech/sqlite/cpdb-venv/lib/python3.8/site-packages/pandas/core/dtypes/cast.py", line 1233, in construct_1d_arraylike_from_scalar subarr = np.empty(length, dtype=dtype) TypeError: Cannot interpret '<attribute 'dtype' of 'numpy.generic' objects>' as a data type

prete commented 3 years ago

Some thoughts on that:

cechlauren commented 3 years ago

Thank you @prete for your reply. I have done some debugging and found that one of my helper functions was introducing NAs into my metadata file. Everything works now. Thanks for making such a great resource.

aokhan commented 3 years ago

Hi both @prete and @cechlauren - thanks for your replies! I've been on leave for a couple of days but THINK the above has helped solve the problem! Will post if issue persists.

Thanks very much again excited to use this tool.