From e2885bf76decf268d06817e635dc0485c4834e9f Mon Sep 17 00:00:00 2001 From: Ondrej Sladky Date: Mon, 26 Aug 2024 10:40:18 +0200 Subject: [PATCH] GCContent module is compatible with numpy 2.1.0. --- dnachisel/builtin_specifications/EnforceGCContent.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dnachisel/builtin_specifications/EnforceGCContent.py b/dnachisel/builtin_specifications/EnforceGCContent.py index 72c352c..bd889dc 100644 --- a/dnachisel/builtin_specifications/EnforceGCContent.py +++ b/dnachisel/builtin_specifications/EnforceGCContent.py @@ -100,6 +100,9 @@ def evaluate(self, problem): wstart, wend = self.location.start, self.location.end sequence = self.location.extract_sequence(problem.sequence) gc = gc_content(sequence, window_size=self.window) + # Ensure that GC is not a scalar. + if len(gc.shape) == 0: + gc = np.reshape(gc, (1,)) breaches = np.maximum(0, self.mini - gc) + np.maximum( 0, gc - self.maxi )