Skip to content

[FIX] Correct RNA terminal fragment and adduct masses - #10515

Merged
poshul merged 4 commits into
OpenMS:developfrom
poshul:fix/rna-fragment-adduct-masses
Oct 11, 2026
Merged

poshul merged 4 commits into
OpenMS:developfrom
poshul:fix/rna-fragment-adduct-masses

Conversation

@poshul

@poshul poshul commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

RNA theoretical spectra omitted the 5-prime terminal contribution from a1-B, and getMultipleSpectra used an advanced loop charge for its final precursor peak. This fixes the a1-B mass and uses each requested precursor charge for both m/z and annotation. RNA mzTab export also adds the assigned adduct mass shift before converting mass to m/z.

Formula-derived regressions cover both ion polarities and requested precursor charges 2/3, and an assigned sodium-adduct mzTab row. Python tests exercise the terminal fragment through the existing binding; public APIs and defaults are unchanged. This PR is independent of the other NASE changes and targets develop.

Validation: built and passed NucleicAcidSpectrumGenerator_test, IdentificationDataConverter_test, and NASequence_test; rebuilt pyOpenMS and passed all 13 cases in test_ChemistryBindings.py, including both RNA terminal-fragment polarities, in the Linux Release validation container.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (existing APIs unchanged; Python regressions added)

Summary by CodeRabbit

  • Bug Fixes
    • Corrected the mass of RNA a1-B fragments to account for 5′-terminal modifications.
    • Corrected precursor peak charge and m/z values when retrieving spectra for requested charge states.
    • Corrected calculated RNA masses in mzTab exports for matches with adducts.

@poshul
poshul marked this pull request as ready for review October 11, 2026 11:16
@poshul
poshul enabled auto-merge (squash) October 11, 2026 11:16
@poshul
poshul requested a balanced review from Copilot October 11, 2026 11:17
@coderabbitai

coderabbitai Bot commented Oct 11, 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: 7644855a-f6b1-475f-b365-41f16b47af67

📥 Commits

Reviewing files that changed from the base of the PR and between 5006595 and 98aa034.


📒 Files selected for processing (2)
  • CHANGELOG
  • src/pyOpenMS/tests/unittests/test_ChemistryBindings.py

🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG

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

Walkthrough

RNA spectrum generation now includes five-prime modification mass in the first a1-B ion and uses the requested charge for precursor peaks. RNA mzTab export includes an assigned adduct’s mass shift in the calculated oligonucleotide mass.

Changes

RNA Spectrum Generation

Layer / File(s) Summary
Fragment and precursor masses
src/openms/source/CHEMISTRY/NucleicAcidSpectrumGenerator.cpp, src/tests/class_tests/openms/source/NucleicAcidSpectrumGenerator_test.cpp, src/pyOpenMS/tests/unittests/test_ChemistryBindings.py, CHANGELOG
The first a1-B ion includes the five-prime modification mass. getMultipleSpectra uses the requested charge for precursor m/z and charge metadata in both modes. C++ and Python tests cover these behaviors. The changelog records the spectrum and mzTab corrections.

RNA mzTab Export

Layer / File(s) Summary
Adduct-adjusted calculated m/z
src/openms/source/METADATA/ID/IdentificationDataConverter.cpp, src/tests/class_tests/openms/source/IdentificationDataConverter_test.cpp
RNA mzTab export adds an assigned adduct’s mass shift to the calculated oligonucleotide mass. The test checks the exported m/z for a sodium adduct.

Suggested reviewers: timosachsenberg


Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 98aa0

RNA fragment and precursor masses and adduct-adjusted mzTab values now match the intended calculations, with targeted regressions. No actionable merge risk is apparent.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 6 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 is concise and accurately identifies the main RNA mass corrections. It covers the terminal fragment and adduct mass fixes, although it does not mention the precursor charge correction.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

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


  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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 the peaks at night,
The phosphate mass now lands just right.
Requested charges mark each trace,
Sodium shifts find their place.
The changelog joins the burrow’s song,
And test cases hop along.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused corrections are consistent with existing mass conventions and have targeted regression coverage.

0 open findings

What changed in this PR

Fixes RNA terminal-fragment, precursor-charge, and adduct-aware mzTab mass calculations.

Changes:

  • Includes 5′ modifications in a1-B fragment masses.
  • Uses the requested charge for final precursor peaks.
  • Adds assigned adduct shifts to RNA mzTab calculated m/z values, with C++ and Python regressions.
File Description
CHANGELOG Documents the fixes.
src/​openms/​source/​CHEMISTRY/​NucleicAcidSpectrumGenerator.cpp Corrects terminal and precursor masses.
src/​openms/​source/​METADATA/​ID/​IdentificationDataConverter.cpp Applies RNA adduct mass shifts during mzTab export.
src/​tests/​class_tests/​openms/​source/​NucleicAcidSpectrumGenerator_test.cpp Tests both polarities and requested charges.
src/​tests/​class_tests/​openms/​source/​IdentificationDataConverter_test.cpp Tests sodium-adduct mzTab output.
src/​pyOpenMS/​tests/​unittests/​test_rna_terminal_fragment_mass.py Tests terminal fragments through pyOpenMS.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@poshul
poshul merged commit b3f33f1 into OpenMS:develop Oct 11, 2026
12 checks passed
timosachsenberg pushed a commit that referenced this pull request Oct 12, 2026
Brings in develop up to dac9590 (89 commits since #10446). Conflicts and ports:

- #10517 (modification-aware RNA digestion): RNaseDigestion keeps the run digest of
  this branch next to develop's coordinate-bearing digest, getFragmentPositions,
  inferCleavageSensitiveMods and digestWithCleavageSensitiveMods. The candidate
  and evidence merge of the run digest is RNaseDigestion::DigestedOligo::addEvidence,
  which NucleicAcidSearchEngine also uses: it applies internal fixed modifications
  before the cleavage and places cleavage-sensitive variable modifications during
  the digestion, on the database sequences of its run (evidence refers to the
  unmodified database sequence). A digest input (-digest) uses only the enzyme it
  records (rna_enzyme) to classify cleavage-sensitive modifications. The m2,2G
  digestion check and NASEDigestion_test use the owning model and a native digest
  bundle instead of .oms; bindings keep the run digest and add develop's API.
- #10515 (RNA adduct mass): the mzTab export of oligonucleotide matches without a
  calculated m/z includes the adduct, computed as NucleicAcidSearchEngine does
  (AdductInfo::getMZ; the adduct of a match is that of the ion). The regression
  test uses the owning model with the adduct NucleicAcidSearchEngine stores and
  develop's formula as the expected value.
- #10475 (every peptide identification needs its run): the Arrow writers check
  both the native links and the protein runs; the consensus Parquet loader checks
  both as well. The adapter reports a missing run with ProteinRunReferences'
  message. The converter keeps this branch's implementation, which enforces the
  run contract on import.
- FileHandler: imaging includes from #10439; CHANGELOG: both sides.

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.

3 participants