Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All builtin specifications now correctly recognize boost parameter. #82

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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