From 7ecd734fc93f6a1a614b7407abf45922d7bc3440 Mon Sep 17 00:00:00 2001 From: jkobject Date: Wed, 13 Nov 2024 15:18:48 +0100 Subject: [PATCH] making genie3 work when genes are not expressed --- Makefile | 1 + bengrn/base.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88d83e7..a14b586 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ virtualenv: ## Create a virtual environment. @source .venv/bin/activate @make install @echo "!!! Please run 'source .venv/bin/activate' to enable the environment !!!" + .PHONY: release release: ## Create a new tag for release. diff --git a/bengrn/base.py b/bengrn/base.py index 9423870..8103108 100644 --- a/bengrn/base.py +++ b/bengrn/base.py @@ -715,9 +715,9 @@ def compute_genie3( GRNAnnData: The Gene Regulatory Network data computed using the GENIE3 algorithm. """ mat = np.asarray(adata.X.toarray() if issparse(adata.X) else adata.X) - names = adata.var_names[mat.sum(0) > 0].tolist() - var = adata.var[mat.sum(0) > 0] - mat = mat[:, mat.sum(0) > 0] + names = adata.var_names.tolist() # [mat.sum(0) > 0].tolist() + var = adata.var # [mat.sum(0) > 0] + # mat = mat[:, mat.sum(0) > 0] VIM = GENIE3(mat, gene_names=names, nthreads=nthreads, ntrees=ntrees, **kwargs) grn = GRNAnnData(grn=VIM, X=mat, var=var, obs=adata.obs) grn.var_names = grn.var["symbol"]