Skip to content

[FIX] OpenNuXL: don't delete fragment ions as false first isotopes when deisotoping MS2 spectra - #10949

Merged
timosachsenberg merged 2 commits into
OpenMS:developfrom
timosachsenberg:fix/nuxl-deisotoper-first-isotope
Nov 20, 2026
Merged

timosachsenberg merged 2 commits into
OpenMS:developfrom
timosachsenberg:fix/nuxl-deisotoper-first-isotope

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

OpenNuXL deisotopes each MS2 spectrum before scoring and annotating it. It does this with start_intensity_check = 2, so there is no intensity check between the monoisotopic and the first isotopic peak. When a fragment ion sits one isotope spacing (1.0034 / z) above a weaker, unrelated peak, it is taken as that peak's first isotope, merged into it and removed. After that it can't be annotated or scored. For peptide fragments below about 1800 Da the monoisotopic peak is always the most intense one, so this assignment is impossible.

Found while reviewing site localization (#10936): in S30 spectrum 29492 (YAVSVATR + U), b3+U′ at m/z 446.2039 (3.8 % of the base peak) was removed as the "isotope" of a 2.1 % peak at 445.2006.

Change

  • NuXLDeisotoper::deisotopeAndSingleCharge gets first_isotope_check_max_mass (default 0: off). Below that neutral monoisotopic mass, the first isotopic peak must not be more intense than the monoisotopic peak, whatever start_intensity_check is.
  • OpenNuXL sets it to 1500 Da.
  • New unit test section built from the peaks of the spectrum above.

Measured effect

Two RNA–protein UV cross-linking datasets with manually annotated sites (E. coli S30: 397 annotated PSMs; HEK293: 207), searched with the same settings with and without the fix:

without with
a/b/y ions removed as isotopes, nucleotide-shifted (annotated PSMs, ≥ 1 % of base peak) 7.2 % 5.6 %
the same, unshifted 3.8 % 2.3 %
XL PSMs at 1 % XL FDR, OpenNuXL score (before Percolator), S30 / HEK 1841 / 2743 1916 / 2914
XL PSMs at 1 % XL FDR after Percolator, S30 / HEK 4891 / 7699 4890 / 7665
site accuracy vs manual annotation (fragments), S30 / HEK 0.942 / 0.821 0.939 / 0.826
S30 PSMs with a manual K site where the lysine marker 178.098 is annotated 46 / 85 57 / 86

So the fix recovers ions and helps OpenNuXL's own score, but after Percolator, identifications and localization change only within noise. With NuXL:localization loss_aware (#10948) S30 accuracy goes from 0.949 to 0.957 (3 fixed, 0 broken; this includes the spectrum above), and HEK is unchanged.

Alternative tested

Checking the first isotope at every mass (start_intensity_check = 1, as SimpleSearchEngine and ProSE do) is a one-line change, but it is worse on HEK: 2685 PSMs before Percolator, 7632 after, and fragments accuracy 0.800 (−0.021 against this PR, 95 % CI −0.044 to −0.005). For heavy fragments the first isotope can be the strongest peak. Their patterns are then rejected, so they get no charge assigned.

Test references

The 9 OpenNuXL TOPP reference files change in score values and fragment annotations. FDQKIIDK moves its site from K8 to K4, and a few lower-ranked hits change. Lines that differ only by floating-point rounding (< 1e-9 relative) keep their old values, so the diff shows only real changes. All 70 NuXL tests pass locally.

Summary by CodeRabbit

  • New Features

    • Improved deisotoping for lower-mass ions by checking that the first isotope does not exceed the monoisotopic peak.
  • Tests

    • Refreshed OpenNuXL expected results to reflect updated identifications, scores, annotations, and localization measurements.
    • Added coverage for the low-mass isotope check and confirmed that existing behavior is preserved above the configured threshold.

…en deisotoping MS2 spectra

OpenNuXL deisotopes MS2 spectra with start_intensity_check = 2, so the step from the monoisotopic to the first
isotopic peak had no intensity check. A fragment ion one isotope spacing above a weaker, unrelated peak was taken as
that peak's first isotope, merged into it and removed, and could then never be annotated or scored. For peptide
fragments below about 1800 Da the monoisotopic peak is the most intense one, so such a pattern is impossible.

NuXLDeisotoper::deisotopeAndSingleCharge gets first_isotope_check_max_mass (default 0: off). Below that neutral
monoisotopic mass, the first isotopic peak must not be more intense than the monoisotopic peak. OpenNuXL sets 1500 Da.

Measured on two RNA-protein UV cross-linking datasets with manually annotated sites (E. coli S30, HEK293), same
search settings with and without the fix:
- a/b/y ions (>= 1 % of the base peak) of annotated PSMs removed as isotopes: 7.2 % -> 5.6 % of the
  nucleotide-shifted and 3.8 % -> 2.3 % of the unshifted ions
- OpenNuXL's own 1 % XL FDR, before Percolator: S30 1841 -> 1916 PSMs, HEK 2743 -> 2914
- after Percolator: S30 4891 -> 4890 PSMs, HEK 7699 -> 7665
- site accuracy against the manual annotation: S30 0.942 -> 0.939, HEK 0.821 -> 0.826 (neither significant)
- the lysine marker ion at m/z 178.098 is annotated again (S30 PSMs with a manual K site: 46/85 -> 57/86)

Checking the first isotope at every mass (start_intensity_check = 1, as SimpleSearchEngine and ProSE do) was also
tested and is worse on HEK: 2685 PSMs before Percolator, 7632 after, site accuracy 0.800. For heavy fragments the first
isotope can be the strongest peak, so their patterns are then rejected and they get no charge assigned.

Test references: score values and fragment annotations change in the OpenNuXL TOPP test outputs; FDQKIIDK moves its
site from K8 to K4, and a few lower-ranked hits change. Lines that differ only by floating-point rounding (< 1e-9
relative) keep their old values.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

OpenNuXL adds a neutral-mass threshold that controls whether the deisotoper checks the first isotope’s intensity. The OpenNuXL call sets the threshold to 1500 Da. Tests cover the threshold behavior, and six expected-output fixtures contain regenerated identification results.

Changes: OpenNuXL isotope handling

Layer / File(s) Summary
First-isotope mass check
src/topp/OpenNuXL/include/NuXLDeisotoper.h, src/topp/OpenNuXL/source/NuXLDeisotoper.cpp
deisotopeAndSingleCharge adds a first_isotope_check_max_mass parameter. Below the threshold, both isotope-discovery passes compare the first isotope’s intensity with the monoisotopic peak.
OpenNuXL configuration and tests
src/topp/OpenNuXL/OpenNuXL.cpp, src/topp/OpenNuXL/test/NuXLDeisotoper_test.cpp
The OpenNuXL call sets the threshold to 1500.0. Tests cover peaks below and above the threshold, and a genuine isotope pattern.
Regenerated identification fixtures
src/tests/topp/OpenNuXL_*_output.idXML
Six fixtures record updated OpenNuXL run metadata and identification results. Some fixtures also change modification mappings or peptide and protein assignments.

Change: Bug fix

Merge Risk: Minimal · up to 282a0

The change stops OpenNuXL from removing real fragment ions as false first isotopes in low-mass clusters. Only OpenNuXL output is affected, and it is limited to ions below 1500 Da. The regenerated expected-output files are consistent with the code change, and no 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 main change: OpenNuXL no longer deletes fragment ions as false first isotopes when deisotoping MS2 spectra. The raw summary shows the new first_isotope_check_max_mass parameter in …
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 main change: OpenNuXL no longer deletes fragment ions as false first isotopes when deisotoping MS2 spectra. The raw summary shows the new first_isotope_check_max_mass parameter in NuXLDeisotoper, its use in OpenNuXL.cpp, a unit test for it, and updated TOPP reference fixtures. The title is specific and matches the changeset and the PR objectives.

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 each isotope peak,
Beneath the mass limit, soft and meek.
The tests confirm which peaks remain,
Six fixtures hold the refreshed chain.
I hop through results, pleased and neat!

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: 0ab3c612-bacc-4384-964d-b216b5a5ba43
Commits

Reviewing files that changed from the base of the PR and between b45b171 and 282a043.

Files ignored due to path filters: 3

  • src/tests/topp/OpenNuXL_3_output2.tsv is excluded by !**/*.tsv
  • src/tests/topp/OpenNuXL_4_output2.tsv is excluded by !**/*.tsv
  • src/tests/topp/OpenNuXL_6_output2.tsv is excluded by !**/*.tsv
Files selected for processing: 4

  • src/tests/topp/OpenNuXL_3_output.idXML
  • src/tests/topp/OpenNuXL_4_output.idXML
  • src/tests/topp/OpenNuXL_6_output.idXML
  • src/topp/OpenNuXL/OpenNuXL.cpp

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

@poshul poshul left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

@timosachsenberg
timosachsenberg merged commit f1afbf2 into OpenMS:develop Nov 20, 2026
31 checks passed
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