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
432 stars 180 forks source link

TypeError: No dispatch for <class 'dict'> #295

Open hossam-zaki opened 3 years ago

hossam-zaki commented 3 years ago

Describe the bug from pyscenic.transform import df2regulons is giving me an error and i'm unable to import it.

Steps to reproduce the behavior

  1. Command run when the error occurred: I ran the following import statements.

    from pyscenic.export import export2loom, add_scenic_metadata
    from pyscenic.utils import load_motifs
    from pyscenic.transform import df2regulons
    from pyscenic.aucell import aucell
    from pyscenic.binarization import binarize
    from pyscenic.rss import regulon_specificity_scores
    from pyscenic.plotting import plot_binarization, plot_rss
    ...
  2. Error encountered:

    
    TypeError                                 Traceback (most recent call last)
    <ipython-input-2-f00fa4041aff> in <module>
     15 from pyscenic.export import export2loom, add_scenic_metadata
     16 from pyscenic.utils import load_motifs
    ---> 17 from pyscenic.transform import df2regulons
     18 from pyscenic.aucell import aucell
     19 from pyscenic.binarization import binarize

/usr/local/lib/python3.8/site-packages/pyscenic/transform.py in 36 COLUMN_NAME_TYPE = "Type" 37 # TODO: Should actually be a function depending on return_recovery_curves and rank_threshold ---> 38 DF_META_DATA = make_meta( 39 { 40 ('Enrichment', COLUMN_NAME_AUC): np.float64,

/usr/local/lib/python3.8/site-packages/dask/utils.py in call(self, arg, *args, *kwargs) 509 Call the corresponding method based on type of argument. 510 """ --> 511 meth = self.dispatch(type(arg)) 512 return meth(arg, args, **kwargs) 513

/usr/local/lib/python3.8/site-packages/dask/utils.py in dispatch(self, cls) 503 lk[cls] = lk[cls2] 504 return lk[cls2] --> 505 raise TypeError("No dispatch for {0}".format(cls)) 506 507 def call(self, arg, *args, **kwargs):

TypeError: No dispatch for <class 'dict'> ...


**Expected behavior**
It is expected to simply import it without any bug

**Please complete the following information:**
- pySCENIC version: 0.11.2
- Installation method: Pip
- Run environment: Jupyter Notebook
- OS: MacOS
- Package versions: [obtain using `pip freeze`, `conda list`, or skip this if using Docker/Singularity]:
<!-- Put your package version list in this code block (if applicable, else delete the block): -->

absl-py==0.11.0 aiohttp==3.7.4.post0 anndata==0.7.6 appnope==0.1.2 arboreto==0.1.6 argon2-cffi==20.1.0 astunparse==1.6.3 async-generator==1.10 async-timeout==3.0.1 attrs==21.2.0 audible==0.5.3 backcall==0.2.0 beautifulsoup4==4.9.3 bleach==3.3.0 bokeh==2.3.2 boltons==21.0.0 cachetools==4.2.1 certifi==2020.12.5 cffi==1.14.5 chardet==4.0.0 click==7.1.2 cloudpickle==1.6.0 ctxcore==0.1.1 cycler==0.10.0 Cython==0.29.22 cytoolz==0.11.0 dask==2021.5.1 decorator==4.4.2 defusedxml==0.7.1 dill==0.3.3 distributed==2021.5.1 dm-tree==0.1.5 dnspython==1.16.0 entrypoints==0.3 ffprobe-python==1.0.3 Flask==1.1.2 Flask-PyMongo==2.3.0 flatbuffers==1.12 frozendict==2.0.2 fsspec==2021.5.0 gast==0.3.3 get-version==2.2 google-auth==1.27.0 google-auth-oauthlib==0.4.2 google-pasta==0.2.0 grpcio==1.32.0 h11==0.12.0 h5py==2.10.0 HeapDict==1.0.1 httpcore==0.12.3 httpx==0.16.1 idna==2.10 interlap==0.2.7 ipykernel==5.5.5 ipython==7.24.0 ipython-genutils==0.2.0 itsdangerous==1.1.0 jedi==0.18.0 Jinja2==2.11.3 joblib==1.0.1 jsonschema==3.2.0 jupyter-client==6.1.12 jupyter-core==4.7.1 jupyterlab-pygments==0.1.2 Keras-Preprocessing==1.1.2 kiwisolver==1.3.1 legacy-api-wrap==1.2 lineedit==0.1.6 llvmlite==0.36.0 locket==0.2.1 loompy==3.0.6 Markdown==3.3.3 MarkupSafe==1.1.1 matplotlib==3.3.4 matplotlib-inline==0.1.2 mistune==0.8.4 msgpack==1.0.2 multidict==5.1.0 multiprocessing-on-dill==3.5.0a4 natsort==7.1.1 nbclient==0.5.3 nbconvert==6.0.7 nbformat==5.1.3 nest-asyncio==1.5.1 networkx==2.5.1 notebook==6.4.0 numba==0.53.1 numexpr==2.7.3 numpy==1.19.5 numpy-groupies==0.9.13 oauthlib==3.1.0 opt-einsum==3.3.0 packaging==20.9 pandas==1.2.2 pandocfilters==1.4.3 parso==0.8.2 partd==1.2.0 patsy==0.5.1 pbkdf2==1.3 pexpect==4.8.0 pickleshare==0.7.5 Pillow==8.1.0 prometheus-client==0.10.1 prompt-toolkit==3.0.18 protobuf==3.15.1 psutil==5.8.0 ptyprocess==0.7.0 pyaes==1.6.1 pyarrow==0.16.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.20 Pygments==2.8.1 pymongo==3.11.3 pynndescent==0.5.2 pyparsing==2.4.7 pyrsistent==0.17.3 pyscenic==0.11.2 python-dateutil==2.8.1 python-dotenv==0.17.1 pytz==2021.1 PyYAML==5.4.1 pyzmq==22.1.0 quadprog==0.1.8 radian==0.5.10 rchitect==0.3.30 requests==2.25.1 requests-oauthlib==1.3.0 rfc3986==1.4.0 rsa==4.7.1 scanpy==1.7.2 scikit-learn==0.24.1 scipy==1.6.1 seaborn==0.11.1 Send2Trash==1.5.0 sinfo==0.3.4 six==1.15.0 sniffio==1.2.0 sortedcontainers==2.4.0 soupsieve==2.2 statsmodels==0.12.2 stdlib-list==0.8.0 tables==3.6.1 tblib==1.7.0 tensorboard==2.4.1 tensorboard-plugin-wit==1.8.0 tensorflow==2.4.1 tensorflow-estimator==2.4.0 tensorflow-probability==0.12.1 termcolor==1.1.0 terminado==0.10.0 testpath==0.5.0 threadpoolctl==2.1.0 toolz==0.11.1 tornado==6.1 tqdm==4.58.0 traitlets==5.0.5 typing-extensions==3.7.4.3 umap-learn==0.5.1 urllib3==1.26.3 wcwidth==0.2.5 webencodings==0.5.1 Werkzeug==1.0.1 wrapt==1.12.1 xlrd==1.2.0 yarl==1.6.3 zict==2.0.0 ...

eleozzr commented 3 years ago

Same bug for me.

eleozzr commented 3 years ago

I re-install pyscenic with version 0.11.1, and downgrade dask==2.30.0 and distributed==2.30.0, which works for me.

cflerin commented 3 years ago

@hossam-zaki ,

I will look further into this but I would suggest using pySCENIC 0.11.1 for now as @eleozzr mentioned.

moqri commented 3 years ago

I got this issue when tryin to do conda install -c bioconda arboreto I got around it by installing pip install pyscenic instead