Repository navigation
[FIX] OpenNuXL: score every same-formula adduct and cross-linkable nucleotide (#10746 + updated test references) - #10761
Conversation
…cleotide in slow scoring The spectrum loops in the main scoring loop iterate over a copy of low_it (`auto l`), so every adduct sharing a precursor sum formula and every cross-linkable nucleotide is scored against the matching spectra. annotateAndLocate_ localises each hit against its own precursor adduct (NA_adduct_amb_index), as fillSpectrumID_ does, so the nucleotide lookup finds the hit's nucleotide for second and later adducts of a sum formula. See #10739.
…duct In rescoreFastHits_, the loop that copies each hit per ambiguous precursor adduct advances NA_adduct_it with NA_adduct_amb_index, so each copy takes its cross-linkable nucleotides from its own adduct. The rescoring loop skips adducts other than the hit's NA_adduct_amb_index, so partial-loss and marker-ion scores come from the hit's adduct and total_MIC is incremented once per hit. See #10739.
…re total loss once - NuXLAnnotatedHit::hasBetterScore: deterministic tie-breaker on sequence, peptide modification, NA modification, adduct index, cross-linked nucleotide and isotope error - slow scoring: nr_candidates counted once per peptide, sum formula and spectrum; adducts of a sum formula collected first, total-loss part scored once per spectrum, partial-loss part per adduct and nucleotide with the total-loss b/y templates - keepTopUniqueHits_: at most one hit per peptide, peptide modification, sum formula and isotope error, in the inline XL trim and filterTopNAnnotations_ - rescoreFastHits_: direct adduct lookup, parallel rescoring loop - NuXLModificationMassesResult::findPrecursorAdduct: bounds-checked lookup of a hit's sum formula and adduct, used in rescoreFastHits_, fillSpectrumID_ and annotateAndLocate_ - annotateAndLocate_: explicit checks for unresolvable adducts and nucleotides (warning, hit left unlocalised); header docs updated - TOPP_OpenNuXL_7: RNA-UV (UCGA) search checking second adducts, second nucleotides, nr_candidates and tie resolution
…ic tie-breaking NuXLAnnotatedHit::hasBetterScore now breaks score ties on sequence, peptide_mod_index, NA_mod_index, ... instead of leaving them to std::partial_sort's unspecified order. Every changed hit is an exact score tie that now resolves the other way: - OpenNuXL_4 (fast scoring, top 2): at RT 31.812 IIGNENFVVAAR (CU-H2O1) and LVQPFGWENPR (GU-H3O4P1) tie at fast score 4.95275402 for the second slot; IIGNENFVVAAR is now kept (rescored to 11.37 instead of 8.77). - OpenNuXL_6 (precursor tolerance 1e9 ppm, top 2): rank 1/2 ties between UU-H2O1 and UU-H3O4P1 (and U-H2O1/U-H1O3P1, MATSGMMTELGK with/without Met oxidation) now go to the lower sum-formula/modification index. The changed rank-1 hits shift the precursor-error mean/SD of the 20 best IDs (mean 34789 -> 43371 ppm, 5*sd 786491 -> 731308 ppm), so the filter_pc_mass_error cutoff now removes the EDIAAIR peptide hit (|ppm| - |mean| = 776317 ppm). Only the lines that differ between develop and this branch's output were replaced; all other lines are unchanged. Generated on Linux x64, g++ 13.3, Release. All 34 TOPP_OpenNuXL tests pass; on develop, the same build passes all OpenNuXL tests except the new TOPP_OpenNuXL_7_ambiguous_adducts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmZp4ZWSMDF4PaXvwak
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Resolve precursor adducts and localization src/topp/OpenNuXL/include/NuXLModificationsGenerator.h, src/topp/OpenNuXL/OpenNuXL.cpp, src/topp/OpenNuXL/source/NuXLAnnotateAndLocate.cpp, src/topp/OpenNuXL/include/NuXLAnnotateAndLocate.h |
findPrecursorAdduct resolves the formula and adduct from both indices. Rescoring, reporting, and localization use this lookup. Missing adduct or nucleotide entries produce warnings and skip localization. |
Score adducts and select unique hits src/topp/OpenNuXL/OpenNuXL.cpp, src/topp/OpenNuXL/include/NuXLAnnotatedHit.h |
Slow scoring counts candidates once per spectrum and sum formula, shares total-loss scoring, and scores partial losses per adduct and nucleotide. Hit selection removes duplicates and breaks score ties deterministically. |
Validate ambiguous-adduct results src/tests/topp/CMakeLists.txt, src/tests/topp/OpenNuXL_7_ambiguous_adducts_test.cmake, src/tests/topp/OpenNuXL_4_output.idXML |
A new TOPP test checks adduct and nucleotide assignments, candidate count, and duplicate hits. The test setup and stored idXML output are updated. |
Sequence Diagram(s)
sequenceDiagram
participant OpenNuXL as OpenNuXL slow scoring
participant Spectra as matching spectra
participant Adducts as XLAdduct entries
participant Hits as per-spectrum hit buffer
OpenNuXL->>Adducts: collect feasible adducts and marker-ion spectra
OpenNuXL->>Spectra: calculate shared total-loss scores
loop Each adduct and cross-linkable nucleotide
OpenNuXL->>Spectra: score partial-loss ions
OpenNuXL->>Hits: retain unique hit
end
Possibly related issues
- OpenMS/OpenMS issue 10739, “OpenNuXL: slow scoring only scores the first adduct and first cross-linkable nucleotide for each precursor sum formula”: the PR updates slow scoring to process adducts and cross-linkable nucleotides and adds a regression test for ambiguous adducts.
Possibly related PRs
- OpenMS/OpenMS#10746: It updates the same OpenNuXL scoring, precursor-adduct lookup, hit filtering, and localization behavior.
Suggested reviewers: jpfeuffer
Priority:
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: 
Minimal · up to a135b
-
This change makes OpenNuXL score every same-formula adduct and cross-linkable nucleotide, and makes the choice among tied hits deterministic. It adds a test for the ambiguous-adduct case. No concrete merge-blocking risk was found; the updated test references rely on CI to confirm them.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
The PR addresses the coding requirements in
#10739. Slow scoring now copies the spectrum iterator, so each matching spectrum can be scored for every same-formula adduct and cross-linkable nucleotide. Candidate counting and total-loss scoring use the shared spectrum/formula scope. Fast scoring copies retain their own adduct and rescoring uses that adduct. Hit-specific, bounds-checked adduct lookup is used during reporting and localisation. The new TOPP_OpenNuXL_7 test checks second-adduct, second-nucleotide, candidate-count, and tie behavior. The reported 34 OpenNuXL tests pass on this branch.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within the OpenNuXL defect scope from
#10739. Deterministic tie ordering, unique-hit filtering, adduct-index validation, localisation safeguards, test wiring, and reference updates support correct handling of the newly scored hits and their reproducible outputs. No unrelated product area or unrelated feature is identified in the reviewed change summary.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 5 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
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.
A rabbit checks the adduct list,
Each formula gets its indexed fit.
Shared spectra score, then branches run,
Unique hits line up when scoring’s done.
The test finds copies that should not persist,
And hops away with the results in its fist.
Comment @coderabbitai help to get the list of available commands.
Description
Fixes #10739. This is #10746 by Tom Smith (TomSmithCGAT): its three commits, unchanged, plus one commit (a135b0c) that updates the
TOPP_OpenNuXL_4andTOPP_OpenNuXL_6references. #10746 couldn't regenerate those from its 3.6.0 build, and they are its only CI failures:TOPP_OpenNuXL_4_out1/out2andTOPP_OpenNuXL_6_out1/out2, identical on all three Linux jobs.What #10746 changes
The full description, reasoning and measurements are in #10746.
for (auto & l = low_it; ...)→for (auto l = low_it; ...). The reference advancedlow_it, so only the first adduct of a sum formula and the first cross-linkable nucleotide were ever scored. The total-loss part is now scored once per spectrum, andnr_candidatesis counted once per peptide, sum formula and spectrum, as ondevelop.rescoreFastHits_): each copy made for an ambiguous adduct gets the nucleotides of its own adduct. Each hit is rescored only with its own adduct.NuXLAnnotatedHit::hasBetterScorebreaks score ties deterministically.keepTopUniqueHits_keeps at most one hit per peptide, peptide modification, sum formula and isotope error.findPrecursorAdductlooks up a hit's adduct with bounds checks.annotateAndLocate_uses the hit's own adduct instead of the first adduct of the formula. This fixes thestd::length_errorabort that appears once second adducts are scored.TOPP_OpenNuXL_7covers second-adduct and second-nucleotide hits, the candidate count and tie resolution.Reference update (a135b0c)
Every changed hit is an exact score tie that the new tie-breaker resolves differently from
std::partial_sort's unspecified order ondevelop:TOPP_OpenNuXL_4(fast scoring, top 2): at RT 31.812,IIGNENFVVAAR(CU-H2O1) andLVQPFGWENPR(GU-H3O4P1) tie at fast score 4.95275402 for the second slot.IIGNENFVVAARis now kept, and rescores to 11.37 instead of 8.77.TOPP_OpenNuXL_6(precursor tolerance 1e9 ppm, top 2):In 7 spectra, ranks 1 and 2 swap between UU-H2O1 and UU-H3O4P1 (or U-H2O1 and U-H1O3P1), at identical scores.
In 3 more spectra, a tie for rank 2 or 4 goes to the other candidate: UU-H3O4P1 instead of UU-H2O1 twice, and unmodified
MATSGMMTELGKinstead of its Met-oxidised form once.The changed rank-1 hits have different precursor errors. That shifts the precursor-error mean and SD of the 20 best IDs, which
filter_pc_mass_erroruses as its cutoff, so theEDIAAIRpeptide hit is now removed:developOnly the lines whose output differs between
developand this branch were replaced. All other lines, including the run date and version, are the previous reference unchanged.Verification
Built on Linux x64 with g++ 13.3 (the CI compiler), Release, system dependencies and Arrow 26:
developat the PR base (31e6d9d): all existingTOPP_OpenNuXLtests pass against the old references, so the setup reproduces them. Only the newTOPP_OpenNuXL_7_ambiguous_adductsfails.TOPP_OpenNuXLtests pass, including the definitions and idparquet tests.developand this branch.Checklist
Only the 34
TOPP_OpenNuXLtests were run locally. Class tests were not built; relying on CI.No need to edit the CHANGELOG file: entries are generated automatically once per week from merged changes.
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.
Generated by Claude Code
Summary by CodeRabbit