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

ValueError: negative indices not supported #143

Closed GGboy-Zzz closed 11 months ago

GGboy-Zzz commented 11 months ago

In the process of using cellphonedb, I encountered the following problems, 'ValueError: negative indices not supported'. Refering to previous issue#37, i have checked my metadata.txt inpute, and confirmed that there is no NA or NaN in my metadata. But i also encountered this error,My code is as follows,

from cellphonedb.src.core.methods import cpdb_analysis_method

means, deconvoluted = cpdb_analysis_method.call(
         cpdb_file_path = "/home/zhuyong/R/zebrafish_analysis/data/cpdb_input/v4.1.0/cellphonedb.zip",
         meta_file_path = "/home/zhuyong/R/zebrafish_analysis/data/cpdb_input/meta.txt",
         counts_file_path = "/home/zhuyong/R/zebrafish_analysis/data/cpdb_input/CellphoneDB_count.txt",
         counts_data = 'hgnc_symbol',
         output_path = "/home/zhuyong/R/zebrafish_analysis/results/cellphonedb")

[ ][CORE][10/10/23-14:52:40][INFO] [Non Statistical Method] Threshold:0.1 Precision:3
Reading user files...
The following user files were loaded successfully:
/home/zhuyong/R/zebrafish_analysis/data/cpdb_input/CellphoneDB_count.txt
/home/zhuyong/R/zebrafish_analysis/data/cpdb_input/meta.txt
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/zhuyong/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_analysis_method.py", line 104, in call
    clusters = cpdb_statistical_analysis_helper.build_clusters(meta,
  File "/home/zhuyong/miniconda3/envs/cpdb/lib/python3.8/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py", line 139, in build_clusters
    npg.aggregate(codes, counts.values, func='mean', axis=1),
  File "/home/zhuyong/miniconda3/envs/cpdb/lib/python3.8/site-packages/numpy_groupies/aggregate_numpy.py", line 365, in aggregate
    return _aggregate_base(
  File "/home/zhuyong/miniconda3/envs/cpdb/lib/python3.8/site-packages/numpy_groupies/aggregate_numpy.py", line 307, in _aggregate_base
    iv = input_validation(group_idx, a, size=size, order=order, axis=axis, func=func)
  File "/home/zhuyong/miniconda3/envs/cpdb/lib/python3.8/site-packages/numpy_groupies/utils_numpy.py", line 296, in input_validation
    raise ValueError("negative indices not supported")
ValueError: negative indices not supported

I want to know the reason for this error and hope someone can help me solve this error

Thanks.

Lovelock1998 commented 11 months ago

Hello, I have the same problem. Have you solved it?

datasome commented 11 months ago

Hi GGboy-Zzz and Lovelock1998,

I expect the cell types in your counts file to be somehow different to those in your meta file - could you please check?

Best,

Robert.

GGboy-Zzz commented 11 months ago

Hi, Lovelock1998

I'm sorry for replying to you so late. I later discovered that my problem was that my counts input contained duplicate gene symbol, which due to gene name conversion. As Robert said, you need to check your meta file and counts file again. Also, thanks a lot for Robert's reply.