Skip to content

TOPPView: highlight MS2 precursor positions - #9715

Merged
timosachsenberg merged 2 commits into
OpenMS:developfrom
cbielow:tv_pc
Jul 9, 2026
Merged

timosachsenberg merged 2 commits into
OpenMS:developfrom
cbielow:tv_pc

Conversation

@cbielow

@cbielow cbielow commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Draw isolation window start/end as dashed line for each MS2 precursor position.
Positions are now selectable and show RT, m/z, and charge

pc

Also adds missing documentation for #9466

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Summary by CodeRabbit

  • New Features

    • Added clearer 2D view interaction for precursor markers, including hover highlighting and display of RT, m/z, and charge.
    • Expanded 1D and 2D view guidance for showing reporter-ion overlays and precursor-related annotations.
  • Documentation

    • Updated TOPPView help pages with step-by-step instructions, visual explanations, and screenshots for the new overlay and hover behaviors.
  • Bug Fixes

    • Improved selection behavior so peak and precursor highlighting stay consistent during mouse interaction and view refreshes.

@cbielow
cbielow requested a review from pjones July 8, 2026 16:12
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7fedb92e-dfca-4548-b683-330a13f44659

📥 Commits

Reviewing files that changed from the base of the PR and between 9b1ae6e and d693768.

⛔ Files ignored due to path filters (2)
  • doc/openms/docs/_images/tutorials/topp/TOPPView_1D_isobaric_annotation.png is excluded by !**/*.png
  • doc/openms/docs/_images/tutorials/topp/TOPPView_2D_precursor_highlight.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • doc/openms/docs/getting-started/visualize-with-openms/display-modes-and-view-options.md
  • doc/openms/docs/getting-started/visualize-with-openms/views-in-toppview.md
  • src/openms_gui/include/OpenMS/VISUAL/Plot2DCanvas.h
  • src/openms_gui/source/VISUAL/Painter2DBase.cpp
  • src/openms_gui/source/VISUAL/Plot2DCanvas.cpp

📝 Walkthrough

Walkthrough

This PR adds MS/MS precursor marker detection, highlighting, and coordinate display to the 2D plot canvas in OpenMS GUI, including nearest-precursor mouse search, isolation window drawing, and selection state management, alongside documentation updates describing the new hover interactions.

Changes

Precursor marker highlighting

Layer / File(s) Summary
Isolation window drawing
src/openms_gui/source/VISUAL/Painter2DBase.cpp
paintPrecursorPeaks_ uses a local precursor reference and draws dashed m/z isolation window limits when offsets are available.
Precursor helper contract
src/openms_gui/include/OpenMS/VISUAL/Plot2DCanvas.h
Adds declarations for nearest-precursor search, coordinate mapping, and highlighting, plus a new selected_precursor_ member mutually exclusive with selected_peak_.
Nearest-precursor search and rendering
src/openms_gui/source/VISUAL/Plot2DCanvas.cpp
Implements findNearestPrecursor_, precursorIndexToXY_, highlightPrecursor_, and drawPrecursorCoordinates_, with tolerance-based pixel search and exception handling; adds <cmath> include.
Selection state lifecycle wiring
src/openms_gui/source/VISUAL/Plot2DCanvas.cpp
Clears selected_precursor_ in finishAdding_, removeLayer, activateLayer, and updateLayer to keep selection consistent across layer operations.
Paint and mouse interaction integration
src/openms_gui/source/VISUAL/Plot2DCanvas.cpp
Integrates precursor highlighting and coordinate rendering into paintEvent, and extends mouseMoveEvent to choose between nearest peak and precursor selection, clearing selection when entering zoom mode.
Documentation updates
doc/openms/docs/getting-started/visualize-with-openms/display-modes-and-view-options.md, doc/openms/docs/getting-started/visualize-with-openms/views-in-toppview.md
Documents precursor hover behavior (RT/m/z/charge display), isolation window visualization, and a new isobaric m/z reference (TMT/iTRAQ) overlay for the 1D view.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Plot2DCanvas
  participant findNearestPrecursor_
  participant highlightPrecursor_
  participant Painter2DBase

  User->>Plot2DCanvas: mouseMoveEvent
  Plot2DCanvas->>findNearestPrecursor_: search nearest precursor (pixel tolerance)
  findNearestPrecursor_-->>Plot2DCanvas: PeakIndex + dist_sq
  Plot2DCanvas->>Plot2DCanvas: compare precursor vs peak distance
  Plot2DCanvas->>Plot2DCanvas: set selected_precursor_ or selected_peak_
  Plot2DCanvas->>Plot2DCanvas: paintEvent triggered
  Plot2DCanvas->>highlightPrecursor_: highlight selected_precursor_
  Plot2DCanvas->>Painter2DBase: paintPrecursorPeaks_ (draw isolation window)
  Plot2DCanvas-->>User: render RT/m/z/charge coordinates
Loading

Suggested reviewers: timosachsenberg

Poem

A rabbit hopped through peaks and scans,
Found precursors with tiny paws and plans,
Dashed lines for windows, ellipses of red,
RT and m/z now clearly said!
Hop hop hurray, the canvas gleams,
🐇✨ precursor-highlighted dreams.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding MS2 precursor position highlighting in TOPPView.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@timosachsenberg
timosachsenberg merged commit cc0bfb4 into OpenMS:develop Jul 9, 2026
42 checks passed
timosachsenberg added a commit that referenced this pull request Jul 10, 2026
Adds entries for PRs merged in the last couple of days that were missing
changelog coverage: the TOPPView precursor-highlighting feature (#9715),
the Xerces-C++ PRIVATE-linkage/XMLHandler API change (#9712, which also
supersedes a stale note left by the LibSVM PRIVATE-linkage entry), the
FragmentMassError variance fix (#9618), the PepXMLFile duplicate Comet
metavalue fix (#9089), and the clang/OpenMP and TextExporter USI
documentation additions (#9162, #9173).

Co-authored-by: Claude <[email protected]>
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