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

Merge Primer*Weights into Primer3Parameters, remove Primer3Input #112

Merged
merged 7 commits into from
Jan 21, 2025

Conversation

nh13
Copy link
Member

@nh13 nh13 commented Jan 15, 2025

  1. merges the Primer*Weights classes into their corresponding amplicon and probe parameter classes (reduces 4 classes to two). The attributes have the _wt suffix in their name. The primer3.primer3.primer3_weights module is gone.
  2. moves the Primer3Input functionality into Primer3 directly. primer3.primer3.primer3_input is now gone.
  3. Adds in WeightRange for the weights when a value is out of range (either less than, or greater than). Could use a better name?
  4. Primer3.design now explicitly takes in the design task and target, in addition to the params. It checks to make sure that the task (e.g. design left primers) matches the params (e.g. amplicons).
  5. Simplify Primer3Task (remove methods no longer used)

@nh13 nh13 requested a review from tfenne as a code owner January 15, 2025 23:10
prymer/primer3/primer3_parameters.py Outdated Show resolved Hide resolved
prymer/primer3/primer3_parameters.py Outdated Show resolved Hide resolved
prymer/primer3/primer3_parameters.py Outdated Show resolved Hide resolved
prymer/primer3/primer3_parameters.py Outdated Show resolved Hide resolved
): # if the right primer has too many dinucleotide bases, fail it
dinuc_pair_failures.append(primer_pair.right_primer)
valid = False
if valid: # if neither failed, append the pair to a list of valid designs
valid_primer_pair_designs.append(primer_pair)
return valid_primer_pair_designs, dinuc_pair_failures

def design(self, design_input: Primer3Input) -> Primer3Result: # noqa: C901
def design(self, design_input: Primer3Parameters) -> Primer3Result: # noqa: C901
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would need to take:

amplicon_parameters: AmpliconParameters | None, probe_parameter: ProbeParameters | None

What you have works for the current set of use cases, but one primer3 task we haven't implemented yet supports designing primer pairs and probes concurrently, and then you need both sets of parameters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave it for now, and we can decide later if we want to have two parameters to design, or to create a third parameters class:

class AmpliconAndProbeParameters(Primer3Parameters):
    amplicon_params: AmpliconParams
    probe_params: ProbeParams

@nh13 nh13 requested a review from tfenne January 16, 2025 02:18
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 87.32394% with 9 lines in your changes missing coverage. Please review.

Project coverage is 96.95%. Comparing base (4348446) to head (52f6dda).
Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
prymer/primer3/primer3.py 71.42% 3 Missing and 3 partials ⚠️
prymer/primer3/primer3_parameters.py 91.42% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #112      +/-   ##
==========================================
- Coverage   97.37%   96.95%   -0.42%     
==========================================
  Files          20       18       -2     
  Lines        1635     1575      -60     
  Branches      188      184       -4     
==========================================
- Hits         1592     1527      -65     
- Misses         24       27       +3     
- Partials       19       21       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nh13 nh13 changed the title WIP: merge weights with params Merge Primer*Weights into Primer3Parameters, remove Primer3Input Jan 16, 2025
@@ -731,29 +754,3 @@ def _check_design_results(design_input: Primer3Input, design_results: dict[str,
count: int = int(maybe_count)

return count


def _has_acceptable_dinuc_run(design_input: Primer3Input, oligo_design: Oligo) -> bool:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I inlined this

Copy link
Member

@tfenne tfenne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nit-picking on naming but happy to merge once that's addressed!

prymer/api/picking.py Outdated Show resolved Hide resolved
prymer/model.py Outdated Show resolved Hide resolved
@nh13 nh13 merged commit 8e1de20 into dev Jan 21, 2025
3 of 5 checks passed
@nh13 nh13 deleted the feat/params-ex1 branch January 21, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants