Skip to content

Previous/Next through the PSM table, and a breadcrumb to the PSM - #82

Closed
t0mdavid-m wants to merge 1 commit into
claude/filter-barfrom
claude/psm-navigation
Closed

t0mdavid-m wants to merge 1 commit into
claude/filter-barfrom
claude/psm-navigation

Conversation

@t0mdavid-m

Copy link
Copy Markdown
Member

Stacked on #81 (it steps through #81's filtered PSM table), which is stacked on #73. Merge those first and GitHub retargets this one.

Before: to look at the next PSM you had to find and click its row in the table. On the Identified proteins page, the spectrum at the bottom didn't say which protein and peptide it was reached from.

After:

  • Previous / Next sit below the PSM table on the Peptide-spectrum matches page and under the spectrum heading on the Identified proteins page. They select the PSM one row up or down in the PSM table, in the order the viewer sees it: their sort (e.g. after clicking the m/z header), the column filters, the filter bar from Search and filters in the PSM and protein tables' own filter menu #81, the contaminant switch and, on the protein page, the selected protein and peptide. The table pages to the new row and highlights it, the spectrum, sequence view and fragment ions follow, and "PSM 4 of 53 in the table's order" says where you are. The buttons are disabled at either end.
  • On the Identified proteins page, a breadcrumb above the spectrum names how the PSM was reached: Proteins › sp|P00915|CAH1_HUMAN (CA1) › LFQFHFHWGSTNEHGSEHTVDGVK › PSM scan 52107 · B000264…. Each part jumps to its section (protein table, coverage, peptide table).

How: src/common/psm_navigation.py uses openms-insight 0.4.0's own API. Table.export_data(state_manager.get_all_selections()) returns the rows with the same linked filters, range/toggle filters, column filters and sort the table applies. The step then calls StateManager.set_selection() for each of the table's interactivity identifiers, as a click on that row would. No new component was needed. The breadcrumb is a row of anchor links to explicit st.subheader(..., anchor=...) ids. show_insight_table now returns the Table it rendered.

One fix in openms-insight's behaviour was needed: the Vue table highlights the first row matching the first interactivity identifier that has a selection. The PSM table's identifiers start with file, so a PSM selected from Python (or from the plot) highlighted the file's first PSM while the spectrum showed the right one. The filtered PSM table from #81 now lists the identifier of its index field (identification → id_idx) first, and the highlight follows. Upstream, the table could match all identifiers, or prefer the index field.

proteins page

psm page

Proteins page: 4th PSM of the peptide, breadcrumb PSM page: sorted by m/z, after Next ×2

Videos (mp4): proteins page, PSM page

Testing

  • Real 4-file LFQ run, driven in headless Chromium:
    • Identified proteins, CAH1 › LFQFHFHWGSTNEHGSEHTVDGVK (53 PSMs): Next ×3 showed scans 51974 → 52025 → 52035 → 52107 ("PSM 4 of 53") with the table row highlighted; Previous went back to 52035.
    • The "Proteins" crumb scrolled the page from 2156 px to the protein table (URL #proteins).
    • PSM page, file B000248 (1,013 PSMs): after sorting by m/z, the selected VVDVLDSIK was "PSM 128 of 1,013", and Next ×2 gave 129 and 130 (m/z 494.2909, 494.2910), highlighted in the table.
    • Before the interactivity-order fix the highlight stayed on row 1. After it, it follows.
  • New tests/test_psm_navigation.py (2 tests): neighbours in the initial order, at both ends, under the viewer's sort (desc m/z), under a linked filter (selected peptide), with float selection values from the browser, and a row the filters hide.
  • python -m pytest tests/ test_gui.py: 324 passed, 1 skipped. pylint --errors-only: only the existing E0611 errors on pyopenms imports.

Generated by Claude Code

On the Peptide-spectrum matches page and under the spectrum on the
Identified proteins page, Previous and Next select the PSM one row up
or down in the PSM table, in the order the viewer sees it: Insight's
Table.export_data applies the linked filters, the range and toggle
filters, the column filters and the viewer's sort. The table pages to
the new row and the spectrum and sequence views follow it; "PSM i of n"
says where it is.

On the Identified proteins page a breadcrumb above the spectrum
(Proteins › protein › peptide › PSM) names how the PSM was reached,
and each part jumps to its section.

The filtered PSM table lists the identifier of its index field first
in its interactivity, since the table highlights the first row matching
the first identifier that has a selection: with "file" first, a PSM
selected from elsewhere highlighted the file's first row.
show_insight_table now returns the Table it rendered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5Wo2FHPpi5a8X6GppNxEk
@t0mdavid-m t0mdavid-m self-assigned this Nov 2, 2026
@t0mdavid-m t0mdavid-m closed this Nov 2, 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