Skip to content

Download a PSM's spectrum as SVG - #104

Open
t0mdavid-m wants to merge 2 commits into
mainfrom
claude/spectrum-svg
Open

t0mdavid-m wants to merge 2 commits into
mainfrom
claude/spectrum-svg

Conversation

@t0mdavid-m

Copy link
Copy Markdown
Member

Before: the MS2 spectrum of a peptide-spectrum match, the measured spectrum mirrored against the AlphaPeptDeep prediction, could only be saved as a PNG through the plot's camera button. A PNG can't be edited or scaled for a figure.

After: the plot's toolbar has a "Download as SVG" button. It saves a standalone, editable vector file, named after the match, e.g. VVDVLDSIK_2+_scan52580.svg, with both spectra, the ion labels and the axes. It appears on every page that shows a PSM spectrum.

How: OpenMS-Insight's MirrorPlot gained the button and an svg_filename option in Insight #29. show_spectrum passes svg_name(peptide, charge, scan). Modifications in the name become hyphens, e.g. PEPM-Oxidation-TIDEK_3+_scan7, and characters a file system might reject are dropped. Insight #29 is on Insight main but not yet on PyPI, so requirements.txt installs the same development build of Insight main as #81. The two pins are identical, so the PRs merge cleanly in either order. Before an app release, the pin should go back to the next PyPI version.

When AlphaPeptDeep is not installed, the page shows the plain annotated spectrum (Insight LinePlot). That plot has no SVG button yet; that would be a separate Insight change.

Checked:

  • New tests/test_spectrum_svg_name.py, 3 tests: a plain peptide, modification brackets and parentheses, and unsafe characters.
  • Full suite with the development build installed: 607 passed.
  • py_compile passes on the content pages, and pylint errors-only is clean on the changed files.
  • In the app with AlphaPeptDeep, the "Peptide-spectrum matches" page shows the button. Clicking it saved VVDVLDSIK_2+_scan52580.svg, which opens as the full mirrored spectrum shown below.
The button The downloaded SVG
button svg

walkthrough

Video (mp4): https://raw.githubusercontent.com/OpenMS/quantms-web/claude/media-spectrum-svg/spectrum-svg.mp4 · The SVG itself: https://raw.githubusercontent.com/OpenMS/quantms-web/claude/media-spectrum-svg/VVDVLDSIK_2plus_scan52580.svg


Generated by Claude Code

The mirrored spectrum (measured against the AlphaPeptDeep prediction)
gets OpenMS-Insight's "Download as SVG" button, which saves a
standalone, editable vector file named e.g. PEPTIDEK_2+_scan1234.svg.
Modifications in the name become hyphens and other characters a file
system might reject are dropped (svg_name, with tests).

The button is in openms-insight main, not yet on PyPI, so requirements.txt
installs the same development build as the table filter menu PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D5Wo2FHPpi5a8X6GppNxEk
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

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: bdb2bda4-c5e7-43ab-8154-1d681bb2a5e5
  • 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

@t0mdavid-m t0mdavid-m self-assigned this Nov 4, 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