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

[BUG]NameError: name 'exp_mtx' is not defined #308

Closed lxwang326 closed 3 years ago

lxwang326 commented 3 years ago

when run

%time auc_mtx = aucell(exp_mtx, regulons, num_workers=32) auc_mtx.to_csv(AUCELL_MTX_FNAME)

error

CPU times: user 13 µs, sys: 1 µs, total: 14 µs Wall time: 26.2 µs

NameError Traceback (most recent call last) /tmp/ipykernel_33904/2692781098.py in 1 get_ipython().run_line_magic('time', '') ----> 2 auc_mtx = aucell(exp_mtx, regulons, num_workers=32) 3 auc_mtx.to_csv(AUCELL_MTX_FNAME)

NameError: name 'exp_mtx' is not defined

any help?

jpcartailler commented 3 years ago

exp_mtx needs to be set prior to the function call. How to do so is generally described here: https://python-textbok.readthedocs.io/en/1.0/Variables_and_Scope.html.

cflerin commented 3 years ago

Right, you will need to read in the expression matrix before running this function. You can use something like

from pyscenic.cli.utils import load_exp_matrix
exp_mtx = load_exp_matrix("expr_mat.csv")