pySCENIC icon indicating copy to clipboard operation
pySCENIC copied to clipboard

[BUG] grnboost2 TypeError: Must supply at least one delayed object

Open AAA-3 opened this issue 7 months ago • 6 comments

Describe the bug

Running GRNBoost2 produces an error at the very last step. Reproducible with the tutorial (https://pyscenic.readthedocs.io/en/latest/tutorial.html) using the GSE60361_C1-3005-Expression.txt dataset.

Installing arboreto from source did not help

Steps to reproduce the behavior

  1. Command run when the error occurred:
import os
import glob
import pickle
import pandas as pd
import numpy as np
from dask.diagnostics import ProgressBar
from arboreto.utils import load_tf_names
from arboreto.algo import grnboost2
from ctxcore.rnkdb import FeatherRankingDatabase as RankingDatabase
from pyscenic.utils import modules_from_adjacencies, load_motifs
from pyscenic.prune import prune2df, df2regulons
from pyscenic.aucell import aucell
import seaborn as sns

DATA_FOLDER="/home/ali/Dokumente/15d _Organoids_Multiome/Separate/SCENIC/CommittedMesoderm"
RESOURCES_FOLDER="/home/ali/Dokumente/15d _Organoids_Multiome/Separate/SCENIC/pySCENIC"
MATRIX_FOLDER="/home/ali/Dokumente/15d _Organoids_Multiome/Separate/SCENIC/pySCENIC/Matrix"
SCHEDULER="123.122.8.24:8786"
DATABASES_GLOB = os.path.join(RESOURCES_FOLDER, "hg38_*.genes_vs_motifs.rankings.feather")
MOTIF_ANNOTATIONS_FNAME = os.path.join(RESOURCES_FOLDER, "motifs-v10nr_clust-nr.hgnc-m0.001-o0.0.tbl")
MM_TFS_FNAME = '/home/ali/pySCENIC/resources/hs_hgnc_tfs.txt'
SC_EXP_FNAME = os.path.join(MATRIX_FOLDER, "Cardiac-Cimmitted Cells_matrix.csv")
REGULONS_FNAME = os.path.join(DATA_FOLDER, "regulons.p")
MOTIFS_FNAME = os.path.join(DATA_FOLDER, "motifs.csv")

ex_matrix = pd.read_csv(SC_EXP_FNAME, sep=',', header=0, index_col=0).T
tf_names = load_tf_names(MM_TFS_FNAME)
db_fnames = glob.glob(DATABASES_GLOB)
def name(fname):
    return os.path.splitext(os.path.basename(fname))[0]
dbs = [RankingDatabase(fname=fname, name=name(fname)) for fname in db_fnames]
adjacencies = grnboost2(ex_matrix, tf_names=tf_names, verbose=True)
...
  1. Error encountered:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[17], line 2
      1 #single cell expression profiles are used to infer co-expression modules
----> 2 adjacencies = grnboost2(ex_matrix, tf_names=tf_names, verbose=True)

File ~/anaconda3/envs/pySCENIC/lib/python3.12/site-packages/arboreto/algo.py:39, in grnboost2(expression_data, gene_names, tf_names, client_or_address, early_stop_window_length, limit, seed, verbose)
     10 def grnboost2(expression_data,
     11               gene_names=None,
     12               tf_names='all',
   (...)
     16               seed=None,
     17               verbose=False):
     18     """
     19     Launch arboreto with [GRNBoost2] profile.
     20 
   (...)
     36     :return: a pandas DataFrame['TF', 'target', 'importance'] representing the inferred gene regulatory links.
     37     """
---> 39     return diy(expression_data=expression_data, regressor_type='GBM', regressor_kwargs=SGBM_KWARGS,
     40                gene_names=gene_names, tf_names=tf_names, client_or_address=client_or_address,
     41                early_stop_window_length=early_stop_window_length, limit=limit, seed=seed, verbose=verbose)

File ~/anaconda3/envs/pySCENIC/lib/python3.12/site-packages/arboreto/algo.py:120, in diy(expression_data, regressor_type, regressor_kwargs, gene_names, tf_names, client_or_address, early_stop_window_length, limit, seed, verbose)
    117 if verbose:
    118     print('creating dask graph')
--> 120 graph = create_graph(expression_matrix,
    121                      gene_names,
    122                      tf_names,
    123                      client=client,
    124                      regressor_type=regressor_type,
    125                      regressor_kwargs=regressor_kwargs,
    126                      early_stop_window_length=early_stop_window_length,
    127                      limit=limit,
    128                      seed=seed)
    130 if verbose:
    131     print('{} partitions'.format(graph.npartitions))

File ~/anaconda3/envs/pySCENIC/lib/python3.12/site-packages/arboreto/core.py:450, in create_graph(expression_matrix, gene_names, tf_names, regressor_type, regressor_kwargs, client, target_genes, limit, include_meta, early_stop_window_length, repartition_multiplier, seed)
    448 # gather the DataFrames into one distributed DataFrame
    449 all_links_df = from_delayed(delayed_link_dfs, meta=_GRN_SCHEMA)
--> 450 all_meta_df = from_delayed(delayed_meta_dfs, meta=_META_SCHEMA)
    452 # optionally limit the number of resulting regulatory links, descending by top importance
    453 if limit:

File ~/anaconda3/envs/pySCENIC/lib/python3.12/site-packages/dask_expr/io/_delayed.py:115, in from_delayed(dfs, meta, divisions, prefix, verify_meta)
    112     dfs = [dfs]
    114 if len(dfs) == 0:
--> 115     raise TypeError("Must supply at least one delayed object")
    117 if meta is None:
    118     meta = delayed(make_meta)(dfs[0]).compute()

TypeError: Must supply at least one delayed object
  • pySCENIC version: [0.12.1+8.gd2309fe]
  • Installation method: [pip]
  • Run environment: [Jupyter notebook]
  • OS: [e.g. Ubuntu]
  • Package versions: [obtain using pip freeze, conda list, or skip this if using Docker/Singularity]:
# packages in environment at /home/ali/anaconda3/envs/pySCENIC:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
aiohttp                   3.9.5                    pypi_0    pypi
aiosignal                 1.3.1                    pypi_0    pypi
anyio                     4.4.0                    pypi_0    pypi
arboreto                  0.1.6              pyh3252c3a_0    bioconda
argon2-cffi               23.1.0                   pypi_0    pypi
argon2-cffi-bindings      21.2.0                   pypi_0    pypi
arrow                     1.3.0                    pypi_0    pypi
asttokens                 2.4.1                    pypi_0    pypi
async-lru                 2.0.4                    pypi_0    pypi
attrs                     23.2.0                   pypi_0    pypi
aws-c-auth                0.7.22              hbd3ac97_10    conda-forge
aws-c-cal                 0.7.1                h87b94db_1    conda-forge
aws-c-common              0.9.23               h4ab18f5_0    conda-forge
aws-c-compression         0.2.18               he027950_7    conda-forge
aws-c-event-stream        0.4.2               h7671281_15    conda-forge
aws-c-http                0.8.2                he17ee6b_6    conda-forge
aws-c-io                  0.14.10              h826b7d6_1    conda-forge
aws-c-mqtt                0.10.4               hcd6a914_8    conda-forge
aws-c-s3                  0.6.0                h365ddd8_2    conda-forge
aws-c-sdkutils            0.1.16               he027950_3    conda-forge
aws-checksums             0.1.18               he027950_7    conda-forge
aws-crt-cpp               0.27.3               hda66527_2    conda-forge
aws-sdk-cpp               1.11.329             h46c3b66_9    conda-forge
azure-core-cpp            1.12.0               h830ed8b_0    conda-forge
azure-identity-cpp        1.8.0                hdb0d106_1    conda-forge
azure-storage-blobs-cpp   12.11.0              ha67cba7_1    conda-forge
azure-storage-common-cpp  12.6.0               he3f277c_1    conda-forge
azure-storage-files-datalake-cpp 12.10.0              h29b5301_1    conda-forge
babel                     2.15.0                   pypi_0    pypi
beautifulsoup4            4.12.3                   pypi_0    pypi
bleach                    6.1.0                    pypi_0    pypi
bokeh                     3.5.0              pyhd8ed1ab_0    conda-forge
boltons                   24.0.0                   pypi_0    pypi
brotli                    1.1.0                hd590300_1    conda-forge
brotli-bin                1.1.0                hd590300_1    conda-forge
brotli-python             1.1.0           py312h30efb56_1    conda-forge
bzip2                     1.0.8                h4bc722e_7    conda-forge
c-ares                    1.32.2               h4bc722e_0    conda-forge
ca-certificates           2024.7.4             hbcca054_0    conda-forge
certifi                   2024.7.4           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py312hf06ca03_0    conda-forge
charset-normalizer        3.3.2                    pypi_0    pypi
click                     8.1.7           unix_pyh707e725_0    conda-forge
cloudpickle               3.0.0              pyhd8ed1ab_0    conda-forge
comm                      0.2.2                    pypi_0    pypi
contourpy                 1.2.1           py312h8572e83_0    conda-forge
ctxcore                   0.2.0                    pypi_0    pypi
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
cytoolz                   0.12.3          py312h98912ed_0    conda-forge
dask                      2024.7.0           pyhd8ed1ab_0    conda-forge
dask-core                 2024.7.0           pyhd8ed1ab_0    conda-forge
dask-expr                 1.1.8                    pypi_0    pypi
dask-glm                  0.3.2                    pypi_0    pypi
dask-ml                   2024.4.4                 pypi_0    pypi
debugpy                   1.8.2                    pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
defusedxml                0.7.1                    pypi_0    pypi
dill                      0.3.8                    pypi_0    pypi
distributed               2024.7.0           pyhd8ed1ab_0    conda-forge
executing                 2.0.1                    pypi_0    pypi
fastjsonschema            2.20.0                   pypi_0    pypi
fonttools                 4.53.1          py312h41a817b_0    conda-forge
fqdn                      1.5.1                    pypi_0    pypi
freetype                  2.12.1               h267a509_2    conda-forge
frozendict                2.4.4                    pypi_0    pypi
frozenlist                1.4.1                    pypi_0    pypi
fsspec                    2024.6.1           pyhff2d567_0    conda-forge
gflags                    2.2.2             he1b5a44_1004    conda-forge
glog                      0.7.1                hbabe93e_0    conda-forge
h11                       0.14.0                   pypi_0    pypi
h2                        4.1.0              pyhd8ed1ab_0    conda-forge
h5py                      3.11.0                   pypi_0    pypi
hpack                     4.0.0              pyh9f0ad1d_0    conda-forge
httpcore                  1.0.5                    pypi_0    pypi
httpx                     0.27.0                   pypi_0    pypi
hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge
icu                       75.1                 he02047a_0    conda-forge
idna                      3.7                      pypi_0    pypi
importlib-metadata        8.0.0              pyha770c72_0    conda-forge
importlib_metadata        8.0.0                hd8ed1ab_0    conda-forge
interlap                  0.2.7                    pypi_0    pypi
ipykernel                 6.29.5                   pypi_0    pypi
ipython                   8.26.0                   pypi_0    pypi
ipywidgets                8.1.3                    pypi_0    pypi
isoduration               20.11.0                  pypi_0    pypi
jedi                      0.19.1                   pypi_0    pypi
jinja2                    3.1.4              pyhd8ed1ab_0    conda-forge
joblib                    1.4.2              pyhd8ed1ab_0    conda-forge
json5                     0.9.25                   pypi_0    pypi
jsonpointer               3.0.0                    pypi_0    pypi
jsonschema                4.23.0                   pypi_0    pypi
jsonschema-specifications 2023.12.1                pypi_0    pypi
jupyter                   1.0.0                    pypi_0    pypi
jupyter-client            8.6.2                    pypi_0    pypi
jupyter-console           6.6.3                    pypi_0    pypi
jupyter-core              5.7.2                    pypi_0    pypi
jupyter-events            0.10.0                   pypi_0    pypi
jupyter-lsp               2.2.5                    pypi_0    pypi
jupyter-server            2.14.2                   pypi_0    pypi
jupyter-server-terminals  0.5.3                    pypi_0    pypi
jupyterlab                4.2.4                    pypi_0    pypi
jupyterlab-pygments       0.3.0                    pypi_0    pypi
jupyterlab-server         2.27.3                   pypi_0    pypi
jupyterlab-widgets        3.0.11                   pypi_0    pypi
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.5           py312h8572e83_1    conda-forge
krb5                      1.21.3               h659f571_0    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.40                 hf3520f5_7    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20240116.2      cxx17_he02047a_1    conda-forge
libarrow                  16.1.0          h34456a7_14_cpu    conda-forge
libarrow-acero            16.1.0          he02047a_14_cpu    conda-forge
libarrow-dataset          16.1.0          he02047a_14_cpu    conda-forge
libarrow-substrait        16.1.0          hc9a23c6_14_cpu    conda-forge
libblas                   3.9.0           22_linux64_openblas    conda-forge
libbrotlicommon           1.1.0                hd590300_1    conda-forge
libbrotlidec              1.1.0                hd590300_1    conda-forge
libbrotlienc              1.1.0                hd590300_1    conda-forge
libcblas                  3.9.0           22_linux64_openblas    conda-forge
libcrc32c                 1.1.2                h9c3ff4c_0    conda-forge
libcurl                   8.8.0                hca28451_1    conda-forge
libdeflate                1.20                 hd590300_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libevent                  2.1.12               hf998b51_1    conda-forge
libexpat                  2.6.2                h59595ed_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 14.1.0               h77fa898_0    conda-forge
libgfortran-ng            14.1.0               h69a702a_0    conda-forge
libgfortran5              14.1.0               hc5f4f2c_0    conda-forge
libgomp                   14.1.0               h77fa898_0    conda-forge
libgoogle-cloud           2.26.0               h26d7fe4_0    conda-forge
libgoogle-cloud-storage   2.26.0               ha262f82_0    conda-forge
libgrpc                   1.62.2               h15f2491_0    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           22_linux64_openblas    conda-forge
libnghttp2                1.58.0               h47da74e_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libopenblas               0.3.27          pthreads_hac2b453_1    conda-forge
libparquet                16.1.0          h9e5060d_14_cpu    conda-forge
libpng                    1.6.43               h2797004_0    conda-forge
libprotobuf               4.25.3               h08a7969_0    conda-forge
libre2-11                 2023.09.01           h5a48ba9_2    conda-forge
libsqlite                 3.46.0               hde9e2c9_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              14.1.0               hc0a3c3a_0    conda-forge
libthrift                 0.19.0               hb90f79a_1    conda-forge
libtiff                   4.6.0                h1dd3fc0_3    conda-forge
libutf8proc               2.8.0                h166bdaf_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libwebp-base              1.4.0                hd590300_0    conda-forge
libxcb                    1.16                 hd590300_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxml2                   2.12.7               he7c6b58_4    conda-forge
libzlib                   1.3.1                h4ab18f5_1    conda-forge
llvmlite                  0.43.0                   pypi_0    pypi
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
loompy                    3.0.7                    pypi_0    pypi
lz4                       4.3.3           py312h03f37cb_0    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
markupsafe                2.1.5           py312h98912ed_0    conda-forge
matplotlib-base           3.9.1           py312h9201f00_0    conda-forge
matplotlib-inline         0.1.7                    pypi_0    pypi
mistune                   3.0.2                    pypi_0    pypi
msgpack-python            1.0.8           py312h2492b07_0    conda-forge
multidict                 6.0.5                    pypi_0    pypi
multipledispatch          1.0.0                    pypi_0    pypi
multiprocessing-on-dill   3.5.0a4                  pypi_0    pypi
munkres                   1.0.7                      py_1    bioconda
nbclient                  0.10.0                   pypi_0    pypi
nbconvert                 7.16.4                   pypi_0    pypi
nbformat                  5.10.4                   pypi_0    pypi
ncurses                   6.5                  h59595ed_0    conda-forge
nest-asyncio              1.6.0                    pypi_0    pypi
networkx                  3.3                      pypi_0    pypi
notebook                  7.2.1                    pypi_0    pypi
notebook-shim             0.2.4                    pypi_0    pypi
numba                     0.60.0                   pypi_0    pypi
numexpr                   2.10.1                   pypi_0    pypi
numpy                     2.0.0           py312h22e1c76_0    conda-forge
numpy-groupies            0.11.1                   pypi_0    pypi
openjpeg                  2.5.2                h488ebb8_0    conda-forge
openssl                   3.3.1                h4bc722e_2    conda-forge
orc                       2.0.1                h17fec99_1    conda-forge
overrides                 7.7.0                    pypi_0    pypi
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pandas                    2.2.2           py312h1d6d2e6_1    conda-forge
pandocfilters             1.5.1                    pypi_0    pypi
parso                     0.8.4                    pypi_0    pypi
partd                     1.4.2              pyhd8ed1ab_0    conda-forge
patsy                     0.5.6              pyhd8ed1ab_0    conda-forge
pexpect                   4.9.0                    pypi_0    pypi
pillow                    10.4.0          py312h287a98d_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
platformdirs              4.2.2                    pypi_0    pypi
prometheus-client         0.20.0                   pypi_0    pypi
prompt-toolkit            3.0.47                   pypi_0    pypi
psutil                    6.0.0           py312h9a8786e_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0                    pypi_0    pypi
pure-eval                 0.2.2                    pypi_0    pypi
pyarrow                   17.0.0                   pypi_0    pypi
pyarrow-hotfix            0.6                pyhd8ed1ab_0    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pygments                  2.18.0                   pypi_0    pypi
pynndescent               0.5.13                   pypi_0    pypi
pyparsing                 3.1.2              pyhd8ed1ab_0    conda-forge
pyscenic                  0.12.1+8.gd2309fe          pypi_0    pypi
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.12.4          h194c7f8_0_cpython    conda-forge
python-dateutil           2.9.0.post0              pypi_0    pypi
python-json-logger        2.0.7                    pypi_0    pypi
python-tzdata             2024.1             pyhd8ed1ab_0    conda-forge
python_abi                3.12                    4_cp312    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py312h98912ed_1    conda-forge
pyzmq                     26.0.3                   pypi_0    pypi
qhull                     2020.2               h434a139_5    conda-forge
qtconsole                 5.5.2                    pypi_0    pypi
qtpy                      2.4.1                    pypi_0    pypi
re2                       2023.09.01           h7f4b329_2    conda-forge
readline                  8.2                  h8228510_1    conda-forge
referencing               0.35.1                   pypi_0    pypi
requests                  2.32.3                   pypi_0    pypi
rfc3339-validator         0.1.4                    pypi_0    pypi
rfc3986-validator         0.1.1                    pypi_0    pypi
rpds-py                   0.19.0                   pypi_0    pypi
s2n                       1.4.17               he19d79f_0    conda-forge
scikit-learn              1.5.1           py312h775a589_0    conda-forge
scipy                     1.14.0          py312hc2bc53b_1    conda-forge
seaborn                   0.13.2               hd8ed1ab_2    conda-forge
seaborn-base              0.13.2             pyhd8ed1ab_2    conda-forge
send2trash                1.8.3                    pypi_0    pypi
setuptools                71.0.3             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.2.1                ha2e4443_0    conda-forge
sniffio                   1.3.1                    pypi_0    pypi
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.5                      pypi_0    pypi
sparse                    0.15.4                   pypi_0    pypi
stack-data                0.6.3                    pypi_0    pypi
statsmodels               0.14.2          py312h085067d_0    conda-forge
tblib                     3.0.0              pyhd8ed1ab_0    conda-forge
terminado                 0.18.1                   pypi_0    pypi
threadpoolctl             3.5.0              pyhc1e730c_0    conda-forge
tinycss2                  1.3.0                    pypi_0    pypi
tk                        8.6.13          noxft_h4845f30_101    conda-forge
toolz                     0.12.1             pyhd8ed1ab_0    conda-forge
tornado                   6.4.1           py312h9a8786e_0    conda-forge
tqdm                      4.66.4                   pypi_0    pypi
traitlets                 5.14.3                   pypi_0    pypi
types-python-dateutil     2.9.0.20240316           pypi_0    pypi
tzdata                    2024a                h0c530f3_0    conda-forge
umap-learn                0.5.6                    pypi_0    pypi
uri-template              1.3.0                    pypi_0    pypi
urllib3                   2.2.2              pyhd8ed1ab_1    conda-forge
wcwidth                   0.2.13                   pypi_0    pypi
webcolors                 24.6.0                   pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
websocket-client          1.8.0                    pypi_0    pypi
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
widgetsnbextension        4.0.11                   pypi_0    pypi
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xyzservices               2024.6.0           pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yarl                      1.9.4                    pypi_0    pypi
zict                      3.0.0              pyhd8ed1ab_0    conda-forge
zipp                      3.19.2             pyhd8ed1ab_0    conda-forge
zstandard                 0.23.0          py312h3483029_0    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge
...

AAA-3 avatar Jul 19 '24 18:07 AAA-3