From f98e3c7abb7b9ece11c8cb0ca664e6f4006b3605 Mon Sep 17 00:00:00 2001 From: Ludvig Date: Thu, 11 Dec 2025 14:51:01 +0100 Subject: [PATCH] Attempts fixing zero-sum issue after outlier removal --- single_sample_correction_factor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/single_sample_correction_factor.py b/single_sample_correction_factor.py index 0ab473b..274ce17 100644 --- a/single_sample_correction_factor.py +++ b/single_sample_correction_factor.py @@ -49,6 +49,8 @@ def construct_GC_bias(sample_lengths, ref_lengths, X): GC_array = GC_array[lower_cnt: upper_cnt+1] GC_array = remove_outlier(GC_array) + if GC_array.sum() == 0: + return np.ones_like(GC_array)[lag:-lag] GC_array = GC_array / np.mean(GC_array) lowess = sm.nonparametric.lowess(GC_array, X, frac=0.1)