Skip to content

Commit 6c7f460

Browse files
committed
cisTarget step: Check for modules with zero db overlap.
- Previously such modules would cause an error, now these modules are skipped. - Related to #158, #177, #132, #85
1 parent 7ad2916 commit 6c7f460

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/pyscenic/transform.py

+5
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def module2features_auc1st_impl(db: Type[RankingDatabase], module: Regulon, moti
124124
features, genes, rankings = df.index.values, df.columns.values, df.values
125125
weights = np.asarray([module[gene] for gene in genes]) if weighted_recovery else np.ones(len(genes))
126126

127+
# include check for modules with no genes that could be mapped to the db. This can happen when including non protein-coding genes in the expression matrix.
128+
if(df.empty):
129+
LOGGER.warning("No genes in module {} could be mapped to {}. Skipping this module.".format(module.name, db.name))
130+
return pd.DataFrame(), None, None, genes, None
131+
127132
# Calculate recovery curves, AUC and NES values.
128133
# For fast unweighted implementation so weights to None.
129134
aucs = calc_aucs(df, db.total_genes, weights, auc_threshold)

0 commit comments

Comments
 (0)