Skip to content

Commit

Permalink
Merge pull request #82 from ondrej-sladky-eligo/master
Browse files Browse the repository at this point in the history
All builtin specifications now correctly recognize `boost` parameter.
  • Loading branch information
veghp authored Aug 9, 2024
2 parents 61b35a5 + df26628 commit c4d3ec1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions dnachisel/builtin_specifications/AllowPrimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,20 @@ def __init__(
avoid_heterodim_with=None,
max_heterodim_tm=5,
avoided_repeats=((2, 5), (3, 4), (4, 3)),
boost=1.0,
):
location = Location.from_data(location)
specs = {
"unique_sequence": UniquifyAllKmers(
k=max_homology_length, location=location
k=max_homology_length, location=location, boost=boost
),
"melting_temperature": EnforceMeltingTemperature(
mini=tmin, maxi=tmax, location=location
mini=tmin, maxi=tmax, location=location, boost=boost
),
**{
"repeats_%d_%d"
% (k, n): AvoidPattern(
RepeatedKmerPattern(k, n), location=location
RepeatedKmerPattern(k, n), location=location, boost=boost
)
for (k, n) in avoided_repeats
},
Expand All @@ -84,5 +85,7 @@ def __init__(
other_primers_sequences=avoid_heterodim_with,
tmax=max_heterodim_tm,
location=location,
boost=boost,
)
self.register_specifications(specs)
self.boost = boost
2 changes: 2 additions & 0 deletions dnachisel/builtin_specifications/AvoidBlastMatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(
e_value=1e80,
culling_limit=1,
location=None,
boost=1.0,
):
"""Initialize."""
self.blast_db = blast_db
Expand All @@ -68,6 +69,7 @@ def __init__(
self.e_value = e_value
self.ungapped = ungapped
self.culling_limit = culling_limit
self.boost = boost

def initialized_on_problem(self, problem, role=None):
return self._copy_with_full_span_if_no_location(problem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(
self.other_primers_sequences = other_primers_sequences
self.tmax = tmax
self.location = location
self.boost = boost

def initialized_on_problem(self, problem, role=None):
return self._copy_with_full_span_if_no_location(problem)
Expand Down
3 changes: 2 additions & 1 deletion dnachisel/builtin_specifications/SequenceLengthBounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ class SequenceLengthBounds(Specification):
"""
best_possible_score = 0

def __init__(self, min_length=0, max_length=None):
def __init__(self, min_length=0, max_length=None, boost=1.0):
self.min_length = min_length
self.max_length = max_length
self.boost = boost

def evaluate(self, problem):
"""Return 0 if the sequence length is between the bounds, else -1"""
Expand Down
2 changes: 1 addition & 1 deletion dnachisel/builtin_specifications/UniquifyAllKmers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def __init__(
reference = Location.from_tuple(reference)
self.reference = reference
self.include_reverse_complement = include_reverse_complement
self.boost = 1.0
self.boost = boost
self.localization_data = localization_data

def initialized_on_problem(self, problem, role="constraint"):
Expand Down

0 comments on commit c4d3ec1

Please sign in to comment.