Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Achiraa opened this issue Nov 5, 2024 · 5 comments
Open

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

Achiraa opened this issue Nov 5, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Achiraa
Copy link

Achiraa commented Nov 5, 2024

TypeError: Must supply at least one delayed object

Input matrix

ex_matrix = pd.read_csv(SC_EXP_FNAME, sep='\t', header=0, index_col=0).T
ex_matrix.head()
GENE Mrpl15 Lypla1 Gm37988 Tcea1 Atp6v1h Rb1cc1 4732440D04Rik Pcmtd1 Gm26901 Rrs1 Adhfe1 Mybl1
BM_AAACCCAAGTCTAGAA.1 0.000000 1.098612 0.0 0.000000 0.000000 0.693147 0.000000 0.693147 0.0 0.693147 0.0 0.0

Code
1. Command run when the error occurred:
import os
import glob
import pickle
import pyscenic
import pandas as pd
import numpy as np
import seaborn as sns
import dask.dataframe as dd

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

DATA_FOLDER="C:/Users/S236282/Desktop/Itaconate data/pySCENIC"
RESOURCES_FOLDER="C:/Users/S236282/Desktop/Itaconate data/pySCENIC"
DATABASE_FOLDER = "C:/Users/S236282/Desktop/Itaconate data/pySCENIC"

DATABASES_GLOB = os.path.join(DATA_FOLDER, "mm10_*.genes_vs_motifs.rankings.feather")
MOTIF_ANNOTATIONS_FNAME = os.path.join(RESOURCES_FOLDER, "motifs-v10nr_clustnr_mgi.tbl")

MM_TFS_FNAME = os.path.join(RESOURCES_FOLDER, 'allTFs_mm.txt')
SC_EXP_FNAME = os.path.join(RESOURCES_FOLDER, "Expression_data.txt")

ADJACENCIES_FNAME = os.path.join(RESOURCES_FOLDER, "adjacencies.tsv")
MODULES_FNAME = os.path.join(RESOURCES_FOLDER, "modules.p")
MOTIFS_FNAME = os.path.join(RESOURCES_FOLDER, "motifs.csv")
REGULONS_FNAME = os.path.join(RESOURCES_FOLDER, "regulons.p")

N_SAMPLES = 500

ex_matrix = pd.read_csv(SC_EXP_FNAME, sep='\t', header=0, index_col=0).T
ex_matrix.head()
ex_matrix.shape

tf_name = 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]
dbs

filtered_tf_name = list(intersection)

adjacencies = grnboost2(expression_data=ex_matrix, tf_names= tf_name, verbose=True)
adjancencies.head()

2. Error encountered:

adjacencies = grnboost2(expression_data=ex_matrix, tf_names= tf_name, verbose=True)
preparing dask client
parsing input
creating dask graph
shutting down client and local cluster
finished
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\S236282\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\arboreto\algo.py", line 39, in grnboost2
return diy(expression_data=expression_data, regressor_type='GBM', regressor_kwargs=SGBM_KWARGS,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\S236282\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\arboreto\algo.py", line 120, in diy
graph = create_graph(expression_matrix,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\S236282\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\arboreto\core.py", line 450, in create_graph
all_meta_df = from_delayed(delayed_meta_dfs, meta=_META_SCHEMA)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\S236282\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\dask_expr\io_delayed.py", line 115, in from_delayed
raise TypeError("Must supply at least one delayed object")
TypeError: Must supply at least one delayed object

Expected behavior
A clear and concise description of what you expected to happen.

Please complete the following information:

  • pySCENIC version: 0.12.1
  • Installation method: Pip
  • Run environment: Python 3.11.9
  • OS: Windows
  • Package versions:
  • aiohappyeyeballs==2.4.3
    aiohttp==3.10.10
    aiosignal==1.3.1
    arboreto==0.1.6
    attrs==24.2.0
    bokeh==3.6.0
    boltons==24.0.0
    certifi==2024.8.30
    charset-normalizer==3.4.0
    click==8.1.7
    cloudpickle==3.1.0
    colorama==0.4.6
    contourpy==1.3.0
    ctxcore==0.2.0
    cycler==0.12.1
    cytoolz==1.0.0
    dask==2024.10.0
    dask-expr==1.1.16
    dill==0.3.9
    distributed==2024.2.1
    fonttools==4.54.1
    frozendict==2.4.6
    frozenlist==1.5.0
    fsspec==2024.10.0
    h5py==3.12.1
    idna==3.10
    importlib_metadata==8.5.0
    interlap==0.2.7
    Jinja2==3.1.4
    joblib==1.4.2
    kiwisolver==1.4.7
    llvmlite==0.43.0
    locket==1.0.0
    loompy==3.0.7
    lz4==4.3.3
    MarkupSafe==3.0.2
    matplotlib==3.9.2
    msgpack==1.1.0
    multidict==6.1.0
    multiprocessing_on_dill==3.5.0a4
    networkx==3.4.2
    numba==0.60.0
    numexpr==2.10.1
    numpy==2.0.2
    numpy-groupies==0.11.2
    packaging==24.1
    pandas==2.2.3
    partd==1.4.2
    pillow==11.0.0
    propcache==0.2.0
    psutil==6.1.0
    pyarrow==18.0.0
    pynndescent==0.5.13
    pyparsing==3.2.0
    pyscenic==0.12.1
    python-dateutil==2.9.0.post0
    pytz==2024.2
    PyYAML==6.0.2
    requests==2.32.3
    scikit-learn==1.5.2
    scipy==1.14.1
    seaborn==0.13.2
    six==1.16.0
    sortedcontainers==2.4.0
    tblib==3.0.0
    threadpoolctl==3.5.0
    toolz==1.0.0
    tornado==6.4.1
    tqdm==4.66.6
    tzdata==2024.2
    umap-learn==0.5.7
    urllib3==2.2.3
    xyzservices==2024.9.0
    yarl==1.17.1
    zict==3.0.0
    zipp==3.20.2
@Achiraa Achiraa added the bug Something isn't working label Nov 5, 2024
@meriadecmorrier
Copy link

Hi,
It looks like issue #561. It might be linked to your dask-expr version (1.1.16) ?
Best

@Achiraa
Copy link
Author

Achiraa commented Nov 15, 2024

Thank you. Unfortunately, it didn't work for me. it raised another error.

TypeError: descriptor 'call' for 'type' objects doesn't apply to a 'property' object

@olaf-c
Copy link

olaf-c commented Nov 23, 2024

I'm having the same bug, did you find a solution?

@Achiraa
Copy link
Author

Achiraa commented Nov 25, 2024

Hi, I was not able to resolve this issue, but I tried using docker approach. It works and is easy. Here is the link: https://pyscenic.readthedocs.io/en/latest/installation.html

@ruoyeruolan
Copy link

image

This issue is caused by the create_graph function in arboreto.core. To resolve it, simply comment out the second command. While this error has already been fixed on GitHub, it has not yet been addressed in version 0.1.6 of the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants