From 0cb0710ba4e9602c5820d83e3e3aee6f687cd343 Mon Sep 17 00:00:00 2001 From: veghp Date: Mon, 13 Jan 2025 15:51:27 +0000 Subject: [PATCH] Fix rare NoSolutionError At max_homology_length = 5 no solution is found sometimes. --- tests/builtin_specifications/test_AllowPrimer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/builtin_specifications/test_AllowPrimer.py b/tests/builtin_specifications/test_AllowPrimer.py index 6db880b..4437d55 100644 --- a/tests/builtin_specifications/test_AllowPrimer.py +++ b/tests/builtin_specifications/test_AllowPrimer.py @@ -1,10 +1,13 @@ """Example of use of the AvoidChanges as an objective to minimize modifications of a sequence.""" +import numpy + from dnachisel import AllowPrimer, DnaOptimizationProblem def test_AllowPrimer(): + numpy.random.seed(123) primers = ["ATTGCGCCAAACT", "TAATCCACCCTAAT", "ATTCACACTTCAA"] problem = DnaOptimizationProblem( sequence=40 * "A", @@ -12,12 +15,12 @@ def test_AllowPrimer(): AllowPrimer( tmin=50, tmax=60, - max_homology_length=5, + max_homology_length=7, location=(10, 30), avoid_heterodim_with=primers, ) ], - logger=None + logger=None, ) problem.resolve_constraints() assert problem.all_constraints_pass()