Closed jinlanzhan closed 7 months ago
Hello. Thank you guys for making CellPhoneDB, this is a great resource.
Hi.
I've tried to reproduce your error but I've not been able to do it.
Can you confirm that you have installed CellPhoneDB in a new conda environment with pip install cellphonedb
?
Kind regards
Hi, I have the exact same problem. I just installed cellphonedb in a new conda environment, and when I try to run
means, deconvoluted = cpdb_analysis_method.call(
cpdb_file_path = cpdb_file_path,
meta_file_path = meta_file_path,
counts_file_path = counts_file_path,
counts_data = 'ensembl_gene_id',
output_path = out_path,
separator = '|',
threshold = 0.1,
result_precision = 3,
debug = False,
output_suffix = None
)
I get the following:
[ ][CORE][11/06/23-20:12:14][INFO] [Non Statistical Method] Threshold:0.1 Precision:3
Reading user files...
The following user files were loaded successfully:
counts.txt
metadata.txt
[ ][CORE][11/06/23-20:13:24][INFO] Running Real Analysis
[ ][CORE][11/06/23-20:13:24][INFO] Building results
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/userpath/.local/lib/python3.9/site-packages/cellphonedb/src/core/methods/cpdb_analysis_method.py", line 143, in call
means_result, significant_means, deconvoluted_result = build_results(
File "userpath/.local/lib/python3.9/site-packages/cellphonedb/src/core/methods/cpdb_analysis_method.py", line 254, in build_results
means_result = pd.concat([interactions_data_result, mean_analysis], axis=1, join='inner', sort=False)
File "/userpath/.conda/envs/cpdb/lib/python3.9/site-packages/pandas/core/reshape/concat.py", line 385, in concat
return op.get_result()
File "/userpath/.conda/envs/cpdb/lib/python3.9/site-packages/pandas/core/reshape/concat.py", line 612, in get_result
indexers[ax] = obj_labels.get_indexer(new_labels)
File "/userpath/.conda/envs/cpdb/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3731, in get_indexer
raise InvalidIndexError(self._requires_unique_msg)
pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects
Here, in the previous version of the tool, a similar error was due to the pandas version. I run python 3.9, pandas 2.0.2 (required >1.5.0), and cellphonedb 4.0.0, if that makes any difference.
Thanks!
Hi.
I've checked and no error appears with python 3.8.16
pandas 2.0.1
or python3.10.9
and pandas 2.0.2
.
We are going to have an eye on this.
Hi deeKal, Is it possible that you might have some duplicated columns in your counts file? (see: https://stackoverflow.com/questions/35084071/concat-dataframe-reindexing-only-valid-with-uniquely-valued-index-objects). Kind regards, Robert.
Thank you for your answer!
After debugging the corresponding code, I saw that it crashes in build_results()
and more specifically, in means_result = pd.concat([interactions_data_result, mean_analysis], axis=1, join='inner', sort=False)
.
The interactions_data_result
dataframe has duplicate indexes, although the interactions are different. I saved the two dataframes in text files which you can find here.
I hope this helps.
In the meantime, I'll try to run cellphoneDB using other versions of the packages.
Hi Despina, Many thanks for sharing your counts file - you've helped us fix a genuine bug that our existing test data sets had failed to pick up. Please could you do: pip install "git+https://github.com/ventolab/CellphoneDB.git" and try again? Your CellphoneDB analysis should complete successfully now. In any case, please let us know of any further issues and best of luck with your research. Best, Robert.
It run! Thanks so much Robert!