Skip to content

Add graph-guided RNA candidates and optional route scoring to NASE - #10906

Closed
poshul wants to merge 3 commits into
developfrom
codex/nase-openms-reuse
Closed

poshul wants to merge 3 commits into
developfrom
codex/nase-openms-reuse

Conversation

@poshul

@poshul poshul commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Written by an AI agent using GPT-6.

Broad RNA modification searches require many precursor-compatible placements. This adds optional graph-guided candidates and anchored route scoring to NASE. Enumeration and HyperScore remain the defaults.

The graph preserves isobaric residue alternatives, orientation, terminal origin and original peak identity. Database-compatible routes constrain modification placement before exact precursor validation. Raw-MS2 diagnostics can gate modifications and permit coherent labile fragment models while retaining the fully modified precursor. MVH/HyperScore can also select the best complete scaffold model.

Reuse includes NASequence, RibonucleotideDB, RNaseDigestion, NucleicAcidSpectrumGenerator, existing FLASH/legacy preprocessing, core MVH/HyperScore, native FDR and outputs. SpectrumAnnotator's ordinal ladder statistic is shared with RNA route pruning and exposed in pyOpenMS. RNA-specific traversal and anchored scoring remain tool-local; the documentation explains why peptide Tagger and closest-only alignment are insufficient.

Audit modes check optimized candidates against exhaustive oracles. Tag modes retain enumeration fallback; incomplete route searches fail explicitly. Incompatible digestion caches are rejected. The m6t6A chemistry correction builds on the t6A fix merged in #10902.

Review fixes (5763daf, with Claude): graph_routes validates each candidate against a parent window of the enzyme's pattern width instead of re-digesting the whole parent. routes:terminal_states (all, enzyme) is new: the default all keeps the six terminal assignments, which is a wider space than enumeration searches; enzyme permits only the RNase's end groups at cleaved ends and OH at parent termini. Linkage modifications are rejected up front in graph_routes. graph_routes with theo_ms2_out/exp_ms2_out, and diagnostic:fixed_ions naming a code that is not an enabled variable modification or given when diagnostics are not evaluated, are now parameter errors. The graph alphabet limit for graph:max_step 2 is raised from 255 to 1023 residues.

Validation: out-of-tree Debug/Release builds; five affected C++ test executables; 15 CLI/fixture checks; two compiled binding-section smoke tests (full pyOpenMS not built). A three-file HAP1 replay preserved every frozen winning assignment, score and q-value, with identical graph/precursor diagnostics: 5,454 / 7,587 / 8,422 PSMs at 1% / 5% / 10% native q-value.

After the review fixes, a Release build passed the 23 NASE-related tests (four NASE class tests and all TOPP_NucleicAcidSearchEngine_* tests). routes:terminal_states=enzyme and the new parameter errors have no dedicated tests yet, and the HAP1 replay was not repeated on that commit.

The retained experimental profile records historical seed sensitivity. Nominal yields do not independently establish accuracy; this does not constitute a new nine-file accuracy benchmark.

  • Substantial AI assistance is disclosed. Human review remains required before submission.

Use bounded RNA mass tags and database-compatible anchored routes to constrain
modification placements before exact precursor validation. Keep native scoring
available and add optional diagnostic-supported labile scaffold and route models.

Reuse existing RNA chemistry, RNase digestion, theoretical spectra, FLASH/legacy
preprocessing, native MVH/HyperScore, FDR and output paths. Share the peptide
ordinal-series statistic through SpectrumAnnotator and expose it in pyOpenMS.

Audit optimized placements against reference oracles, reject incompatible digest
caches and fail incomplete route searches instead of exporting partial results.
Keep enumeration and HyperScore defaults and record an explicit HAP1 recipe.

Co-authored-by: OpenAI Codex (GPT-6) <[email protected]>

@timosachsenberg timosachsenberg 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.

Focused review of the new route-scoring DP (no nits). I found one reproducible route-loss case involving alternative charge interpretations of the same observed peak. I ran a standalone C++20 reproducer of the DP transition/selection logic using g++ -O2; it returned a two-node path although a valid three-node path exists. This verifies the local algorithmic issue, not an end-to-end OpenMS run. A full OpenMS build/test was unavailable in this environment because the repository cannot be fetched from GitHub here.

|| (paths[j].matches.size() + 1 == paths[i].matches.size()
&& paths[j].weighted_intensity + current.weighted > paths[i].weighted_intensity))
{
paths[i] = paths[j];

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.

P2 — Retain alternative prefixes with different used-peak identities. paths[i] retains only the longest/heaviest path ending at each ion match, but extension also depends on the entire set of previously used observed peaks (the match.peak == current.peak check above). Therefore the retained path can be impossible to extend even when a lower-weight alternative prefix at the same i would yield a longer valid route.

I reproduced this using a standalone C++20 extraction of this DP (g++ -O2, exit 0): sorted matches (position, original_peak, neutral_mass, weighted_intensity) of (2,0,601,10), (2,1,601.001,2), (3,2,901,3), (4,0,1202,8), max_step=2. The routine retains peak0 → peak2 at position 3 and rejects its extension to the charge-2 interpretation of peak0; it reports a 2-node route even though peak1 → peak2 → peak0 is a valid 3-node route with no reused observed peak. Setting min_nodes=3 would discard the series entirely. This is a targeted algorithm reproducer, not an OpenMS integration test.

Please retain non-dominated prefixes distinguished by their used peak identities (or use a bounded path search), and add a regression test with alternative charge hypotheses.

poshul and others added 2 commits November 15, 2026 16:27
Use NASequence const iterators with standard algorithms for GCC 13 iterator
traits compatibility. Avoid capturing structured bindings in lambdas when
OpenMP is enabled under Clang 18, including candidate completion captures.

Co-authored-by: OpenAI Codex (GPT-6) <[email protected]>
…and parameter checks

- Validate each route candidate against a parent window of the enzyme's
  pattern width instead of re-parsing and re-digesting the whole parent;
  parents are parsed once and the validator is built once.
- Reject linkage modifications (codes ending in '*') in the route
  generator constructor instead of failing every spectrum with map::at.
- Add routes:terminal_states (all, enzyme). The default 'all' keeps the six
  terminal assignments; 'enzyme' permits only the RNase's end groups at
  cleaved ends and OH at parent termini, as in enumeration.
- graph_routes with theo_ms2_out/exp_ms2_out is now a parameter error;
  these files were written empty.
- diagnostic:fixed_ions must name an enabled variable modification and is
  rejected when diagnostics are not evaluated.
- Raise the graph alphabet limit for max_step 2 from 255 to 1023 residues.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@poshul

poshul commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

Written by an AI agent using GPT-6.

Superseded by seven focused draft PRs covering m6t6A chemistry, ion-series statistics and binding, cached input/score references, legacy isotope settings, mzTab score columns, graph/tag candidates, and diagnostic-supported routes and scoring.

The five foundation PRs target develop. The graph and route PRs form a stack above their foundations integration branch. All seven replacement PRs have been verified open as drafts and reference this PR in their descriptions. Closing this bundled PR as superseded.

@poshul poshul closed this Nov 15, 2026
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