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] modules_from_adjacencies returns "genes present in the network (adjacencies) output, but missing from the expression matrix" #508

Closed jesswhitts closed 1 year ago

jesswhitts commented 1 year ago

Hi,

I am having trouble running the modules_from_adjacencies function. i"m getting an error saying there are genes missing from my expression matrix, but when I try to find unique_adj_genes it returns nothing?

I have tried this with multiple datasets (well, subsets of my very large dataset, analysed separately) and get the same output

Input :

adjacencies.head() TF target importance 0 HNRNPA1 AC090498.1 46.670648 1 HNRNPA1 RPS18 37.574458 2 HNRNPA1 FAU 36.717264 3 HNRNPA1 RPS6 35.909502 4 HNRNPA1 EEF1A1 35.571696

from pyscenic.utils import modules_from_adjacencies modules = list(modules_from_adjacencies(adjacencies, exprMat))

Error:

File ~/opt/anaconda3/envs/scenic/lib/python3.9/site-packages/pyscenic/utils.py:362, in modules_from_adjacencies(adjacencies, ex_mtx, thresholds, top_n_targets, top_n_regulators, min_genes, absolute_thresholds, rho_dichotomize, keep_only_activating, rho_threshold, rho_mask_dropouts) 356 unique_adj_genes = set(adjacencies[COLUMN_NAME_TF]).union( 357 set(adjacencies[COLUMN_NAME_TARGET]) 358 ) - set(ex_mtx.columns) 359 assert ( 360 len(unique_adj_genes) == 0 361 ), f"Found {len(unique_adj_genes)} genes present in the network (adjacencies) output, but missing from the expression matrix. Is this a different gene expression matrix?"

Troubleshoot attempt:

unique_adj_genes = set(adjacencies["TF"]).union(set(adjacencies["target"])) - set(exprMat.columns) unique_adj_genes set()

If you require any further information, let me know!

Many thanks, Jess

jesswhitts commented 1 year ago

I set this up on our cluster and ran it on there instead and I do not get the error. I guess its an issue with my environment, not an issue with pyscenic...