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

Unable to run cellphonedb due to database #152

Closed molybdenumt closed 7 months ago

molybdenumt commented 8 months ago

I'm using R with the conda environment

module load anaconda3
module load R
conda create -n cpdb python=3.7
source activate cpdb

cellphonedb database download

I kept getting: There are no versions available (or connection could not be made to server to retrieve them) So I downloaded the cellphonedb.zip from https://github.com/ventolab/CellphoneDB-data and move it to the folder /u/.cpdb/releases/v5.0.0 Then I ran this code cellphonedb method degs_analysis cellphonedb_mergeb_meta.txt cellphonedb_mergeb_scaledata.txt mergeb_markerct.txt --verbose But keep getting this:

[ ][APP][05/11/23-20:26:00][WARNING] Database '{value}' is not available. Trying to download it.
There are no versions available (or connection could not be made to server to retrieve them)

I also tried this cellphonedb method statistical_analysis cellphonedb_mergeb_meta.txt cellphonedb_mergeb_scaledata.txt --verbose And got the same error:

[ ][APP][05/11/23-20:35:18][WARNING] Database '{value}' is not available. Trying to download it.
There are no versions available (or connection could not be made to server to retrieve them)
prete commented 8 months ago

Hi @molybdenumt thank you for using CellPhoneDB, could I check which version of CPDB is installed in your environment?

Python 3.7 will pull CellPhoneDB ~3. Any version of CellPhoneDB after 3.0.1 won't be compatible with rercent versions of python nor the databse. You should create your environment with

conda create -n cpdb python=3.9

For recent versions of the tool has also moved away from the command line towards a python/notebook use of the library. The most practical thing for you should be create a python file like this one:

from cellphonedb.src.core.methods import cpdb_statistical_analysis_method

cpdb_results = cpdb_statistical_analysis_method.call(
        cpdb_file_path = "/u/.cpdb/releases/v5.0.0/cellphonedb.zip",
        meta_file_path = "cellphonedb_mergeb_meta.txt",
        counts_file_path = "cellphonedb_mergeb_scaledata.txt",
        counts_data = "hgnc_symbol",
        score_interactions = True,
        threshold = 0.1,
        output_path = "outs")

name it cpdb_run.py and then execute it using python cpdb_run.py

molybdenumt commented 7 months ago

Thank you for your response. When I tried running the code, it has a new error:

Traceback (most recent call last): File "/u/home/t/trando/cpdb_run.py", line 4, in <module> cpdb_results = cpdb_statistical_analysis_method.call( TypeError: call() got an unexpected keyword argument 'score_interactions'

datasome commented 7 months ago

Hi molybdenumt,

If I may just chime in here - once you created your clean environment with: conda create -n cpdb python=3.9 did you install CellphoneDB via: pip install cellphonedb ? From the above error it looks as if you've added score_interactions argument to the call in cpdb_statistical_analysis_method.call() in cpdb_run.py file, but the version of CellphoneDB you installed in your environment is not the latest one. Could you please confirm?

Best,

Robert.

molybdenumt commented 7 months ago

Hi Robert,Thank you for the response. Yes, I installed the cellphonedb before running the code. I have removed everything and reinstalled cellphonedb.  And l’m still getting the same error. On Nov 8, 2023, at 6:04 AM, datasome @.***> wrote: Hi molybdenumt, If I may just chime in here - once you created your clean environment with: conda create -n cpdb python=3.9 did you install CellphoneDB via: pip install cellphonedb ? From the above error it looks as if you've added score_interactions argument to the call in cpdb_statistical_analysis_method.call() in cpdb_run.py file, but the version of CellphoneDB you installed in your environment is not the latest one. Could you please confirm? Best, Robert.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

datasome commented 7 months ago

Thanks molybdenumt,

I cannot quite see how this can happen.. Could I please ask you to send me the precise list of commands you used to first remove the previous conda cpdb environment, then re-creating it, installing cellphonedb then running your script; and also the exact content of your cpdb_run.py script? Alternatively you can send me a Zoom link on contact@cellphonedb.org and you can show me what you're doing step by step.

Best wishes,

Robert.

molybdenumt commented 7 months ago

Hi Robert,

I sent the email, but here is more updates: conda deactivate conda remove -n cpdb –all conda create -n cpdb python=3.9 conda activate cpdb pip install cellphonedb vi cpdb_run.py

from cellphonedb.src.core.methods import cpdb_degs_analysis_method
cpdb_results = cpdb_degs_analysis_method.call(
        cpdb_file_path = "/u/home/t/.cpdb/releases/v5.0.0/cellphonedb.zip",
        meta_file_path = "cellphonedb_mergeb_meta.txt",
        counts_file_path = "cellphonedb_mergeb_scaledata.txt",
        counts_data = "hgnc_symbol",
        score_interactions = True,
        threshold = 0.1,
        output_path = "/outs")

Still getting error :

Traceback (most recent call last):
  File "/u/home/t/cpdb_run.py", line 4, in <module>
    cpdb_results = cpdb_statistical_analysis_method.call(
TypeError: call() got an unexpected keyword argument 'score_interactions'

When I removed the 2 lines since this was what was written on this website https://cellphonedb.readthedocs.io/en/latest/RESULTS-DOCUMENTATION.html#method-2-statistical-inference-of-interaction-specificity

        score_interactions = True,
        threshold = 0.1,

Now it's only

from cellphonedb.src.core.methods import cpdb_degs_analysis_method
cpdb_results = cpdb_degs_analysis_method.call(
        cpdb_file_path = "/u/home/t/.cpdb/releases/v5.0.0/cellphonedb.zip",
        meta_file_path = "cellphonedb_mergeb_meta.txt",
        counts_file_path = "cellphonedb_mergeb_scaledata.txt",
        counts_data = "hgnc_symbol",
        output_path = "/outs")

It ran and now got a new error:

Reading user files...
Traceback (most recent call last):
  File "/u/home/t/cpdb_run.py", line 4, in <module>
    cpdb_results = cpdb_statistical_analysis_method.call(
  File "/u/home/t/.local/lib/python3.9/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_method.py", line 98, in call
    counts, meta, microenvs, degs = file_utils.get_user_files( \
  File "/u/home/t/.local/lib/python3.9/site-packages/cellphonedb/utils/file_utils.py", line 315, in get_user_files
    counts = read_data_table_from_file(counts_fp, index_column_first=True)
  File "/u/home/t/.local/lib/python3.9/site-packages/cellphonedb/utils/file_utils.py", line 48, in read_data_table_from_file
    return _read_data(f, separator, index_column_first, dtype, na_values, compression)
  File "/u/home/t/.local/lib/python3.9/site-packages/cellphonedb/utils/file_utils.py", line 106, in _read_data
    return pd.read_csv(file_stream, sep=separator, index_col=0 if index_column_first else None, dtype=dtype,
  File "/u/home/t/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 912, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/u/home/t/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 577, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "/u/home/t/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1407, in __init__
    self._engine = self._make_engine(f, self.engine)
  File "/u/home/t/.local/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1679, in _make_engine
    return mapping[engine](f, **self.options)
  File "/u/home/t/.local/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 93, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 555, in pandas._libs.parsers.TextReader.__cinit__
pandas.errors.EmptyDataError: No columns to parse from file
molybdenumt commented 7 months ago

For anyone having the same issues, I removed the environment and reinstalled the package with the team's help.

conda env remove -n cpdb_docs
conda create -n cpdb python=3.9
conda activate cpdb
pip install --force-reinstall cellphonedb

create a file called cpdb.py (as below) and run the file

from cellphonedb.src.core.methods import cpdb_degs_analysis_method

if __name__ == '__main__':

        cpdb_results = cpdb_degs_analysis_method.call(

                       cpdb_file_path = "~/.cpdb/releases/v5.0.0/cellphonedb.zip",

                       meta_file_path = "./example_data/test_meta.txt",

                       counts_file_path = "./example_data/test_counts.txt",

                       degs_file_path = "./example_data/test_degs.txt",

                       counts_data = "ensembl",

                       score_interactions = True,

                       threshold = 0.1,

                       output_path = "./outs")