Skip to content

Commit

Permalink
cisTarget step: Check for modules with zero db overlap.
Browse files Browse the repository at this point in the history
- Previously such modules would cause an error, now these modules are
skipped.
- Related to #158, #177, #132, #85
  • Loading branch information
cflerin committed Jun 3, 2020
1 parent 7ad2916 commit 6c7f460
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pyscenic/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def module2features_auc1st_impl(db: Type[RankingDatabase], module: Regulon, moti
features, genes, rankings = df.index.values, df.columns.values, df.values
weights = np.asarray([module[gene] for gene in genes]) if weighted_recovery else np.ones(len(genes))

# 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.
if(df.empty):
LOGGER.warning("No genes in module {} could be mapped to {}. Skipping this module.".format(module.name, db.name))
return pd.DataFrame(), None, None, genes, None

# Calculate recovery curves, AUC and NES values.
# For fast unweighted implementation so weights to None.
aucs = calc_aucs(df, db.total_genes, weights, auc_threshold)
Expand Down

0 comments on commit 6c7f460

Please sign in to comment.