Skip to content

Commit

Permalink
Add check for amplicon size too small.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfenne committed Nov 18, 2024
1 parent f560ff8 commit ebc72f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion prymer/api/picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def build_primer_pairs(
for rp in right_primers:
amp_span = PrimerPair.calculate_amplicon_span(lp, rp)

if amp_span.length > amplicon_sizes.max:
# Ignore pairings with amplicon sizes out of the range specified
if not amplicon_sizes.min <= amp_span.length <= amplicon_sizes.max:
continue

# Since the amplicon span and the region_start are both 1-based, the minuend
Expand Down
1 change: 1 addition & 0 deletions tests/api/test_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def test_build_primers_amplicon_size_filtering(
assert pair.amplicon.end == pair.right_primer.span.end
assert pair.bases == REF_BASES[pair.amplicon.start - 1 : pair.amplicon.end]
assert pair.span.length <= 200
assert pair.span.length >= 100


def test_build_primers_heterodimer_filtering(
Expand Down

0 comments on commit ebc72f7

Please sign in to comment.