aertslab / pySCENIC

pySCENIC is a lightning-fast python implementation of the SCENIC pipeline (Single-Cell rEgulatory Network Inference and Clustering) which enables biologists to infer transcription factors, gene regulatory networks and cell types from single-cell RNA-seq data.
http://scenic.aertslab.org
GNU General Public License v3.0
424 stars 179 forks source link

Error when running pyscenic aucell. #489

Closed Dingpw closed 1 year ago

Dingpw commented 1 year ago

Hi, When I run pyscenic aucell, I get the error here.

  1. Command run when the error occurred:

    pyscenic aucell --seed 123 ./03_regulons/regulons.csv ./count_mat.csv -o ./04_auc_mtx/auc_mtx.csv --num_workers 10
  2. Error encountered:

    
    2023-07-14 02:25:05,921 - pyscenic.cli.pyscenic - INFO - Loading expression matrix.

2023-07-14 02:25:05,981 - pyscenic.cli.pyscenic - INFO - Loading gene signatures. Traceback (most recent call last): File "/opt/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3803, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 165, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 5745, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 5753, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Enrichment'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "pandas/_libs/index.pyx", line 774, in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc File "/opt/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc raise KeyError(key) from err KeyError: 'Enrichment'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/venv/bin/pyscenic", line 33, in sys.exit(load_entry_point('pyscenic==0.12.1+0.gce41b61.dirty', 'console_scripts', 'pyscenic')()) File "/opt/venv/lib/python3.10/site-packages/pyscenic/cli/pyscenic.py", line 713, in main args.func(args) File "/opt/venv/lib/python3.10/site-packages/pyscenic/cli/pyscenic.py", line 276, in aucell_command signatures = load_signatures(args.signatures_fname.name) File "/opt/venv/lib/python3.10/site-packages/pyscenic/cli/utils.py", line 217, in load_signatures return df2regulons(load_motifs(fname, sep=suffixes_to_separator(extension))) File "/opt/venv/lib/python3.10/site-packages/pyscenic/utils.py", line 450, in load_motifs df[("Enrichment", COLUMN_NAME_CONTEXT)] = df[ File "/opt/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 3803, in getitem return self._getitem_multilevel(key) File "/opt/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 3854, in _getitem_multilevel loc = self.columns.get_loc(key) File "/opt/venv/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2927, in get_loc return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 777, in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc KeyError: ('Enrichment', 'Context')


I trid to use singularity pyscenic to perform aucell step and got the same error messages: 
```python
singularity run aertslab-pyscenic-0.12.1.sif pyscenic aucell --seed 123 ./03_regulons/regulons.csv ./count_mat.csv -o ./04_auc_mtx/auc_mtx.csv --num_workers 10

Could you help me figure it out? Thank you !!!!!!

Versions are as follows:

#

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge _openmp_mutex 4.5 2_gnu http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge aiohttp 3.8.4 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi arboreto 0.1.6 pypi_0 pypi async-timeout 4.0.2 pypi_0 pypi attrs 23.1.0 pypi_0 pypi bokeh 3.2.0 pypi_0 pypi boltons 23.0.0 pypi_0 pypi bzip2 1.0.8 h7f98852_4 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge ca-certificates 2023.5.7 hbcca054_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge certifi 2023.5.7 pypi_0 pypi charset-normalizer 3.2.0 pypi_0 pypi click 8.1.4 pypi_0 pypi cloudpickle 2.2.1 pypi_0 pypi contourpy 1.1.0 pypi_0 pypi ctxcore 0.2.0 pypi_0 pypi cytoolz 0.12.1 pypi_0 pypi dask 2023.7.0 pypi_0 pypi dill 0.3.6 pypi_0 pypi distributed 2023.7.0 pypi_0 pypi frozendict 2.3.8 pypi_0 pypi frozenlist 1.3.3 pypi_0 pypi fsspec 2023.6.0 pypi_0 pypi h5py 3.9.0 pypi_0 pypi idna 3.4 pypi_0 pypi importlib-metadata 6.8.0 pypi_0 pypi interlap 0.2.7 pypi_0 pypi jinja2 3.1.2 pypi_0 pypi joblib 1.3.1 pypi_0 pypi ld_impl_linux-64 2.40 h41732ed_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libffi 3.4.2 h7f98852_5 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libgcc-ng 13.1.0 he5830b7_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libgomp 13.1.0 he5830b7_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libnsl 2.0.0 h7f98852_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libsqlite 3.42.0 h2797004_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libuuid 2.38.1 h0b41bf4_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge libzlib 1.2.13 hd590300_5 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge llvmlite 0.40.1 pypi_0 pypi locket 1.0.0 pypi_0 pypi loompy 3.0.7 pypi_0 pypi lz4 4.3.2 pypi_0 pypi markupsafe 2.1.3 pypi_0 pypi msgpack 1.0.5 pypi_0 pypi multidict 6.0.4 pypi_0 pypi multiprocessing-on-dill 3.5.0a4 pypi_0 pypi ncurses 6.4 hcb278e6_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge networkx 3.1 pypi_0 pypi numba 0.57.1 pypi_0 pypi numexpr 2.8.4 pypi_0 pypi numpy 1.23.5 pypi_0 pypi numpy-groupies 0.9.22 pypi_0 pypi openssl 3.1.1 hd590300_1 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge packaging 23.1 pypi_0 pypi pandas 2.0.3 pypi_0 pypi partd 1.4.0 pypi_0 pypi pillow 10.0.0 pypi_0 pypi pip 23.1.2 pyhd8ed1ab_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge psutil 5.9.5 pypi_0 pypi pyarrow 12.0.1 pypi_0 pypi pynndescent 0.5.10 pypi_0 pypi pyscenic 0.12.1 pypi_0 pypi python 3.10.12 hd12c33a_0_cpython http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge python-dateutil 2.8.2 pypi_0 pypi pytz 2023.3 pypi_0 pypi pyyaml 6.0 pypi_0 pypi readline 8.2 h8228510_1 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge requests 2.31.0 pypi_0 pypi scikit-learn 1.3.0 pypi_0 pypi scipy 1.11.1 pypi_0 pypi setuptools 68.0.0 pyhd8ed1ab_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge six 1.16.0 pypi_0 pypi sortedcontainers 2.4.0 pypi_0 pypi tblib 2.0.0 pypi_0 pypi threadpoolctl 3.1.0 pypi_0 pypi tk 8.6.12 h27826a3_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge toolz 0.12.0 pypi_0 pypi tornado 6.3.2 pypi_0 pypi tqdm 4.65.0 pypi_0 pypi tzdata 2023.3 pypi_0 pypi umap-learn 0.5.3 pypi_0 pypi urllib3 2.0.3 pypi_0 pypi wheel 0.40.0 pyhd8ed1ab_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge xyzservices 2023.5.0 pypi_0 pypi xz 5.2.6 h166bdaf_0 http://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge yarl 1.9.2 pypi_0 pypi zict 3.0.0 pypi_0 pypi zipp 3.16.0 pypi_0 pypi

Dingpw commented 1 year ago

Sorry that I found the solution. I reverse the turn of regulons files and expression matrix:

pyscenic aucell --seed 123  ./count_mat.csv ./03_regulons/regulons.csv -o ./04_auc_mtx/auc_mtx.csv --num_workers 10

After this the aucell result works fluently.

2023-07-14 02:47:46,013 - pyscenic.cli.pyscenic - INFO - Loading expression matrix.

2023-07-14 02:48:04,323 - pyscenic.cli.pyscenic - INFO - Loading gene signatures.

2023-07-14 02:48:04,335 - pyscenic.cli.pyscenic - INFO - Calculating cellular enrichment.

2023-07-14 02:48:21,294 - pyscenic.cli.pyscenic - INFO - Writing results to file.