From fee00c6d7f802fd4a4bdeadf7caf9142d174a024 Mon Sep 17 00:00:00 2001 From: LouisFaure Date: Thu, 31 Oct 2024 13:05:17 -0400 Subject: [PATCH] fix issue with branch_specific, added check when all genes are filtered out --- docs/release_notes.rst | 3 ++- scFates/tools/bifurcation_tools.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 76d15b9..2e41cd7 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -4,10 +4,11 @@ Release Notes ============= -Version 1.0.8 :small:`October 23, 2566/2024` +Version 1.0.9 :small:`October 31, 2566/2024` -------------------------------------------- - Future proofing scFates by allowing pandas>2.0 - Fixed most Deprecation warnings. +- Fix issue with branch_specific, added check when all genes are filtered out Version 1.0.8 :small:`June 19, 2566/2024` -------------------------------------------- diff --git a/scFates/tools/bifurcation_tools.py b/scFates/tools/bifurcation_tools.py index 8629a66..57e6e33 100644 --- a/scFates/tools/bifurcation_tools.py +++ b/scFates/tools/bifurcation_tools.py @@ -391,9 +391,12 @@ def branch_specific( df = adata.uns[name]["fork"] df = df[(df.up_A > up_A) & (df.up_p < up_p) & (df.signi_fdr > stf_cut)] - df = df[((df.iloc[:, : len(milestones)] + effect) > 0).sum(axis=1) == 1] + df = df[((df.iloc[:, : len(milestones)] + effect) >= 0).sum(axis=1) == 1] df["branch"] = df.iloc[:, : len(milestones)].idxmax(axis=1) + if df.shape[0] == 0: + raise Exception("The current filtering removed all genes!") + logg.info( " " + "branch specific features: "