Skip to content

Commit

Permalink
Fix rare NoSolutionError
Browse files Browse the repository at this point in the history
At max_homology_length = 5 no solution is found sometimes.
  • Loading branch information
veghp committed Jan 13, 2025
1 parent 7f7bb09 commit 0cb0710
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/builtin_specifications/test_AllowPrimer.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
"""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",
constraints=[
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()

0 comments on commit 0cb0710

Please sign in to comment.