Conversation
…d to check tests Add recombinase assembly algorithm for attB/attP
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## master #564 +/- ##
==========================================
+ Coverage 93.56% 93.75% +0.18%
==========================================
Files 37 38 +1
Lines 5302 5424 +122
Branches 748 763 +15
==========================================
+ Hits 4961 5085 +124
+ Misses 267 265 -2
Partials 74 74
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request implements generalized recombinase functionality for pydna, addressing issue #435 and building upon PR #496. The changes introduce a new recombinase module that provides a flexible framework for simulating site-specific recombination reactions, and refactors the existing Gateway cloning functionality to use this new module.
Changes:
- Added new
src/pydna/recombinase.pymodule withRecombinaseandRecombinaseCollectionclasses for generic recombinase operations - Refactored
src/pydna/gateway.pyto use the new recombinase infrastructure, converting site definitions to use lowercase notation for homology cores - Added
recombinase_integration()andrecombinase_excision()functions tosrc/pydna/assembly2.py - Added comprehensive test suite in
tests/test_module_recombinase.pycovering various scenarios - Added
RecombinaseSourceclass tosrc/pydna/opencloning_models.pyfor provenance tracking - Updated test expectations in
tests/test_module_assembly2.pyto reflect new site ordering behavior
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pydna/recombinase.py | New module implementing generic recombinase functionality with support for site finding, annotation, and overlap detection |
| src/pydna/gateway.py | Refactored to use new Recombinase classes, simplified by delegating to RecombinaseCollection |
| src/pydna/assembly2.py | Added recombinase_integration and recombinase_excision functions, plus minor fixes to SingleFragmentAssembly |
| src/pydna/opencloning_models.py | Added RecombinaseSource class for tracking recombinase-based assemblies |
| tests/test_module_recombinase.py | Comprehensive test suite for the new recombinase module |
| tests/test_module_assembly2.py | Updated expected error message to reflect new site ordering |
Comments suppressed due to low confidence (3)
src/pydna/assembly2.py:1974
- The comment states "Remove matches where the whole sequence matches", but this filtering removes matches where the match length equals the fragment length. For recombinase reactions, this makes sense (you don't want the entire sequence to match itself), but it's worth noting this is a semantic change from the previous behavior. Consider adding a more detailed comment explaining why full-length matches need to be filtered out for recombinase assembly, as this might not be immediately obvious to future maintainers.
# Remove matches where the whole sequence matches
matches = [match for match in matches if match[2] != len(frag)]
src/pydna/recombinase.py:140
- Missing space in error message. Should be "Recombinase recognition site is not in the expected format. Expected format:" with a space before "Expected".
raise ValueError(
"Recombinase recognition site is not in the expected format."
"Expected format: [A-Z]+[a-z]+[A-Z]+, e.g. 'ATGCCCTAAaaTT'"
)
src/pydna/recombinase.py:189
- Missing space in error message. Should be "Recombinase recognition sites do not have matching homology cores. Expected" with a space before "Expected".
raise ValueError(
"Recombinase recognition sites do not have matching homology cores."
f"Expected {site1[off1:off1 + len1]} == {site2[off2:off2 + len2]}"
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hey @BjornFJohansson I am merging this, as it does not touch existing code, and I need to make a separate PR to have the latest biopython. |
Closes #435 and completes #496
cc @BjornFJohansson please have a look at the docs of the new module here
It works for attB / attP - like recombinases, but perhaps I am missing something