Skip to content

Count SPS precursors matching identified peptide fragments in SPS-MS3 - #9706

Merged
timosachsenberg merged 3 commits into
developfrom
copilot/count-ms2-fragment-matching
Jul 6, 2026
Merged

timosachsenberg merged 3 commits into
developfrom
copilot/count-ms2-fragment-matching

Conversation

Copilot AI commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

For SPS-MS3 (Synchronous Precursor Selection) experiments, there was no way to estimate how many of the fragments co-isolated for the MS3 reporter scan actually originate from true fragments of the identified peptide — a useful QC metric for reporter-ion quantification.

Changes

  • PrecursorPurity::countSPSPrecursorsMatchingPeptideFragments() — new static method that generates theoretical b/y fragment m/z for the peptide (via TheoreticalSpectrumGenerator::getPrefixAndSuffixIonsMZ, sorted) and counts how many of an MS3 spectrum's Precursor (SPS) windows match a fragment within tolerance, up to max_fragment_charge. Matching uses binary search; tolerance supports ppm or Da.
  • IsobaricWorkflow — opt-in count_sps_matches flag (off by default) plus advanced sps_fragment_mass_tolerance / sps_fragment_mass_tolerance_unit params. When enabled and MS3 is present, stores sps_matched_ions and sps_precursor_count meta values per consensus feature. Default output is unchanged. Fragment charge considered is derived from the ID precursor charge (max(1, z-1)).
  • Tests — PrecursorPurity_test.cpp section covering empty inputs, matching/non-matching peaks, Da/ppm tolerances, charge handling, and a TSG self-consistency check.
  • CHANGELOG entry.

API

// count how many SPS windows of an MS3 scan match a b/y fragment of the peptide
Size n = PrecursorPurity::countSPSPrecursorsMatchingPeptideFragments(
  ms3_spec.getPrecursors(), peptide_seq,
  /*tol=*/20.0, /*ppm=*/true, /*max_fragment_charge=*/z - 1);

The counting logic lives in PrecursorPurity (reusable outside the tool), mirroring the existing precursor-purity approach of iterating a spectrum's Precursor list.

Copilot AI changed the title [WIP] Add counting of matching MS2 fragments for MS3 scan in IsobaricWorkflow Count SPS precursors matching identified peptide fragments in SPS-MS3 Jul 3, 2026
Copilot AI requested a review from jpfeuffer July 3, 2026 09:13
@timosachsenberg

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

@timosachsenberg
timosachsenberg merged commit d72fd68 into develop Jul 6, 2026
9 checks passed
@timosachsenberg
timosachsenberg deleted the copilot/count-ms2-fragment-matching branch July 6, 2026 06:51
timosachsenberg added a commit that referenced this pull request Jul 13, 2026
… (#9731)

Backfill CHANGELOG coverage for recently merged PRs that lacked entries:
Docker Arrow APT source fix (#9728), TOPPBase external-tool refactor
(#9621), cross-reference the SPS precursor-matching feature to its PR
(#9706), and note the pyOpenMS binding for addChargeAdduct (#9719).


Claude-Session: https://claude.ai/code/session_012umKmTwmgGLGShG6wyQjxQ

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.

Count number of matching MS2 fragments used for MS3 scan in MS3-SPS

3 participants