-
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: allow for left/right primer hits to overlap when building primer pair hits with OverlapDetector
#102
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #102 +/- ##
=======================================
Coverage 96.81% 96.82%
=======================================
Files 26 26
Lines 1789 1794 +5
Branches 215 216 +1
=======================================
+ Hits 1732 1737 +5
Misses 31 31
Partials 26 26 ☔ View full report in Codecov by Sentry. |
dce889a
to
434218d
Compare
434218d
to
e39670e
Compare
1a61cb0
to
c9075ac
Compare
cfaca8f
to
22fc66f
Compare
I agree - I implemented it this way with the intention of not making a breaking change, but I think a user is more likely to not care too much if the primers overlap a bit so long as they get a long enough amplicon. |
…sing min amplicon size parameter
22fc66f
to
6ccafec
Compare
@@ -165,13 +165,13 @@ def build_primer_pairs( # noqa: C901 | |||
|
|||
# If the right primer isn't "to the right" of the left primer, move on |
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.
These changes were from linting.
WalkthroughThe pull request introduces modifications to the off-target detection functionality in the Prymer library. The changes primarily focus on enhancing the Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
prymer/api/picking.py
(1 hunks)prymer/offtarget/offtarget_detector.py
(11 hunks)tests/offtarget/test_offtarget.py
(7 hunks)
✅ Files skipped from review due to trivial changes (1)
- prymer/api/picking.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Tests (3.12)
- GitHub Check: Tests (3.11)
🔇 Additional comments (1)
tests/offtarget/test_offtarget.py (1)
288-294
: Tests updated appropriately.The tests correctly incorporate the new parameters, ensuring proper coverage for
min_amplicon_size
andallow_overlapping_hits
.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
prymer/offtarget/offtarget_detector.py (1)
643-651
: Consider extracting the amplicon validation logic.The amplicon length and overlap validation logic could be moved to a separate method for better readability.
def _to_amplicons(...): + def _is_valid_amplicon(pos_hit: BwaHit, neg_hit: BwaHit) -> bool: + amplicon_length = neg_hit.end - pos_hit.start + 1 + return (min_len <= amplicon_length <= max_len and + (allow_overlapping_hits or neg_hit.start > pos_hit.end)) + ... for positive_hit in positive_hits_sorted: for negative_hit_index, negative_hit in enumerate(...): - amplicon_length: int = negative_hit.end - positive_hit.start + 1 - if min_len <= amplicon_length <= max_len and ( - allow_overlapping_hits or negative_hit.start > positive_hit.end - ): + if _is_valid_amplicon(positive_hit, negative_hit): amplicons.append(...)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
prymer/offtarget/offtarget_detector.py
(11 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Tests (3.12)
- GitHub Check: Tests (3.11)
🔇 Additional comments (4)
prymer/offtarget/offtarget_detector.py (4)
174-176
: LGTM! Parameter additions are well-structured.The new parameters
min_amplicon_size
andallow_overlapping_hits
are added with appropriate default values.
231-237
: LGTM! Clear and comprehensive docstring updates.The documentation for new parameters is thorough and explains the interaction between
min_amplicon_size
andallow_overlapping_hits
.
262-266
: LGTM! Robust parameter validation.The validation logic for
min_amplicon_size
ensures it falls within valid bounds (1 to max_amplicon_size).
381-383
: LGTM! Clear documentation of overlapping hits behavior.The docstring clearly explains how
allow_overlapping_hits
affects amplicon detection.
See discussion.
The code before this PR does not return primer pair hits where the hits to the left and right primers overlap, and does not specify a minimum acceptable amplicon size.
This change adds two new parameters to the
OffTargetDetector
to address this:allow_overlapping_hits
- defaults toFalse
to maintain current behaviour. If this is set toTrue
, then primer pair hits where the left and right primer hits overlap are allowed, as long as they meet the acceptable amplicon size criteria.min_amplicon_size
- defaults to1
to maintain current behaviour, and is overridden byallow_overlapping_hits=False
.