Skip to content

[FIX] DigestionEnzyme: close cleavage regex groups (#10569) - #10573

Merged
timosachsenberg merged 4 commits into
developfrom
claude/fix-10569-digestionenzyme-regex
Oct 14, 2026
Merged

timosachsenberg merged 4 commits into
developfrom
claude/fix-10569-digestionenzyme-regex

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

The DigestionEnzyme(name, cut_before, nocut_after, sense) constructor
built regexes with unclosed groups, e.g. KR/P/C gave "(?<=KRX"
and D/N gave "(?=[DX]", none of which compile. The C-sense form now
matches the database enzymes (Trypsin: "(?<=[KRX])(?!P)"); a
multi-residue no-cut becomes a class, e.g. "(?![PD])".

DigestionEnzyme_test now asserts the exact regexes for C/N sense with
and without no-cut residues and digests sequences with each of them.

Fixes #10569

Co-Authored-By: Claude Opus 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01TjVGL63sfAtrbdztXy6Ato

Summary by CodeRabbit

  • Bug Fixes
    • Fixed cleavage-rule handling in digestion enzymes, preventing regular-expression compilation failures for certain residue combinations.
    • Improved recognition of C-terminal and N-terminal cleavage sites, including rules with multiple blocked residues. This helps produce expected peptide digestion results when cleavage sites are restricted.

The DigestionEnzyme(name, cut_before, nocut_after, sense) constructor
built regexes with unclosed groups, e.g. KR/P/C gave "(?<=[KRX](?!P])"
and D/N gave "(?=[DX]", none of which compile. The C-sense form now
matches the database enzymes (Trypsin: "(?<=[KRX])(?!P)"); a
multi-residue no-cut becomes a class, e.g. "(?![PD])".

DigestionEnzyme_test now asserts the exact regexes for C/N sense with
and without no-cut residues and digests sequences with each of them.

Fixes #10569

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TjVGL63sfAtrbdztXy6Ato
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48f3a1eb-fc89-445e-ae02-bf4f7a985981
📥 Commits

Reviewing files that changed from the base of the PR and between 68f8219 and 46f7271.

📒 Files selected for processing: 4
  • CHANGELOG
  • src/openms/source/CHEMISTRY/DigestionEnzyme.cpp
  • src/tests/class_tests/openms/source/DigestionEnzyme_test.cpp
  • src/tests/class_tests/openms/source/PepXMLFile_test.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

DigestionEnzyme now generates closed cleavage regex groups for C-terminal and N-terminal digestion. Tests assert exact regex strings and digestion results, and the changelog records the correction.

Changes: DigestionEnzyme Regex Fix

Layer / File(s) Summary
Regex construction and digestion validation
src/openms/source/CHEMISTRY/DigestionEnzyme.cpp, src/tests/class_tests/openms/source/DigestionEnzyme_test.cpp, src/tests/class_tests/openms/source/PepXMLFile_test.cpp, CHANGELOG
C-terminal and N-terminal cleavage regexes now close their groups. Tests assert exact generated regexes, check digestion output, and verify the pepXML-related regex. The changelog records the correction.

Suggested reviewers: cbielow

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 46f72

The regex correction and its tests present no identified issue requiring resolution before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: fixing unclosed cleavage regex groups in DigestionEnzyme. It is specific, concise, and related to the changeset.
Linked Issues check Passed The changes satisfy #10569. DigestionEnzyme.cpp now closes the C-sense lookbehind and the N-sense lookahead. It emits a separate negative lookahead for one C-sense no-cut residue and a character-cla…
Out of Scope Changes check Passed The changes stay within #10569. The implementation fixes regex construction. DigestionEnzyme_test verifies the generated regexes and digestion behavior. PepXMLFile_test strengthens the related use…
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks each bracket’s place
And finds the regex closed with grace
The peptides part along the line
While test results align just fine
The changelog notes the fix in time
Then hops away, content and dry

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg
timosachsenberg merged commit 021e0fb into develop Oct 14, 2026
11 of 13 checks passed
@timosachsenberg
timosachsenberg deleted the claude/fix-10569-digestionenzyme-regex branch October 14, 2026 18:14
timosachsenberg pushed a commit that referenced this pull request Oct 14, 2026
… regex, #10567 negative-mode ion mobility)

#10568 adds a test that a reference set before align() keys adducted
oligonucleotide matches with their adduct; it is ported to the owning
model (an oligonucleotide run whose matches carry the sodium adduct of
the ion, as NucleicAcidSearchEngine stores it). Without the fix it fails
here too (0 instead of 5 alignment points).

Conflict: CHANGELOG (both entries kept; the #10568 entry speaks of
identification data input instead of .oms, which this branch removes).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
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.

DigestionEnzyme(name, cut, no_cut, sense) builds invalid cleavage regexes (groups never closed)

3 participants