Skip to content

Add an Open Search preset and a Mass Shifts page that matches shifts to Unimod - #49

Closed
t0mdavid-m wants to merge 1 commit into
mainfrom
claude/parity-open-search
Closed

t0mdavid-m wants to merge 1 commit into
mainfrom
claude/parity-open-search

Conversation

@t0mdavid-m

@t0mdavid-m t0mdavid-m commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Before: the search only finds the modifications you configure, and there is no way to see which unexpected ones are in a sample. The precursor tolerance isn't shown on the Configure page.

After:

  • Open Search preset on Configure. It sets Comet's precursor tolerance to ±500 Da (precursor_error_units Da, isotope_error off) for both the label-free and TMT searches.
  • Closed Search preset that restores the defaults (20 ppm label-free, 4.5 ppm TMT, isotope errors 0/1).
  • The CometAdapter tabs now show precursor_mass_tolerance, precursor_error_units and isotope_error.
  • New Mass Shifts page under Workflow Results. It takes each filtered target PSM's precursor mass shift (observed − theoretical) and shows four things:
    • Key figures: target PSMs, shifts found, PSMs carrying a modification shift, and shifts with no Unimod match.
    • A stick histogram (OpenMS-Insight LinePlot) with each shift's peak labelled.
    • A shift table (Insight Table) with the observed Δ, PSMs, interpretation, Unimod Δ, deviation in mDa, residues and other candidate modifications.
    • The PSMs of the selected shift. Clicking a peak or a shift row filters this list.
  • After a closed search, the page shows the 0 Da and isotope peaks and points to the Open Search preset.

How: src/common/mass_shifts.py is Streamlit-free.

  • Grouping: sorted shifts more than 20 mDa apart start a new group. A group with two peaks is split at the valley between them (1 mDa histogram, smoothed), so deamidation (+0.984 Da) and a 13C pick (+1.003 Da), which are 19 mDa apart, stay separate. One noisy peak is never split: I checked 200 random seeds at 8–2000 PSMs each.
  • Interpretation: shifts within 20 mDa are matched via pyOpenMS ModificationsDB.searchModificationsByDiffMonoMass, one entry per Unimod name. Common modifications rank first, and PSI-MOD duplicates are dropped. Shifts at 0 Da and at 1, 2 or 3 × 13C are labelled as such. When an isotope pick and a modification both fit, the closer one wins and the other is listed.
  • Caching: the page caches on the idXMLs' modification times. Insight caches are keyed on the results and the detected shifts.

Validation:

  • tests/test_mass_shifts.py has 8 tests:
    • reading shifts from idXML and skipping decoys
    • Unimod ranking
    • detection and interpretation of 0 Da, oxidation, the isotope peak and ammonia loss
    • deamidation vs isotope separation
    • one noisy peak staying whole
    • an unexplained shift
    • the presets' values against CometAdapter's valid strings, checked against src/topp/CometAdapter.cpp on release/3.5.0
  • pytest tests/ passed 121 tests.
  • pylint --errors-only reports only the usual E0611 false positives on pyopenms imports.
  • I rendered the page in Chromium with 1,500 synthetic open-search PSMs across 11 shifts plus random noise. Shifts, interpretations and residues came out as planted. Clicking the Oxidation row listed its +15.995 PSMs.

Not tested end to end: a real Comet run with the preset, since the TOPP tools aren't available in my environment.


Generated by Claude Code

@t0mdavid-m t0mdavid-m self-assigned this Oct 28, 2026
@coderabbitai

coderabbitai Bot commented Oct 28, 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: 1f7753a6-7a3c-426c-b4e2-1de49aa75404
  • 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

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

t0mdavid-m commented Oct 28, 2026 •

Copy link
Copy Markdown
Member Author

test-nginx (full, amd64, ubuntu-latest) failed before any test ran. kind load image-archive hit a truncated image blob (short read: expected 2075605504 bytes but got 1182910400: unexpected EOF), so the cluster never got the image. This PR changes no Docker, CI or k8s files.

Update: the one re-run of that job passed, so every check on this PR is green.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

Included in #52, which is merged. Closing.


Generated by Claude Code

@t0mdavid-m t0mdavid-m closed this Oct 30, 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