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
443 stars 182 forks source link

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

Open Achiraa opened 1 week ago

Achiraa commented 1 week ago

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(DATAFOLDER, "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:

meriadecmorrier commented 5 days ago

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

Achiraa commented 3 days ago

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