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
438 stars 181 forks source link

[BUG]AttributeError: 'numpy.ndarray' object has no attribute 'split #443

Open Sa753 opened 1 year ago

Sa753 commented 1 year ago

Dear team

I keep getting the error below in the last step of pyscenic pipeline. I found it was raised before but the solutions suggested didn't work. There seem to be some incompatibility in the packages that I don't know.

This is my code pyscenic aucell dch.loom reg_dch.csv --output dch_pyscenic.loom --num_workers 20

2022-11-30 04:42:02,449 - pyscenic.cli.pyscenic - INFO - Loading expression matrix.

2022-11-30 04:42:05,984 - pyscenic.cli.pyscenic - INFO - Loading gene signatures. Create regulons from a dataframe of enriched features. Additional columns saved: []

2022-11-30 04:42:49,090 - pyscenic.cli.pyscenic - INFO - Calculating cellular enrichment.

2022-11-30 04:43:23,011 - pyscenic.cli.pyscenic - INFO - Writing results to file. Traceback (most recent call last): File "/data/home/hfx505/.conda/envs/arboreto-env/bin/pyscenic", line 8, in sys.exit(main()) File "/data/home/hfx505/.conda/envs/arboreto-env/lib/python3.9/site-packages/pyscenic/cli/pyscenic.py", line 713, in main args.func(args) File "/data/home/hfx505/.conda/envs/arboreto-env/lib/python3.9/site-packages/pyscenic/cli/pyscenic.py", line 296, in aucell_command append_auc_mtx( File "/data/home/hfx505/.conda/envs/arboreto-env/lib/python3.9/site-packages/pyscenic/cli/utils.py", line 378, in append_auc_mtx ds.ca[ATTRIBUTE_NAME_REGULONS_AUC] = create_structure_array(auc_mtx) File "/data/home/hfx505/.conda/envs/arboreto-env/lib/python3.9/site-packages/loompy/attribute_manager.py", line 129, in setitem return self.setattr(name, val) File "/data/home/hfx505/.conda/envs/arboreto-env/lib/python3.9/site-packages/loompy/attribute_manager.py", line 149, in setattr values = loompy.normalize_attr_values(val, compare_loom_spec_version(self.ds._file, "3.0.0") >= 0) File "/data/home/hfx505/.conda/envs/arboreto-env/lib/python3.9/site-packages/loompy/utils.py", line 27, in compare_loom_spec_version vf = int("".join(get_loom_spec_version(f).split("."))) AttributeError: 'numpy.ndarray' object has no attribute 'split

Python version 3.9 my pip freeze result is aiohttp==3.8.3 aiosignal==1.3.1 arboreto @ file:///opt/conda/conda-bld/arboreto_1613835315088/work async-timeout==4.0.2 attrs==22.1.0 bokeh @ file:///tmp/build/80754af9/bokeh_1638362822154/work boltons==21.0.0 Bottleneck @ file:///tmp/build/80754af9/bottleneck_1648028898966/work certifi==2021.10.8 charset-normalizer==2.1.1 click @ file:///tmp/build/80754af9/click_1646056590078/work cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1632508026186/work ctxcore==0.2.0 cytoolz==0.11.0 dask @ file:///opt/conda/conda-bld/dask-core_1647268715755/work dill==0.3.6 distributed @ file:///opt/conda/conda-bld/distributed_1647271944416/work frozendict==2.3.4 frozenlist==1.3.3 fsspec @ file:///opt/conda/conda-bld/fsspec_1647268051896/work h5py==3.7.0 HeapDict @ file:///Users/ktietz/demo/mc3/conda-bld/heapdict_1630598515714/work idna==3.4 interlap==0.2.7 Jinja2 @ file:///opt/conda/conda-bld/jinja2_1647436528585/work joblib @ file:///tmp/build/80754af9/joblib_1635411271373/work llvmlite==0.39.1 locket @ file:///tmp/build/80754af9/locket_1647006009810/work loompy==3.0.7 MarkupSafe @ file:///tmp/build/80754af9/markupsafe_1621523467000/work mkl-fft==1.3.1 mkl-random @ file:///tmp/build/80754af9/mkl_random_1626186066731/work mkl-service==2.4.0 msgpack @ file:///tmp/build/80754af9/msgpack-python_1612287166301/work multidict==6.0.2 multiprocessing-on-dill==3.5.0a4 networkx==2.8.8 numba==0.56.4 numexpr @ file:///tmp/build/80754af9/numexpr_1640689833592/work numpy==1.22.0 numpy-groupies==0.9.20 packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work pandas==1.4.1 partd @ file:///opt/conda/conda-bld/partd_1647245470509/work Pillow==9.0.1 psutil @ file:///tmp/build/80754af9/psutil_1612297992929/work pyarrow==10.0.1 pynndescent==0.5.8 pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work pyscenic==0.12.1 python-dateutil @ file:///tmp/build/80754af9/python-dateutil_1626374649649/work pytz==2021.3 PyYAML==6.0 requests==2.28.1 scikit-learn @ file:///tmp/build/80754af9/scikit-learn_1642617106979/work scipy @ file:///tmp/build/80754af9/scipy_1641555004408/work six @ file:///tmp/build/80754af9/six_1644875935023/work sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1623949099177/work tblib @ file:///Users/ktietz/demo/mc3/conda-bld/tblib_1629402031467/work threadpoolctl @ file:///Users/ktietz/demo/mc3/conda-bld/threadpoolctl_1629802263681/work toolz @ file:///tmp/build/80754af9/toolz_1636545406491/work tornado @ file:///tmp/build/80754af9/tornado_1606942317143/work tqdm==4.64.1 typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work umap-learn==0.5.3 urllib3==1.26.13 yarl==1.8.1 zict==2.0.0

Thanks

ghuls commented 1 year ago

Could you try the pySCENIC docker image? https://pyscenic.readthedocs.io/en/latest/installation.html#docker-podman

kverstae commented 3 months ago

I got the same issue:

2024-07-24 07:35:46,339 - pyscenic.cli.pyscenic - INFO - Writing results to file.
  /opt/venv/lib/python3.10/site-packages/pyscenic/cli/utils.py:347: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
    for name, threshold in auc_thresholds.iteritems()
  Traceback (most recent call last):
    File "/opt/venv/bin/pyscenic", line 33, in <module>
      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 296, in aucell_command
      append_auc_mtx(
    File "/opt/venv/lib/python3.10/site-packages/pyscenic/cli/utils.py", line 378, in append_auc_mtx
      ds.ca[ATTRIBUTE_NAME_REGULONS_AUC] = create_structure_array(auc_mtx)
    File "/opt/venv/lib/python3.10/site-packages/loompy/attribute_manager.py", line 129, in __setitem__
      return self.__setattr__(name, val)
    File "/opt/venv/lib/python3.10/site-packages/loompy/attribute_manager.py", line 149, in __setattr__
      values = loompy.normalize_attr_values(val, compare_loom_spec_version(self.ds._file, "3.0.0") >= 0)
    File "/opt/venv/lib/python3.10/site-packages/loompy/utils.py", line 27, in compare_loom_spec_version
      vf = int("".join(get_loom_spec_version(f).split(".")))
  AttributeError: 'numpy.ndarray' object has no attribute 'split'

I am using the docker container aertslab/pyscenic:0.12.1

massonix commented 3 months ago

I got the same error using the docker container:

singularity run --bind $(pwd) docker://aertslab/pyscenic:0.12.1 pyscenic aucell \
>   ${PROJECT_PATH}/data/processed_objects/pyscenic/${sample}_pyscenic_input.loom \
>   ${PROJECT_PATH}/scripts/pySCENIC/tmp/${sample}_reg.csv \
>   --output ${PROJECT_PATH}/scripts/pySCENIC/tmp/${sample}_pyscenic_output.loom.csv \
>   -num_workers 6
INFO:    Using cached SIF image
usage: pyscenic [-h] {grn,add_cor,ctx,aucell} ...
pyscenic: error: unrecognized arguments: -num_workers 6
[rmassoni@pe2cc3-072 pySCENIC]$ singularity run --bind $(pwd) docker://aertslab/pyscenic:0.12.1 pyscenic aucell \
>   ${PROJECT_PATH}/data/processed_objects/pyscenic/${sample}_pyscenic_input.loom \
>   ${PROJECT_PATH}/scripts/pySCENIC/tmp/${sample}_reg.csv \
>   --output ${PROJECT_PATH}/scripts/pySCENIC/tmp/${sample}_pyscenic_output.loom.csv \
>   --num_workers 6
INFO:    Using cached SIF image

2024-07-29 15:55:09,522 - pyscenic.cli.pyscenic - INFO - Loading expression matrix.

2024-07-29 15:55:12,582 - pyscenic.cli.pyscenic - INFO - Loading gene signatures.
Create regulons from a dataframe of enriched features.
Additional columns saved: []

2024-07-29 15:55:12,654 - pyscenic.cli.pyscenic - INFO - Calculating cellular enrichment.

2024-07-29 15:55:18,445 - pyscenic.cli.pyscenic - INFO - Writing results to file.
/opt/venv/lib/python3.10/site-packages/pyscenic/cli/utils.py:347: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
  for name, threshold in auc_thresholds.iteritems()
Traceback (most recent call last):
  File "/opt/venv/bin/pyscenic", line 33, in <module>
    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 296, in aucell_command
    append_auc_mtx(
  File "/opt/venv/lib/python3.10/site-packages/pyscenic/cli/utils.py", line 378, in append_auc_mtx
    ds.ca[ATTRIBUTE_NAME_REGULONS_AUC] = create_structure_array(auc_mtx)
  File "/opt/venv/lib/python3.10/site-packages/loompy/attribute_manager.py", line 129, in __setitem__
    return self.__setattr__(name, val)
  File "/opt/venv/lib/python3.10/site-packages/loompy/attribute_manager.py", line 149, in __setattr__
    values = loompy.normalize_attr_values(val, compare_loom_spec_version(self.ds._file, "3.0.0") >= 0)
  File "/opt/venv/lib/python3.10/site-packages/loompy/utils.py", line 27, in compare_loom_spec_version
    vf = int("".join(get_loom_spec_version(f).split(".")))
AttributeError: 'numpy.ndarray' object has no attribute 'split'

Would greatly appreciate if you could look into this, thanks so much in advance