Repository navigation
Semi specific digestion - #8130
Conversation
… use it within its child Protease Digestion; expand ProteaseDigestion_test; expand ProteaseDigestion python binding test and move it from test000.py to new test_ProteaseDigestion.py
WalkthroughThe changes introduce support for semi-specific digestion in the ProteaseDigestion module, including a new internal method for generating semi-specific peptides, updates to documentation, and expanded unit tests. The changelog and authorship information are updated, and Python bindings and tests are enhanced to reflect and verify the new semi-specific digestion functionality. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ProteaseDigestion
participant EnzymaticDigestion
User->>ProteaseDigestion: setSpecificity(SPEC_SEMI)
User->>ProteaseDigestion: digest(sequence)
ProteaseDigestion->>EnzymaticDigestion: tokenize cleavage sites
ProteaseDigestion->>EnzymaticDigestion: generate missed cleavage variants
ProteaseDigestion->>EnzymaticDigestion: semiSpecificDigestion_(positions, ...)
EnzymaticDigestion-->>ProteaseDigestion: semi-specific peptides
ProteaseDigestion-->>User: all peptides (fully and semi-specific)
Estimated code review effort3 (30–60 minutes) Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
cbielow
left a comment
There was a problem hiding this comment.
nice addition, thanks!
some comments below
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (8)
src/openms/include/OpenMS/CHEMISTRY/ProteaseDigestion.h (1)
52-54: Documentation update looks good.The expanded documentation clearly explains the semi-specific digestion behavior and provides the specific value (1) for SPEC_SEMI. This addresses the user's need to understand how to enable semi-specific digestion.
However, as mentioned in the past review comment, the documentation for the first
digestmethod (line 49) should also be updated to reference this detailed explanation, as it's just a wrapper method.src/openms/source/CHEMISTRY/ProteaseDigestion.cpp (1)
142-148: Add validation for specificity values.The implementation only handles
SPEC_SEMIbut doesn't validate that the specificity is supported. According to the past review comment, you should test for specificity and throw an exception unless it'sSEMIorFULL.Add validation before the semi-specific block:
+ // Validate specificity + if (specificity_ != SPEC_FULL && specificity_ != SPEC_SEMI) + { + throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, + "Unsupported specificity: " + String(specificity_), String(specificity_)); + } + // semi-specific variants if (specificity_ == SPEC_SEMI)src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (1)
39-40: Add test for unsupported specificity.According to the past review comment, you should test the new exception for unsupported specificity values like
SPEC_UNKNOWN.Add a test for unsupported specificity after line 40:
# MHAR, LVP, HAR, LV, AR, L, R, MHA, VP, MH, P, M assert len(output) == 12 + + # Test unsupported specificity + ff.setSpecificity(3) # SPEC_UNKNOWN + try: + ff.digest(seq, output) + assert False, "Should have thrown exception for unsupported specificity" + except Exception as e: + assert "Unsupported specificity" in str(e)src/openms/include/OpenMS/CHEMISTRY/EnzymaticDigestion.h (1)
182-195: Improve method documentation.The method declaration is well-structured, but the documentation could be more specific about the behavior regarding fully-specific variants and missed cleavages.
According to the past review comments, please clarify:
- Will it skip fully specific variants?
- Will it take missed cleavages into account?
Update the documentation to be more explicit:
/** @brief Generates semi-specific digestion products - Function handling semi-specific digestion (specificity == 1). + Function handling semi-specific digestion (specificity_ == Specificity::SPEC_SEMI). It is intended for calling after tokenizing and missed cleavages variants generation. + + This function generates semi-specific variants by allowing non-specific cleavage + at one end while maintaining enzymatic specificity at the other end. It does not + generate fully-specific variants (those are handled separately) and respects the + missed cleavages settings.src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp (2)
238-242: Improve lambda function signature.The lambda function declaration can be improved as suggested in the past review comment.
Apply the suggested improvement:
- auto compare_aa = [&ref](AASequence seq) -> bool + auto compare_aa = [&ref](const AASequence& seq) -> bool
261-261: Consider using TEST_TRUE/TEST_FALSE macros.As suggested in the past review comments, you could use the OpenMS test macros for better consistency.
Consider replacing the explicit boolean comparisons:
- TEST_EQUAL(std::find_if(out.begin(),out.end(),compare_aa) != out.end(), true); + TEST_TRUE(std::find_if(out.begin(),out.end(),compare_aa) != out.end());- TEST_NOT_EQUAL(std::find_if(out.begin(),out.end(),compare_aa) != out.end(), true); + TEST_FALSE(std::find_if(out.begin(),out.end(),compare_aa) != out.end());Also applies to: 267-267
src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp (2)
135-136: Remove unnecessary std::abs call.Since the lambda is called with positions where
x < yby design (forward iteration starts from beginning, backward from end), thestd::abscall is redundant.- if (min_length <= std::abs((int)y - (int)x) && - max_length >= std::abs((int)y - (int)x)) + if (min_length <= (y - x) && + max_length >= (y - x))
144-144: Add safety check for cleavage_positions size.The increment operations on iterators could cause undefined behavior if
cleavage_positionshas fewer than 2 elements. Consider adding a check at the beginning of the function.Size EnzymaticDigestion::semiSpecificDigestion_(const std::vector<int>& cleavage_positions, std::vector<std::pair<Size, Size>>& output, Size min_length, Size max_length) const { + if (cleavage_positions.size() < 2) + { + return 0; + } int mc = missed_cleavages_; Size wrong = 0;
🧹 Nitpick comments (5)
CHANGELOG (2)
32-34: Style: keep wording and enumeration value out of the public changelog.“SPEC_SEMI (1)” leaks the concrete enum value and clutters the entry. Other bullets only name the symbolic constant.
Proposed wording:- - add support for semi-specific digestion in objects where specificity is set to SPEC_SEMI (1) + - add support for semi-specific digestion when specificity is set to `SPEC_SEMI`This keeps the changelog concise and future-proof if the enum values ever change.
45-46: Minor consistency tweak: match existing naming pattern.Elsewhere the changelog uses “::” for fully-qualified symbols (e.g.
EnzymaticDigestion::isValidProduct).
For consistency consider:- - Added `EnzymaticDigestion.semiSpecificDigestion_()` + - Added `EnzymaticDigestion::semiSpecificDigestion_()`Purely cosmetic, but keeps symbol references uniform across sections.
src/pyOpenMS/pxds/ProteaseDigestion.pxd (2)
20-22: Use the enumeration constant instead of magic value in docs
The term “semi-specific” is clear, yet referring to it via the raw value1risks divergence if the enum ever changes. Prefer the symbolic constant exposed by the bindings (e.g.EnzymaticDigestion.SPEC_SEMI) in the docs to keep the example self-explanatory.-# If specificity is set to semi-specific, digestion also returns semi-specific products, -# i.e. with only one end at actual cleavage sites. +# If specificity is set to ``EnzymaticDigestion.SPEC_SEMI`` (value ``1``), +# digestion also returns semi-specific products, i.e. peptides with exactly one +# terminus at a canonical cleavage site.
51-55: Replace hard-coded “1” with the enum constant in the code snippet
Using the explicit enum improves readability and guards against future enum re-ordering.-# dig.setSpecificity(1) +# dig.setSpecificity(EnzymaticDigestion.SPEC_SEMI)src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (1)
47-50: Improve boolean comparison style.The static analysis correctly flags these equality comparisons with boolean literals as poor style.
Apply these changes to improve readability:
- assert ff.isValidProduct(seq, 0, 4) == True + assert ff.isValidProduct(seq, 0, 4) - assert ff.isValidProduct(seq, 3, 4) == False + assert not ff.isValidProduct(seq, 3, 4) - assert ff.isValidProduct(seq, 1, 3) == True + assert ff.isValidProduct(seq, 1, 3)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
AUTHORS(1 hunks)CHANGELOG(2 hunks)src/openms/include/OpenMS/CHEMISTRY/EnzymaticDigestion.h(2 hunks)src/openms/include/OpenMS/CHEMISTRY/ProteaseDigestion.h(1 hunks)src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp(2 hunks)src/openms/source/CHEMISTRY/ProteaseDigestion.cpp(1 hunks)src/pyOpenMS/CMakeLists.txt(1 hunks)src/pyOpenMS/pxds/ProteaseDigestion.pxd(2 hunks)src/pyOpenMS/tests/unittests/test000.py(1 hunks)src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py(1 hunks)src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/pyOpenMS/tests/unittests/test000.py (2)
undefined
<retrieved_learning>
Learnt from: FreezB11
PR: #7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:1-3
Timestamp: 2025-06-16T15:49:26.504Z
Learning: In OpenMS Python bindings (.pxd files), derived quantitation method classes like TMTThirtyTwoPlexQuantitationMethod only need to declare their constructors. All other public methods (getName, getChannelInformation, getNumberOfChannels, getIsotopeCorrectionMatrix, getReferenceChannel) are inherited from the base IsobaricQuantitationMethod class and don't need to be redeclared explicitly.
</retrieved_learning>
<retrieved_learning>
Learnt from: FreezB11
PR: #7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.
</retrieved_learning>
🧬 Code Graph Analysis (2)
src/openms/source/CHEMISTRY/ProteaseDigestion.cpp (1)
src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp (2)
semiSpecificDigestion_(118-175)semiSpecificDigestion_(118-118)
src/openms/include/OpenMS/CHEMISTRY/EnzymaticDigestion.h (1)
src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp (2)
semiSpecificDigestion_(118-175)semiSpecificDigestion_(118-118)
🪛 Ruff (0.12.2)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py
11-11: Undefined name report
(F821)
31-31: Undefined name AASequence
(F821)
47-47: Avoid equality comparisons to True; use ff.isValidProduct(seq, 0, 4): for truth checks
Replace with ff.isValidProduct(seq, 0, 4)
(E712)
48-48: Avoid equality comparisons to False; use not ff.isValidProduct(seq, 3, 4): for false checks
Replace with not ff.isValidProduct(seq, 3, 4)
(E712)
50-50: Avoid equality comparisons to True; use ff.isValidProduct(seq, 1, 3): for truth checks
Replace with ff.isValidProduct(seq, 1, 3)
(E712)
🔇 Additional comments (7)
AUTHORS (1)
55-56: Author entry looks good – alphabetical order preserved.Entry is correctly inserted between "Jang Jang Jin" and "Jihyung Kim".
No further action required.src/pyOpenMS/CMakeLists.txt (1)
573-579: Do not removetest000.py—it contains active tests
test000.pyisn’t an obsolete placeholder but a large, catch-all test module with dozens of activedef test_*()functions (e.g.,test_AcquisitionInfo(),test_MapConversion(),test_BSpline2d(), etc.). Removing it would drop substantial coverage.•
src/pyOpenMS/tests/unittests/test000.pydefines many critical tests and must remain.
• Your newtest_ProteaseDigestion.pyis fine—just ensure its tests don’t duplicate those already intest000.py.
• If you want to break uptest000.pyfor clarity, consider refactoring its contents into smaller, feature-specific files rather than deleting it outright.Likely an incorrect or invalid review comment.
src/pyOpenMS/tests/unittests/test000.py (1)
3-10: Header metadata looks fine – nothing actionable.Only header/comment lines were touched. No functional changes in the test suite to review here.
src/openms/include/OpenMS/CHEMISTRY/EnzymaticDigestion.h (1)
6-6: Author addition looks good.The addition of "Jeremi Maciejewski" to the authors list is appropriate for this contribution.
src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp (2)
16-16: Algorithm include addition is appropriate.The
<algorithm>include is needed for thestd::find_iffunction used in the new tests.
231-290: Excellent comprehensive test coverage.The semi-specific digestion tests are thorough and cover all the important scenarios:
- Compatibility with unspecific cleavage
- Presence of fully-specific and semi-specific variants
- Correct cleavage site iteration order
- Missed cleavages handling
- Length constraints application
This provides good confidence in the implementation correctness.
src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp (1)
6-6: Author attribution looks good.Adding the contributor to the file header is appropriate for tracking contributions.
Expanded and reworded documentation, added some input data checks and exceptions to `ProteaseDigestion.digest()` and `EnzymaticDigestion.semiSpecificDigestion_()`, added some tests.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (1)
9-16: Fix missing imports to resolve runtime errors.The static analysis correctly identifies missing imports that will cause runtime errors.
Add the missing imports at the top of the file:
+from functools import wraps +from pyopenms.testutils import report import pyopenms - -def report(f): - @wraps(f) - def wrapper(*a, **kw): - print("run ", f.__name__) - f(*a, **kw) - return wrapper
🧹 Nitpick comments (3)
src/tests/class_tests/openms/source/EnzymaticDigestion_test.cpp (2)
285-310: Good start, but consider expanding test coverage.The test correctly uses a temporary subclass to expose the protected method and properly tests the exception case for empty cleavage positions. However, the test coverage could be more comprehensive.
Consider adding more test cases to verify:
- Normal operation with valid cleavage positions
- Edge cases with single cleavage position
- Boundary conditions for min/max length parameters
+ // Test normal operation + std::vector<int> valid_positions = {0, 3, 7}; + TEST_EQUAL(tmp.tmpSemiSpecificDigestion_(valid_positions, output, 1, 100) > 0, true); + + // Test single cleavage position + std::vector<int> single_position = {0, 5}; + output.clear(); + TEST_EQUAL(tmp.tmpSemiSpecificDigestion_(single_position, output, 1, 100) > 0, true);
303-303: Fix type inconsistency for OpenMS conventions.Use
Sizeinstead ofsize_tto maintain consistency with OpenMS conventions and the method signature.- std::vector<std::pair<size_t,size_t>> output = {}; + std::vector<std::pair<Size,Size>> output = {};src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (1)
54-57: Improve boolean comparison style.Follow PEP 8 conventions by using truthiness instead of explicit boolean comparisons.
- assert ff.isValidProduct(seq, 0, 4) == True + assert ff.isValidProduct(seq, 0, 4) - assert ff.isValidProduct(seq, 3, 4) == False + assert not ff.isValidProduct(seq, 3, 4) ff.setSpecificity(1) - assert ff.isValidProduct(seq, 1, 3) == True + assert ff.isValidProduct(seq, 1, 3)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/openms/include/OpenMS/CHEMISTRY/EnzymaticDigestion.h(2 hunks)src/openms/include/OpenMS/CHEMISTRY/ProteaseDigestion.h(2 hunks)src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp(2 hunks)src/openms/source/CHEMISTRY/ProteaseDigestion.cpp(2 hunks)src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py(1 hunks)src/tests/class_tests/openms/source/EnzymaticDigestion_test.cpp(2 hunks)src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- src/openms/include/OpenMS/CHEMISTRY/ProteaseDigestion.h
- src/openms/include/OpenMS/CHEMISTRY/EnzymaticDigestion.h
- src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp
- src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp
- src/openms/source/CHEMISTRY/ProteaseDigestion.cpp
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/tests/class_tests/openms/source/EnzymaticDigestion_test.cpp (2)
src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp (2)
semiSpecificDigestion_(118-183)semiSpecificDigestion_(118-118)src/openms/source/CONCEPT/Exception.cpp (1)
InvalidValue(224-228)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (2)
src/pyOpenMS/tests/unittests/test000.py (2)
report(38-43)wrapper(40-42)src/openms/source/CHEMISTRY/ProteaseDigestion.cpp (12)
setEnzyme(21-25)setEnzyme(21-21)digest(71-85)digest(71-71)digest(87-158)digest(87-87)peptideCount(48-69)peptideCount(48-48)isValidProduct(27-35)isValidProduct(27-32)isValidProduct(37-46)isValidProduct(37-42)
🪛 Ruff (0.12.2)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py
12-12: Undefined name wraps
(F821)
54-54: Avoid equality comparisons to True; use ff.isValidProduct(seq, 0, 4): for truth checks
Replace with ff.isValidProduct(seq, 0, 4)
(E712)
55-55: Avoid equality comparisons to False; use not ff.isValidProduct(seq, 3, 4): for false checks
Replace with not ff.isValidProduct(seq, 3, 4)
(E712)
57-57: Avoid equality comparisons to True; use ff.isValidProduct(seq, 1, 3): for truth checks
Replace with ff.isValidProduct(seq, 1, 3)
(E712)
🔇 Additional comments (3)
src/tests/class_tests/openms/source/EnzymaticDigestion_test.cpp (1)
6-6: LGTM! Author information properly updated.The addition of "Jeremi Maciejewski" to the authors list aligns with the PR objectives and follows the proper format.
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (2)
38-38: No additional import needed for AASequence.The usage
pyopenms.AASequence.fromString()is correct sincepyopenmsis imported. The past review comment suggesting a separate import forAASequenceis not necessary.
19-63: Excellent test coverage for ProteaseDigestion functionality.The test comprehensively covers the
ProteaseDigestionclass functionality, including:
- Constructor and enzyme setup
- Both full-specific and semi-specific digestion modes
- Peptide counting and validation
- Missed cleavage handling
The test logic is well-structured and aligns with the PR objectives for semi-specific digestion support.
Fixed invalid (not implemented) use of SPEC_NONE with `ProteaseDigestion::digest()` by functions `DecoyGenerator::reversePeptides()` and `DecoyGenerator::shufflePeptides()`. These now use `SPEC_FULL`, which should produce identical results as before - but perhaps this was not the behaviour intended?
…omparisons in tests.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/openms/source/CHEMISTRY/DecoyGenerator.cpp(2 hunks)src/pyOpenMS/pxds/ProteaseDigestion.pxd(2 hunks)src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py(1 hunks)src/tests/class_tests/openms/source/DecoyGenerator_test.cpp(1 hunks)src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/tests/class_tests/openms/source/DecoyGenerator_test.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
- src/tests/class_tests/openms/source/ProteaseDigestion_test.cpp
- src/pyOpenMS/pxds/ProteaseDigestion.pxd
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (3)
src/pyOpenMS/tests/unittests/test000.py (2)
report(38-43)wrapper(40-42)src/openms/source/CHEMISTRY/ProteaseDigestion.cpp (12)
setEnzyme(21-25)setEnzyme(21-21)digest(71-85)digest(71-71)digest(87-158)digest(87-87)peptideCount(48-69)peptideCount(48-48)isValidProduct(27-35)isValidProduct(27-32)isValidProduct(37-46)isValidProduct(37-42)src/openms/source/CHEMISTRY/EnzymaticDigestion.cpp (12)
setEnzyme(61-65)setEnzyme(61-61)getEnzymeName(67-70)getEnzymeName(67-67)setSpecificity(87-90)setSpecificity(87-87)isValidProduct(190-193)isValidProduct(190-190)getMissedCleavages(51-54)getMissedCleavages(51-51)setMissedCleavages(56-59)setMissedCleavages(56-56)
🪛 GitHub Check: CodeFactor
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py
[notice] 56-56: src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py#L56
Multiple spaces before operator. (E221)
[notice] 56-56: src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py#L56
Multiple spaces after keyword. (E271)
🪛 Ruff (0.12.2)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py
56-56: SyntaxError: Expected an expression
🔇 Additional comments (8)
src/openms/source/CHEMISTRY/DecoyGenerator.cpp (4)
45-45: LGTM: Enforcing full specificity for decoy generation.This change correctly enforces full enzymatic specificity during peptide reversal for decoy generation, ensuring that cleavage sites are respected and maintaining biological relevance of the decoy peptides.
73-73: LGTM: Consistent specificity enforcement in shuffling.This change mirrors the specificity enforcement in the reversePeptides function, ensuring consistent behavior across both decoy generation methods. Full specificity is appropriate here to maintain proper enzymatic cleavage patterns.
45-45: LGTM: Improved specificity enforcement for consistent decoy generation.The change from
SPEC_NONEtoSPEC_FULLensures that decoy peptides maintain the same enzymatic cleavage specificity as the original peptides, which is crucial for maintaining the quality and consistency of decoy generation.
73-73: LGTM: Consistent specificity enforcement across decoy generation methods.This change mirrors the improvement in
reversePeptides()and ensures that shuffled decoy peptides also maintain proper enzymatic specificity, providing consistency across all decoy generation approaches.src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (4)
44-48: Excellent test coverage for semi-specific digestion.This test correctly validates the semi-specific digestion functionality by:
- Setting specificity to semi-specific mode (1)
- Testing that the number of peptides increases significantly (from 2 to 12)
- Covering the expected peptide products from the sequence "MHARLVP"
The test aligns perfectly with the PR objectives for implementing semi-specific digestion support.
57-58: Good validation of specificity-dependent behavior.The test properly demonstrates that
isValidProductbehavior changes based on the specificity setting, showing that semi-specific mode (1) accepts products that full specificity (2) would reject.
20-64: Comprehensive test structure with good coverage.The test function provides excellent coverage of the ProteaseDigestion class functionality:
- Constructor and method availability checks
- Enzyme setting and retrieval
- Digestion with different specificity modes
- Peptide counting and validation
- Missed cleavage handling
The docstring clearly documents what's being tested, making it easy to understand the test scope.
20-64: Excellent test coverage for ProteaseDigestion functionality.The test comprehensively covers the key methods and the new semi-specific digestion feature. The expected peptide counts (2 for full specificity, 12 for semi-specific) appear reasonable for the test sequence "MHARLVP", and the test structure is well-organized with clear documentation.
…ator `not` for negation.
…tion_; missing documentation; additional tests; fix pyOpenMS tests
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.12.2)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py
55-55: Undefined name true
(F821)
55-55: Undefined name false
(F821)
55-55: Undefined name false
(F821)
56-56: Undefined name true
(F821)
56-56: Undefined name false
(F821)
56-56: Undefined name false
(F821)
58-58: Undefined name true
(F821)
58-58: Undefined name false
(F821)
58-58: Undefined name false
(F821)
🔇 Additional comments (5)
src/pyOpenMS/tests/unittests/test_ProteaseDigestion.py (5)
1-11: LGTM! Imports and file header are correct.The imports are properly structured and the file header follows the project conventions.
12-17: Well-implemented decorator function.The report decorator properly uses
functools.wrapsto preserve function metadata and follows standard Python decorator patterns.
19-37: Excellent test structure and documentation.The test function is well-documented with a comprehensive docstring and follows good testing practices with method existence checks and enzyme setup verification.
38-54: Comprehensive test coverage for digestion functionality.The test effectively covers both fully-specific and semi-specific digestion modes. The expected peptide counts (2 vs 12) align well with the semi-specific digestion feature being introduced.
60-64: Proper testing of missed cleavages functionality.The getter/setter test for missed cleavages is well-implemented and verifies the functionality correctly.
0764851 to
561f69d
Compare
561f69d to
ee62177
Compare
Description
These changes implement support of performing semi-specific digestion to ProteaseDigestion, as requested in #8098 .
Also exposed via pyOpenMS.
Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkinswill retrigger Jenkins-based CI buildsSummary by CodeRabbit
New Features
Documentation
Tests
Chores