Repository navigation
Add molecular multiplier support for multimer adduct annotation - #8431
Closed
timosachsenberg with Copilot wants to merge 5 commits into
Closed
timosachsenberg with Copilot wants to merge 5 commits into
timosachsenberg with Copilot wants to merge 5 commits into
Conversation
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
…liteAdductDecharger - Add mol_multiplier_ field to Adduct class for multimer support (e.g., [2M+H]+) - Add getMolMultiplier()/setMolMultiplier() methods to Adduct class - Extend toAdductString() to include molecular multiplier in annotation - Add getMaxMolMultiplier() method to Compomer class - Update MetaboliteFeatureDeconvolution to parse mol_multiplier from adduct config - Add max_multimer parameter for configuring multimer detection - Annotate features with mol_multiplier metadata when detected - Update Adduct tests for new mol_multiplier functionality Co-authored-by: timosachsenberg <[email protected]>
…y valid values Co-authored-by: timosachsenberg <[email protected]>
Copilot
AI
changed the title
[WIP] Add multimer annotation support for MetaboliteAdductDecharger
Add molecular multiplier support for multimer adduct annotation
Dec 5, 2025
Contributor
|
for discussion... actual issue would also need implementation in decharger. @cbielow or @FabianAicheler |
timosachsenberg
marked this pull request as ready for review
February 2, 2026 14:37
timosachsenberg
added a commit
that referenced
this pull request
Mar 11, 2026
Design for mass-aware multimer detection (dimers, trimers, etc.) in the MetaboliteFeatureDeconvolution algorithm. Uses exact algebraic M cancellation for cross-multiplier matches, controlled by max_multimer parameter (default 1 preserves backward compatibility). Supersedes PR #8431's cosmetic-only approach. Co-Authored-By: Claude Opus 4.6 <[email protected]>
timosachsenberg
added a commit
that referenced
this pull request
Mar 11, 2026
Design for mass-aware multimer detection (dimers, trimers, etc.) in the MetaboliteFeatureDeconvolution algorithm. Uses exact algebraic M cancellation for cross-multiplier matches, controlled by max_multimer parameter (default 1 preserves backward compatibility). Supersedes PR #8431's cosmetic-only approach. Co-Authored-By: Claude Opus 4.6 <[email protected]>
timosachsenberg
added a commit
that referenced
this pull request
Mar 12, 2026
* docs: add multimer detection design for MetaboliteAdductDecharger Design for mass-aware multimer detection (dimers, trimers, etc.) in the MetaboliteFeatureDeconvolution algorithm. Uses exact algebraic M cancellation for cross-multiplier matches, controlled by max_multimer parameter (default 1 preserves backward compatibility). Supersedes PR #8431's cosmetic-only approach. Co-Authored-By: Claude Opus 4.6 <[email protected]> * docs: add multimer detection implementation plan 9-task TDD plan covering: Compomer::getSideMass(), ChargePair multiplier fields, Adduct::toAdductString with multiplier, MassExplainer::queryMultimer(), MetaboliteFeatureDeconvolution parameter wiring, candidateEdges_() multiplier loop, annotation updates, and integration tests. Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add Compomer::getSideMass() for per-side adduct mass computation Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add static Adduct::toAdductString with multiplier for multimer annotation Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add mol_multiplier fields to ChargePair for multimer edges Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add MassExplainer::queryMultimer() for cross-multiplier matching Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add max_multimer and multimer_log_penalty parameters Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: wire multimer detection into candidateEdges_() with queryMultimer Add multiplier loop (n1, n2) around the MassExplainer query in candidateEdges_(). Same-multiplier (n1==n2) uses existing binary search path unchanged. Cross-multiplier (n1!=n2) uses queryMultimer() with exact algebraic M cancellation. Extract hit processing into lambda for shared use by both paths. Apply multimer_log_penalty to edge score for cross-multiplier edges. Set multiplier info on ChargePair for downstream annotation. Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: annotate features with multiplier from ChargePair for multimer labels Pass mol_multiplier from ChargePair through annotate_feature_() to produce [2M+H]+ style adduct strings via static Adduct::toAdductString. Set mol_multiplier metadata on features with multiplier > 1. Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add multimer integration test and fix review issues - Add end-to-end integration test for cross-adduct multimer detection ([M+Na]+ monomer / [2M+H]+ dimer) with regression test for max_multimer=1 backward compatibility - Fix ILP penalty: use multiplicative exp(penalty) instead of additive to keep edge scores positive for the ILP maximizer - Skip redundant same-multiplier queries (n1=n2>1 produces identical edges to n1=n2=1 since M cancels identically) - Eliminate toAdductString code duplication: 2-param delegates to 3-param Co-Authored-By: Claude Opus 4.6 <[email protected]> * docs: add plan for multimer test gaps and same-adduct fix Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add conditional identity compomers to MassExplainer for same-adduct multimers Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: enable identity compomers when max_multimer > 1 Co-Authored-By: Claude Opus 4.6 <[email protected]> * test: add comprehensive multimer detection tests - Same-adduct multimer [M+H]+ / [2M+H]+ (identity compomers) - Annotation strings and trimer detection (n=3) - Extreme penalty suppresses multimer edge selection - Negative mode multimer [M-H]- / [2M-H]- - Mixed-charge multimer [M+H]+ / [2M+2H]2+ Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: copy max_neutrals_ in MassExplainer::operator= and strengthen test assertions - Add missing max_neutrals_ to assignment operator (pre-existing bug) - Make adducts annotation checks unconditional in trimer test Co-Authored-By: Claude Opus 4.6 <[email protected]> * docs: clarify identity compomer placement relative to neutral adduct loop Co-Authored-By: Claude Opus 4.6 <[email protected]> * chore: remove implementation plan documents Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: address review findings from PR #8888 - Replace pre-existing std::cout with OPENMS_LOG_DEBUG in MassExplainer - Remove redundant best_hit tracking in same-multiplier path - Tighten integration test assertions to verify exact group sizes - Add queryMultimer unit test with non-zero net_charge Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: include mol_multiplier in ILP variant key to prevent contradictory assignments Without the multiplier in the variant key, the ILP could activate edges that assign the same feature different multipliers simultaneously (e.g., both monomer and dimer). Adding _m{multiplier} to the variant string forces the solver to choose a single consistent interpretation per feature. Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: enumerate all same-adduct compomer amounts for charge-changing multimers The identity compomer loop previously only generated A1_LEFT/A1_RIGHT, which limited multimer detection to same-charge pairs like [M+H]+ <-> [2M+H]+. Now enumerates Ai_LEFT/Aj_RIGHT for all valid amounts (bounded by charge_max), enabling detection of charge-changing multimers like [M+H]+ <-> [2M+2H]2+ common in lipidomics (e.g. phospholipid dimers with divalent cations). Tightens the mixed-charge test tolerance from 0.5 to 0.01 Da so the correct H1_LEFT/H2_RIGHT compomer is required (the old loose tolerance allowed a spurious match via H1_RIGHT with ~1 Da residual). Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MetaboliteAdductDecharger cannot annotate multimeric adducts like [2M+H]+. While the adduct TSV files already contain these entries (e.g.,
2M+H;1+), theAdductclass used byMetaboliteFeatureDeconvolutionhas no concept of molecular multipliers.Changes
Adduct class
mol_multiplier_field (default=1) for representing dimers, trimers, etc.getMolMultiplier()/setMolMultiplier()accessorstoAdductString()to format multimer annotations correctlyCompomer class
getMaxMolMultiplier(side)to retrieve max multiplier from adducts on a given sideMetaboliteFeatureDeconvolution
max_multimerparameter for future multimer detection configurationmol_multipliermetadata when presentUsage
Note
This PR adds the API infrastructure. Full automatic detection of monomer-multimer relationships (features with mass ≈ n×M) requires additional MassExplainer algorithm changes, as the current edge-finding logic assumes neutral mass M cancels out between features.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.