Skip to content

[FIX] OpenNuXL: NuXL:oligo_fragment_adducts only takes cross-linkable nucleotides; consistent names of the larger fragment adducts - #10972

Merged
timosachsenberg merged 1 commit into
developfrom
nuxl-oligo-fragment-adducts-followup
Nov 23, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
nuxl-oligo-fragment-adducts-followup

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Follow-up to #10957 (NuXL:oligo_fragment_adducts), fixing points from a review after it was merged:

  • NuXL:oligo_fragment_adducts only takes cross-linkable nucleotides. Only cross-linked nucleotides get fragment adducts, so a listed nucleotide that is not in NuXL:can_cross_link got none of its forms. Because a non-empty list also turns on the complete adducts, the search still changed for the other nucleotides, silently. Example: -NuXL:presets "RNA-UV (U)" -NuXL:oligo_fragment_adducts A dropped the preset's pUp/U-H2O-H2O and still added UU/UU-H2O for U. Such a value is now refused with ILLEGAL_PARAMETERS, and the parameter description says so.
  • Consistent names for the complete adduct after loss of water. It was named <precursor adduct> + "-H2O", but precursor adducts carry normalised formulas (UU-H2O1). So the same 612.05 Da shift was called UU-H2O for the precursor adduct UU and UU-H2O1 for the precursor adduct UU-H2O1. It is now named like the precursor adducts (UU-H2O1), as the header already says ("named like the precursor adduct").
  • Tests.
    • NuXLParameterParsing_test: asserts the preset's oligo_fragment_adducts value ("U" for RNA-UV (U), empty for RNA-UV (4SU), which has no such key, even if the output had a value before). It also checks that the shift has one name across the precursor adducts UU and UU-H2O1.
    • New TOPP test TOPP_OpenNuXL_oligo_fragment_adducts_not_xl: C under RNA-UV (U) is refused with exit code 6 and the error message, and no output is written.
  • share/OpenMS/NUXL/README.md documents the optional oligo_fragment_adducts preset key.

Not changed here, and worth separate PRs if wanted:

Output of the existing TOPP tests is unaffected: only TOPP_OpenNuXL_7 uses an RNA-UV preset, and it checks no fragment adduct names.

Testing: this was written where OpenMS could not be built, so locally only syntax-only compiles (g++ -std=c++20 -fopenmp -fsyntax-only -Wall, stub config headers) of OpenNuXL.cpp, NuXLParameterParsing.cpp and NuXLParameterParsing_test.cpp were run (clean). CI on 7834220: build-and-test (ubuntu-24.04, g++) ran all 3602 tests, all passed, including NuXLParameterParsing_test, TOPP_OpenNuXL_oligo_fragment_adducts_not_xl and TOPP_OpenNuXL_7; the clang++, ubuntu-arm and macOS builds, the Linux/macOS wheels, cppcheck-test and header-set-compatibility passed too. The Windows build and wheel were still running when this was written.

Checklist

  • New and existing unit tests pass locally with my changes

AI use (see the OpenMS AI Policy)

  • I have read the OpenMS AI Policy, and I understand, have reviewed and tested every change in this PR and can explain it in my own words
  • Substantial AI use in PR (e.g. agentic tools wrote significant parts); commits carry a Co-authored-by: trailer, and the description above explains the design intent and rationale

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • OpenNuXL now reports an error when a configured oligonucleotide fragment-adduct target is not marked as cross-linkable.
    • Water-loss fragment adducts use consistent formula-based labels, such as H2O1.
  • Documentation

    • Clarified the optional fragment-adduct setting, its requirements, and how it interacts with cross-linkable nucleotides.

… nucleotides; consistent names of the larger fragment adducts

Follow-up to #10957:
- NuXL:oligo_fragment_adducts: refuse nucleotides that are not in
  NuXL:can_cross_link (ILLEGAL_PARAMETERS). They would get none of their
  forms (only cross-linked nucleotides get fragment adducts), while the
  complete adducts would still be added for the other nucleotides.
- The complete adduct after loss of water is named like the precursor
  adducts ("UU-H2O1" instead of "UU-H2O"), so the same shift has the same
  name for the precursor adducts UU and UU-H2O1.
- Tests: the preset value of oligo_fragment_adducts (and none for a preset
  without it), the names across precursor adducts, and a TOPP test for the
  refused nucleotide.
- share/OpenMS/NUXL/README.md: the oligo_fragment_adducts key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmXyW2qWHB36dRtdmSw
@timosachsenberg
timosachsenberg marked this pull request as ready for review November 23, 2026 18:24
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

OpenNuXL now rejects oligonucleotide fragment-adduct targets that are not cross-linkable. Water-loss fragment-adduct names now use the water formula string, and the related tests and documentation reflect these behaviors.

Changes: NuXL Adduct Configuration and Naming

Layer / File(s) Summary
Validate fragment-adduct targets
share/OpenMS/NUXL/README.md, src/topp/OpenNuXL/OpenNuXL.cpp, src/topp/OpenNuXL/test/NuXLParameterParsing_test.cpp, src/tests/topp/CMakeLists.txt
The option description and documentation state that listed targets must be cross-linkable. OpenNuXL returns ILLEGAL_PARAMETERS when a target is not cross-linkable. Tests check preset values and verify that an invalid target produces an error without creating an output file.
Use formula-based water-loss names
src/topp/OpenNuXL/source/NuXLParameterParsing.cpp, src/topp/OpenNuXL/include/NuXLParameterParsing.h, src/topp/OpenNuXL/test/NuXLParameterParsing_test.cpp
Water-loss adduct names use the string representation of the water formula. Comments and test expectations use the H2O1 suffix.

Possibly related PRs

  • OpenMS/OpenMS#10957: Introduced NuXL:oligo_fragment_adducts, which this change validates and whose water-loss adduct naming it updates.

Suggested reviewers: poshul, jpfeuffer

Change: Bug fix

Merge Risk: Minimal · up to 78342

This change rejects oligo fragment-adduct nucleotides that cannot cross-link and makes water-loss adduct names consistent. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes: OpenNuXL's NuXL:oligo_fragment_adducts now accepts only cross-linkable nucleotides, and the larger fragment adduct names are made consistent. Both match the PR ob…
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: Title check

Explanation

The title names the two main changes: OpenNuXL's NuXL:oligo_fragment_adducts now accepts only cross-linkable nucleotides, and the larger fragment adduct names are made consistent. Both match the PR objectives and the file-level summaries (the ILLEGAL_PARAMETERS check in OpenNuXL.cpp and the water-loss rename to H2O1 in the parsing code and tests). The title is long, but it states the primary change.

Finishing Touches

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 nucleotide in the queue.
“Cross-linkable?” it asks before it hops through.
Water leaves its formula in the name.
The tests record the suffix just the same.
Then off it bounds, with tidy adducts in view.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39d675f1-1348-4472-a2f8-7d0d4eb10ee5
Commits

Reviewing files that changed from the base of the PR and between ddf4cee and 7834220.

Files selected for processing: 6

  • share/OpenMS/NUXL/README.md
  • src/tests/topp/CMakeLists.txt
  • src/topp/OpenNuXL/OpenNuXL.cpp
  • src/topp/OpenNuXL/include/NuXLParameterParsing.h
  • src/topp/OpenNuXL/source/NuXLParameterParsing.cpp
  • src/topp/OpenNuXL/test/NuXLParameterParsing_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.

@timosachsenberg
timosachsenberg merged commit 01540e6 into develop Nov 23, 2026
14 checks passed
@timosachsenberg
timosachsenberg deleted the nuxl-oligo-fragment-adducts-followup branch November 23, 2026 18:39

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AI-generated initial review

This is an automated, AI-generated first review. It looks only for high- and medium-priority issues (no nits) and checks whether the PR has tests and measurements. Please double-check anything before acting on it; a maintainer will follow up.

This PR was merged at 18:39 UTC, before this review ran. Anything below that needs a change would go into a follow-up PR. I reviewed 7834220 (merged as 01540e6) against its base ddf4cee (#10957).

There are two changes. NuXL:oligo_fragment_adducts now refuses a nucleotide that is not in can_cross_link, with ILLEGAL_PARAMETERS. The complete adduct after loss of water is now named like the precursor adducts (UU-H2O1 instead of UU-H2O). There are also new unit tests, a TOPP test and the README entry.

What I ran:

  • No build: there is no OpenMS build in this environment, and a build from scratch (vcpkg dependencies) wasn't worth it for a merged 46-line change. Its new tests already passed in CI on Linux (g++, clang++, arm) and macOS. So I did not run the tests or the tool myself.
  • Code reading:
    • the new check in OpenNuXL.cpp, and how can_cross_link/can_xl_ are filled with and without a preset;
    • getFeasibleFragmentAdducts() and getAllFeasibleFragmentAdducts();
    • how precursor adducts are named in NuXLModificationsGenerator.cpp;
    • every place that consumes fragment-adduct names: NuXLAnnotateAndLocate.cpp, NuXLFragmentIonGenerator.cpp, and getAdductMass2Name()/getMapAAPlusAdductMassToResidueToAdductName() in OpenNuXL.cpp;
    • check_exit_code.cmake.
  • Presets: checked share/OpenMS/NUXL/nuxl_presets.json with a script against the new rule.

Verdict:

  • High priority: none found.
  • Medium priority: none found.

Tests and measurements

  • Tests: provided, and they cover both changes.
    • NuXLParameterParsing_test:
      • the preset's oligo_fragment_adducts value;
      • a preset without the key resets a pre-filled output to empty;
      • all expected names updated to -H2O1;
      • a direct check that the shift C18H22N4O16P2 is named UU-H2O1 both for the precursor adduct UU and for UU-H2O1.
    • TOPP_OpenNuXL_oligo_fragment_adducts_not_xl: requires exit code 6 (ILLEGAL_PARAMETERS), the new message, and no output file.
    • No gap: a custom -NuXL:presets_file whose oligo_fragment_adducts names a non-cross-linkable nucleotide isn't tested separately. It goes through the same check after the preset is loaded, so this isn't needed.
  • Measurements: none needed. Scoring is unchanged: larger fragment adducts are deduplicated by formula, so the rename changes no formula or mass that gets added. The new check only affects configurations that are now refused.
  • Real data: none reported. Not needed here: no built-in preset is affected (see below), and the rename only changes annotation strings of RNA-UV hits with oligonucleotide adducts.
  • CI at merge time: passed on the Linux jobs (g++, clang++, arm), macOS, all three Linux/macOS wheel builds, cppcheck and the header check. build-and-test (windows-2025, cl.exe) and build-wheels-windows were still running. The new TOPP test sits inside if (NOT MSVC), so Windows doesn't run it, but NuXLParameterParsing_test does. Please check the Windows result on develop.
  • PR checklist: "New and existing unit tests pass locally" and the first AI-policy box ("I have read the OpenMS AI Policy, … reviewed and tested every change") are unticked. The description says no local build was possible.

Checked and fine

  • No default configuration is refused: all four built-in presets with oligo_fragment_adducts have U and list U in can_cross_link. They are RNA-UV (U), RNA-UV (UCGA), RNA-UV Extended (U) and RNA-UV Extended (UCGA). With a preset, can_cross_link comes from the preset. can_xl_ is filled from it before the check, so the check validates the effective set.
  • Refused before any work: the check runs before the spectra are loaded and before any output is opened, which the TOPP test's ABSENT_FILE confirms.
  • Names now agree with precursor adducts: precursor adducts are named from EmpiricalFormula::toString() of each loss (e.g. U-H2O1, C-H3N1-H2O1), so "-" + water.toString() matches. This also holds for the Extended presets. For example, precursor UC-H3N1 minus water gives UC-H3N1-H2O1, which is exactly the name of the precursor adduct from C:-NH3-H2O.
  • Nothing parses the old suffix: fragment-adduct names are only used as annotation text. NuXLAnnotateAndLocate.cpp splits on the space between ion and shift, and marker ions get the MI: prefix. Nothing looks for a trailing -H2O. The ambiguity tables are built from the per-nucleotide fragment adducts only and don't contain the larger ones, as the description notes.
  • No compatibility break: #10957 was merged the same day and is not in a release, so the old UU-H2O-style names never shipped.

Generated by Claude Code

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.

2 participants