From 4136759a92b4fa44f2e9a788a693fd9dc8321891 Mon Sep 17 00:00:00 2001 From: Brett Hannigan Date: Mon, 26 Aug 2024 09:35:55 -0600 Subject: [PATCH 1/2] Update to be compatible with numpy 2.1 --- dnachisel/builtin_specifications/EnforceGCContent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dnachisel/builtin_specifications/EnforceGCContent.py b/dnachisel/builtin_specifications/EnforceGCContent.py index 72c352c..af850e7 100644 --- a/dnachisel/builtin_specifications/EnforceGCContent.py +++ b/dnachisel/builtin_specifications/EnforceGCContent.py @@ -104,7 +104,7 @@ def evaluate(self, problem): 0, gc - self.maxi ) score = -breaches.sum() - breaches_starts = wstart + (breaches > 0).nonzero()[0] + breaches_starts = wstart + (np.atleast_1d(breaches) > 0).nonzero()[0] if len(breaches_starts) == 0: breaches_locations = [] From efa9b3abcdcc15e38146addbcd32cced89060925 Mon Sep 17 00:00:00 2001 From: Brett Hannigan Date: Mon, 26 Aug 2024 09:53:39 -0600 Subject: [PATCH 2/2] Move atleast1 --- dnachisel/builtin_specifications/EnforceGCContent.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dnachisel/builtin_specifications/EnforceGCContent.py b/dnachisel/builtin_specifications/EnforceGCContent.py index af850e7..7252fd3 100644 --- a/dnachisel/builtin_specifications/EnforceGCContent.py +++ b/dnachisel/builtin_specifications/EnforceGCContent.py @@ -100,11 +100,13 @@ 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) - breaches = np.maximum(0, self.mini - gc) + np.maximum( - 0, gc - self.maxi + breaches = np.atleast_1d( + np.maximum(0, self.mini - gc) + np.maximum( + 0, gc - self.maxi + ) ) score = -breaches.sum() - breaches_starts = wstart + (np.atleast_1d(breaches) > 0).nonzero()[0] + breaches_starts = wstart + (breaches > 0).nonzero()[0] if len(breaches_starts) == 0: breaches_locations = []