diff --git a/prymer/api/picking.py b/prymer/api/picking.py index 796628e..fa00ae2 100644 --- a/prymer/api/picking.py +++ b/prymer/api/picking.py @@ -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 diff --git a/tests/api/test_picking.py b/tests/api/test_picking.py index cdb5da0..e69e5d0 100644 --- a/tests/api/test_picking.py +++ b/tests/api/test_picking.py @@ -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(