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

Error: Got unexpected extra argument (hgnc_symbol) #85

Closed Pedramto89 closed 1 year ago

Pedramto89 commented 1 year ago

Hello @prete

I have both meta and counts files. However, when I run my code, it gives me n error.

The code I run: cellphonedb method statistical_analysis test_meta.txt test_counts.txt --iterations=10 --threads=2 hgnc_symbol

The error I get: "Usage: cellphonedb method statistical_analysis [OPTIONS] META_FILENAME COUNTS_FILENAME Try 'cellphonedb method statistical_analysis --help' for help.

Error: Got unexpected extra argument (hgnc_symbol)"

prete commented 1 year ago

Hi @Pedramto89, your command is missing the option argument for the gene format you need to use --counts-data=hgnc_symbol instead of just hgnc_symbol.

Your full command should look something like this:

cellphonedb method statistical_analysis test_meta.txt test_counts.txt --iterations=10 --threads=2 --counts-data=hgnc_symbol
Pedramto89 commented 1 year ago

Thanks so much @prete for your prompt response! I could solve the problem by converting ensembl IDs and got the four files : pvalues, means, deconvoluted, significant_means.

Now I wanted to visualize the results but got an error: cellphonedb plot dot_plot

This is the error: "[ ][APP][15/01/23-11:42:50][ERROR] Unexpected error Traceback (most recent call last): File "/Users/pedram/opt/anaconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/api_endpoints/terminal_api/plot_terminal_api_endpoints/plot_terminal_commands.py", line 38, in dot_plot columns=columns) File "/Users/pedram/opt/anaconda3/envs/cpdb/lib/python3.7/site-packages/cellphonedb/src/plotters/r_plotter.py", line 35, in wrapper from rpy2.rinterface_lib.embedded import RRuntimeError File "/Users/pedram/opt/anaconda3/envs/cpdb/lib/python3.7/site-packages/rpy2/rinterface_lib/embedded.py", line 7, in from rpy2.rinterface_lib import openrlib File "/Users/pedram/opt/anaconda3/envs/cpdb/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py", line 58, in rlib = _dlopen_rlib(R_HOME) File "/Users/pedram/opt/anaconda3/envs/cpdb/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py", line 51, in _dlopen_rlib rlib = ffi.dlopen(lib_path) OSError: cannot load library '/Library/Frameworks/R.framework/Resources/lib/libR.dylib': dlopen(/Library/Frameworks/R.framework/Resources/lib/libR.dylib, 0x0002): tried: '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (no such file), '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))"

prete commented 1 year ago

That looks like an R-related error. Your issue seems to be realted to an R installation that doesn't match your conda env? I'd suggest trying to install that one using conda install r-base - r-ggplot2 - r-pheatmap -c conda-forge.

If you don't want to install that you can still use your R version to run the plotting scripts manually. You'll find them here: https://github.com/ventolab/CellphoneDB/tree/master/cellphonedb/src/plotters/R

Alternatively, don't use CellphoneDB native plotting and try a thrid party package like ktplots or ktplotspy.

Pedramto89 commented 1 year ago

@prete I do not think it might be R related as I am using by anaconda env. Do you think it might be related to my laptop? (Mac M1)

prete commented 1 year ago

Ah, yes Mac M1 have arm architecture instead of x86_64. (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) There's a bigger issue where your conda may be intel installed and running with roseta as an emulator or using directly arm arch. However, keep in mind that the error you showed is looking for rlibs outside your conda env (/Library/Frameworks/R.framework/Resources/lib/libR.dylib). That means you should install those into your conda env or run R/Rstudio directly from whatever you've got install on your laptop and try to execture the scripts.

It may be easier for you to try ktplotspy since it's python and won't require you to have that R-python connection which seems to be failing.