Skip to content

Generalised recombinase functionality#564

Open
manulera wants to merge 10 commits intomasterfrom
issue_435
Open

Generalised recombinase functionality#564
manulera wants to merge 10 commits intomasterfrom
issue_435

Conversation

@manulera
Copy link
Collaborator

@manulera manulera commented Feb 25, 2026

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

@manulera manulera requested review from BjornFJohansson and Copilot and removed request for Copilot February 25, 2026 17:33
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #564      +/-   ##
==========================================
+ Coverage   93.56%   93.80%   +0.23%     
==========================================
  Files          37       38       +1     
  Lines        5302     5394      +92     
  Branches      748      757       +9     
==========================================
+ Hits         4961     5060      +99     
+ Misses        267      261       -6     
+ Partials       74       73       -1     
Files with missing lines Coverage Δ
src/pydna/assembly2.py 97.41% <100.00%> (+0.04%) ⬆️
src/pydna/gateway.py 100.00% <100.00%> (+12.06%) ⬆️
src/pydna/opencloning_models.py 98.61% <100.00%> (+<0.01%) ⬆️
src/pydna/recombinase.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py module with Recombinase and RecombinaseCollection classes for generic recombinase operations
  • Refactored src/pydna/gateway.py to use the new recombinase infrastructure, converting site definitions to use lowercase notation for homology cores
  • Added recombinase_integration() and recombinase_excision() functions to src/pydna/assembly2.py
  • Added comprehensive test suite in tests/test_module_recombinase.py covering various scenarios
  • Added RecombinaseSource class to src/pydna/opencloning_models.py for provenance tracking
  • Updated test expectations in tests/test_module_assembly2.py to 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generalised integrase functionality

3 participants