ventolab/CellphoneDB

a.shape[axis] doesn't match length of group_idx

Closed this issue · 3 comments

Hi, I was running the DEG analysis method on a dataset and I got the following error:

[ ][APP][01/03/22-02:19:42][WARNING] Latest local available version is `v2.0.0`, using it
[ ][APP][01/03/22-02:19:42][WARNING] User selected downloaded database `v2.0.0` is available, using it
[ ][CORE][01/03/22-02:19:42][INFO] Initializing SqlAlchemy CellPhoneDB Core
[ ][CORE][01/03/22-02:19:42][INFO] Using custom database at /Users/leonardi.carlo/.cpdb/releases/v2.0.0/cellphone.db
[ ][APP][01/03/22-02:19:42][INFO] Launching Method cpdb_degs_analysis_local_method_launcher
[ ][APP][01/03/22-02:19:42][INFO] Launching Method _set_paths
[ ][APP][01/03/22-02:19:42][INFO] Launching Method _load_meta_counts
[ ][APP][01/03/22-02:22:12][INFO] Launching Method _check_counts_data
[ ][APP][01/03/22-02:22:12][INFO] Launching Method _load_degs
[ ][CORE][01/03/22-02:22:12][INFO] Launching Method cpdb_degs_analysis_launcher
[ ][CORE][01/03/22-02:22:12][INFO] Launching Method _counts_validations
[ ][CORE][01/03/22-02:22:15][INFO] Launching Method get_interactions_genes_complex
[ ][CORE][01/03/22-02:22:15][INFO] [Cluster DEGs Analysis] Threshold:0.1 Iterations:1000 Debug-seed:-1 Threads:4 Precision:3
[ ][CORE][01/03/22-02:22:15][WARNING] 
***********************************
DEGs ANALYSIS IS AN EXPERIMENTAL METHOD STILL UNDER DEVELOPMENT!
***********************************
[ ][APP][01/03/22-02:22:17][ERROR] Unexpected error
Traceback (most recent call last):
  File "/opt/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/api_endpoints/terminal_api/method_terminal_api_endpoints/method_terminal_commands.py", line 300, in degs_analysis
    debug
  File "/opt/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/local_launchers/local_method_launcher.py", line 176, in cpdb_degs_analysis_local_method_launcher
    output_path
  File "/opt/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/method_launcher.py", line 212, in cpdb_degs_analysis_launcher
    output_path)
  File "/opt/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/cpdb_degs_analysis_method.py", line 119, in call
    skip_percent=False)
  File "/opt/miniconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/core/methods/cpdb_statistical_analysis_helper.py", line 141, in build_clusters
    npg.aggregate(meta[CELL_TYPE].cat.codes, counts.values, func='mean', axis=1),
  File "/Users/leonardi.carlo/.local/lib/python3.7/site-packages/numpy_groupies/aggregate_numpy.py", line 293, in aggregate
    _impl_dict=_impl_dict, _nansqueeze=True, **kwargs)
  File "/Users/leonardi.carlo/.local/lib/python3.7/site-packages/numpy_groupies/aggregate_numpy.py", line 257, in _aggregate_base
    size=size, order=order, axis=axis)
  File "/Users/leonardi.carlo/.local/lib/python3.7/site-packages/numpy_groupies/utils_numpy.py", line 228, in input_validation
    raise ValueError("a.shape[axis] doesn't match length of group_idx.")
ValueError: a.shape[axis] doesn't match length of group_idx.

I use human genes, I generated the DEGs following your tutorial from Seurat. Is there a specific data structure that might be wrong for which I should look for?
Edit: this error appears even if I use the statistical test method. Probably it is inherent my specific data.
What a.shape[axis] doesn't match length of group_idx should suggest me?

Thanks,
CL

Hi,

In order to help you, could you describe the format of your count matrix input please?

Thank you,

Luz

prete commented

Hi @carloelle, thank you for using CellPhoneDB. Can I ask if you managed to oevrcome this issue and, if you didn't, could you provide the versions of pandas/numpy/numpy_groupies on your environment?

Hi @carloelle, you need to do adata.obs_names_make_unique() before using CellPhoneDB.