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

Equality comparisons are not supported for AnnData objects, instead compare the desired attributes. #183

Closed zhongzheng1999 closed 1 month ago

zhongzheng1999 commented 2 months ago

counts_file_path must is a path to the normalized count matrix, or an in-memory AnnData object, but when you make an Anndata object, cellphonedb doesn't work!


NotImplementedError Traceback (most recent call last) Cell In[21], line 1 ----> 1 cpdb_results = cpdb_analysis_method.call( 2 cpdb_file_path=cpdb_file_path, 3 meta_file_path=meta_file_path, 4 counts_file_path=adata_count, 5 counts_data='hgnc_symbol', 6 score_interactions=True, 7 output_path=out_path, 8 separator='|', 9 threads=5, 10 threshold=0.1, 11 result_precision=3, 12 debug=False, 13 output_suffix='M1' 14 )

File ~/mambaforge/envs/scanpy/lib/python3.11/site-packages/cellphonedb/src/core/methods/cpdb_analysis_method.py:79, in call(cpdb_file_path, meta_file_path, counts_file_path, counts_data, output_path, microenvs_file_path, separator, threshold, result_precision, debug, output_suffix, score_interactions, threads) 77 # Report error unless the required arguments have been provided 78 required_arguments = [cpdb_file_path, meta_file_path, counts_file_path, counts_data, output_path] ---> 79 if None in required_arguments or '' in required_arguments: 80 raise MissingRequiredArgumentsException(description="All of the following arguments need to be provided: {}".format( 81 "cpdb_file_path, meta_file_path, counts_file_path, counts_data, output_path")) 83 # Load into memory CellphoneDB data

File ~/mambaforge/envs/scanpy/lib/python3.11/site-packages/anndata/_core/anndata.py:656, in AnnData.eq(self, other) 654 def eq(self, other): 655 """Equality testing""" --> 656 raise NotImplementedError( 657 "Equality comparisons are not supported for AnnData objects, " 658 "instead compare the desired attributes." 659 )

NotImplementedError: Equality comparisons are not supported for AnnData objects, instead compare the desired attributes. Selection deleted

Roger-GOAT commented 2 months ago

get the same error. Anyone solve it?

cakirb commented 1 month ago

Hello,

Sorry for the late reply!! This problem was fixed previously, you should install CellPhoneDB from GitHub to fix on your side: pip install --force-reinstall "git+https://github.com/ventolab/CellphoneDB.git"

Please let us know if this helps you!

Best, Batu

zhongzheng1999 commented 1 month ago

Hi @cakirb ! I wanted to let you know that I have successfully resolved the issue and managed to run cpdb_statistical_analysis_method.call as you suggested. However, I encountered the following error during installation: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.

chex 0.1.85 requires jax>=0.4.16, but you have jax 0.4.4 which is incompatible. torchvision 0.17.1 requires torch==2.2.1, but you have torch 2.3.0 which is incompatible. orbax-checkpoint 0.5.3 requires jax>=0.4.9, but you have jax 0.4.4 which is incompatible. scikit-bio 0.5.9 requires scipy<=1.10.1, but you have scipy 1.13.0 which is incompatible. scanorama 1.7.4 requires intervaltree>=3.1.0, but you have intervaltree 2.1.0 which is incompatible. numpyro 0.13.2 requires jax>=0.4.14, but you have jax 0.4.4 which is incompatible. botocore 1.32.1 requires urllib3<2.1,>=1.25.4; python_version >= "3.10", but you have urllib3 2.2.1 which is incompatible.

I understand that this might be due to incorrect dependency versions. Despite this, I was still able to get the results. Perhaps loosening the dependency version requirements could help reduce the anxiety caused by these errors, haha. Thank you very much for your help!

cakirb commented 1 month ago

Hi @zhongzheng1999,

Glad this worked well for you! Also thanks for your feedback on dependency error, we will look into loosening the version requirements.

Best, Batu