From df84e88fb3ebd0ce0037aff8cfe43d69c5dcd549 Mon Sep 17 00:00:00 2001 From: tfenne Date: Thu, 14 Nov 2024 16:41:52 -0700 Subject: [PATCH] Add check for amplicon size too small. --- prymer/api/picking.py | 3 ++- tests/api/test_picking.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/prymer/api/picking.py b/prymer/api/picking.py index 1315881..ea04839 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 amp_bases = bases[amp_span.start - region_start : amp_span.end - region_start + 1] 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(