-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add probe-specific logic to Primer3 #48
Closed
emmcauley
wants to merge
2
commits into
em_feat_add_Probe_object
from
em_add_probe_to_task_and_input
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from dataclasses import dataclass | ||
|
||
from fgpyo.util.metric import Metric | ||
|
||
from prymer.api.primer import Primer | ||
|
||
|
||
@dataclass(frozen=True, init=True, kw_only=True, slots=True) | ||
class Probe(Primer, Metric["Probe"]): | ||
"""Stores the properties of the designed Probe. Inherits `tm`, `penalty`, | ||
`span`, `bases`, and `tail` from `Primer`. | ||
|
||
Attributes: | ||
self_any_th: self-complementarity throughout the probe as calculated by Primer3 | ||
self_end_th: 3' end complementarity of the probe as calculated by Primer3 | ||
hairpin_th: hairpin formation thermodynamics of the probe as calculated by Primer3 | ||
|
||
""" | ||
|
||
self_any_th: float | ||
self_end_th: float | ||
hairpin_th: float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,12 +122,18 @@ | |
"Primer3 requires at least one set of parameters" | ||
" for either primer or probe design" | ||
) | ||
|
||
if self.primer_and_amplicon_params is not None and self.primer_weights is None: | ||
object.__setattr__(self, "primer_weights", PrimerAndAmpliconWeights()) | ||
|
||
if self.probe_params is not None and self.probe_weights is None: | ||
object.__setattr__(self, "probe_weights", ProbeWeights()) | ||
elif self.task.requires_primer_amplicon_params: | ||
if self.primer_and_amplicon_params is None: | ||
raise ValueError(f"Primer3 task {self.task} requires `PrimerAndAmpliconParams`") | ||
else: | ||
if self.primer_weights is None: | ||
object.__setattr__(self, "primer_weights", PrimerAndAmpliconWeights()) | ||
emmcauley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
elif self.task.requires_probe_params: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question Is it ever possible for a task to require both probe and primer params? If so, you may want to consider checking both and then reporting all collected errors. But if they're mutually exclusive it's unnecessary |
||
if self.probe_params is None: | ||
raise ValueError(f"Primer3 task {self.task} requires `ProbeParameters`") | ||
else: | ||
if self.probe_weights is None: | ||
object.__setattr__(self, "probe_weights", ProbeWeights()) | ||
|
||
def to_input_tags(self, design_region: Span) -> dict[Primer3InputTag, Any]: | ||
"""Assembles `Primer3InputTag` and values for input to `Primer3` | ||
|
@@ -154,5 +160,4 @@ | |
for settings in optional_attributes.values(): | ||
if settings is not None: | ||
assembled_tags.update(settings.to_input_tags()) | ||
|
||
return assembled_tags |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue Per discussion on the working group call today, we are going to add these fields directly to
Primer
(and maybe rename the class toOligo
or similar)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have documented this because I just bumped up against why I defaulted them both to
None
in the first place-- if you specify the default weights for either task, then Primer3 uses those weights as part of your scoring function, and it will complain if the corresponding params are not there, because it has no delta-off-optimal to score.