Skip to content

Commit

Permalink
making genie3 work when genes are not expressed
Browse files Browse the repository at this point in the history
  • Loading branch information
jkobject committed Nov 13, 2024
1 parent f37a7f9 commit 7ecd734
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions bengrn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 7ecd734

Please sign in to comment.