Skip to content

[FIX] TOPPView: opening an identification file in a window of its own crashed - #10701

Merged
timosachsenberg merged 1 commit into
developfrom
fix/toppview-identification-layer-range
Oct 23, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
fix/toppview-identification-layer-range

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Opening an idXML or mzIdentML file in TOPPView aborts the program when the file gets a window of its own. That happens when no spectrum file for annotation is found or the annotation prompt is declined.

An identification layer has RT and m/z but no intensities (LayerDataIdent::getRange()). When it is the only layer of the window, the intensity range of the canvas stays empty. PlotCanvas::recalculateRanges_() then calls getMinIntensity(), which throws Exception::InvalidRange ("Empty or uninitalized range object"):

PlotCanvas::recalculateRanges_()
Plot2DCanvas::finishAdding_()
PlotCanvas::addLayer(PeptideIdentificationList&, ...)
TOPPViewBase::addData(...)
TOPPViewBase::addDataFile(...)

Nothing catches the exception, so TOPPView ends with "FATAL: uncaught exception!" and SIGABRT. Opened on top of a peak map, the identifications are fine, because the peak layer provides the intensities.

Fix

If no layer has intensities, PlotCanvas::recalculateRanges_() gives the canvas the intensity range [0, 1]. Guarding only getMinIntensity() is not enough: the dot gradient (Plot2DCanvas::recalculateDotGradient_()) and the snap and percentage factors read the maximum intensity next. Before this change, this case always threw, so no other case behaves differently.

Test

TOPPView_test::testIdentificationFile writes an idXML without a spectrum file next to it and opens it with addDataFile(). It then checks that:

  • the identification layer exists with both identifications;
  • the canvas has an intensity range;
  • the canvas repaints.

Without the fix, the test fails with the InvalidRange above, reproduced on develop at 2e3ea32d11. With the fix, TOPPView_test, TSGDialog_test and the visual class tests pass, run offscreen (QT_QPA_PLATFORM=offscreen).


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Identification files without associated spectra now display correctly, including files whose layers contain no intensity data.
    • Plot ranges remain valid for empty intensity data, and negative minimum intensities are handled appropriately when intensity data is present.

… crashed

An identification layer has RT and m/z but no intensities. In a window of its own (an idXML or
mzIdentML without a spectrum file to annotate) it is the only layer, so the intensity range of the
canvas stayed empty and PlotCanvas::recalculateRanges_() threw Exception::InvalidRange from
getMinIntensity(). Nothing caught it, so TOPPView aborted. Without intensities, the canvas now
has the intensity range [0, 1] (the dot gradient and the snap and percentage factors read it too).

Test: TOPPView_test opens an idXML without a spectrum file; it fails with InvalidRange without the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ 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: f266ffe9-f1c7-4742-89e6-99403f664295
📥 Commits

Reviewing files that changed from the base of the PR and between c4db189 and 050d226.

📒 Files selected for processing: 3
  • src/openms_gui/source/VISUAL/PlotCanvas.cpp
  • src/tests/class_tests/openms_gui/include/GUI/TOPPView_test.h
  • src/tests/class_tests/openms_gui/source/GUI/TOPPView_test.cpp

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

📝 Walkthrough

PlotCanvas now assigns intensity bounds of 0 and 1 when the combined intensity range is empty. A new TOPPView test loads an IDXML file with peptide identifications and no spectrum file, then checks the layer, peptide count, intensity range, and canvas repaint.

Changes: Identification file intensity range

Layer / File(s) Summary
Empty intensity range handling and identification-file test
src/openms_gui/source/VISUAL/PlotCanvas.cpp, src/tests/class_tests/openms_gui/include/GUI/TOPPView_test.h, src/tests/class_tests/openms_gui/source/GUI/TOPPView_test.cpp
PlotCanvas::recalculateRanges_ sets empty intensity bounds to 0–1. The TOPPView test creates and loads an IDXML file with two peptide identifications and checks the resulting layer, peptide count, intensity range, and canvas repaint.

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 050d2

The identification-file crash has a targeted fallback and regression test; no outstanding merge-blocking issue is identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 clearly identifies the TOPPView crash and the triggering action. It matches the main change and is specific enough for project history.
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.
✨ 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.

❤️ Share

A rabbit draws a plot so neat,
With zero at the bottom, one complete.
Two peptides hop into the view,
The canvas paints their range anew.
The rabbit rests beside the screen.

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

@timosachsenberg
timosachsenberg merged commit 70c27b2 into develop Oct 23, 2026
33 checks passed
@timosachsenberg
timosachsenberg deleted the fix/toppview-identification-layer-range branch October 23, 2026 02:23
timosachsenberg pushed a commit that referenced this pull request Oct 25, 2026
…nges natively

- TOPPView_test: develop's test of an identification file in a window of
  its own (#10701) is kept next to testIdentifications and counts the
  identifications of the layer's identification data. Its peptide
  identifications get a q-value score type: TOPPView loads identification
  files into identification data, whose import needs the score type of
  every peptide identification with hits (documented in
  identification-data.md).
- TextExporter: develop's USI mapper (#10593) is built from the exported
  protein runs of the consensus map.
- ProteinGroupArrowExport_test, ConsensusMapArrowExport_test: develop's
  q-value sections (#10700, #10708) set the protein runs through the
  identification data converter instead of the removed map accessors.
- bind_misc: the docstring of Bayesian inference on consensus maps names
  the protein run requirement without the removed accessor.

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