Repository navigation
[FIX] MapAlignerIdentification: align to the best-overlapping input run when no reference is given - #10316
Conversation
…o reference is given Without a reference, MapAlignmentAlgorithmIdentification aligned every run to per-peptide median RTs over all runs. Which run supplies a peptide's median changes from peptide to peptide, and the run being aligned is one of the candidates, so the trafo data points split into parallel bands and larger RT shifts between runs were only partly corrected (#2541; in simulations about a tenth of the offset between runs remained after one pass). Now the input with the most identified sequences becomes the reference (the first one on ties), as ProteomicsLFQ ('star' alignment) and MS1LabeledWorkflow already documented. The consensus remains available as the new parameter 'auto_reference' = 'consensus'. A reference taken from the inputs no longer carries over into later align() calls. Fixes #2541 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gk4HywNyfqiiq6gFZxUafB
- TOPP_MapAlignerIdentification_1 and _5 run with
'-algorithm:auto_reference consensus' and keep their reference files, so
the consensus mode stays covered and is shown to be unchanged.
- New TOPP_MapAlignerIdentification_9: without a reference, the first of two
inputs with equally many identified sequences becomes the reference; the
output equals test 3, which sets that input as reference explicitly.
- ProteomicsLFQ reference files ('star' alignment now aligns to the run with
most IDs, as documented). Only aligned retention times, the linker's
consensus quality values and, in the untargeted tests 3/3_seedRT, the
grouping of unidentified features changed. Feature, peptide and protein
intensities and the sets of identified features and PSMs are unchanged;
tests 3/3_seedRT keep all 304/279 features and link more unidentified ones
across all three runs (unlinked: 130 -> 121, 111 -> 104). Tests 2 and 5 have
at most 10 alignment points per run, so no RT model is fitted there; only
the linking tolerance (deviations from the reference instead of from the
consensus) and with it the quality values changed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gk4HywNyfqiiq6gFZxUafB
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughMapAlignerIdentification now selects an input map by shared-sequence overlap when no reference is supplied. It retains consensus alignment as an option and uses it under specified overlap and alignment-point conditions. Tool documentation, tests, and ProteomicsLFQ expected outputs are updated. ChangesIdentification-Based RT Alignment
Sequence Diagram(s)sequenceDiagram
participant Aligner as MapAlignmentAlgorithmIdentification
participant Maps as Input maps
participant Consensus as Consensus reference
Aligner->>Maps: Compare shared identified sequences
Aligner->>Maps: Compute transformations with selected map
Aligner->>Aligner: Check alignment-point threshold
Aligner->>Consensus: Retry consensus when needed
Consensus-->>Aligner: Return consensus-based transformations
Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable issue remains from this review. The PR is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The revised policy can change alignment results across workflows, but the review found no demonstrated expansion of access or authority. Evidence about deployment exposure and recovery after failures remains limited. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The alignment code, documentation, tests, and RT-dependent expected-output changes support [ Full details: Docstring CoverageExplanation Docstring coverage is 29.41% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. A rabbit checks the runs at dawn Comment |
|
Update: resolved. The Windows tarball was back on the contrib release, the re-run passed, and the wheel builds on the current head (1cb03fa) are green.
This isn't caused by the PR: the same step passed at 15:42–15:54 UTC on other PRs' wheel runs (e.g. #10248, #9966). So the latest OpenMS/contrib release has lacked its Windows tarball since then. Nothing in this diff touches the wheel workflow or contrib. No fix exists in this repository yet. The job needs the Windows tarball back on the latest contrib release, or the workflow pinned to a release that has it. I'll re-run the failed job once the asset is available again. Generated by Claude Code |
timosachsenberg
left a comment
There was a problem hiding this comment.
Adversarial review of 08ee243, focusing on correctness rather than style. I reproduced one regression in the new automatic reference selection: a connected set of runs can lose all alignment points for one run even though another input would be a usable reference for every run. Details and a reproducible fixture are inline.
Validation: compiled this PR's MapAlignmentAlgorithmIdentification implementation in a local C++ harness against an existing OpenMS build; compared the new default, explicit reference selection, and the retained consensus mode. This was a targeted check, not a full build of the PR.
…e every input can be aligned to The input with the most identified sequences can share few or no sequences with another input, e.g. when many of its IDs are its own. That input then got no alignment points, so fitting its transformation failed (MapAlignerIdentification aborted with "'b_spline' model requires more data") or it stayed unaligned (ProteomicsLFQ, MS1LabeledWorkflow), as the review of #10316 showed. The automatic reference is now the input whose smallest number of shared sequences with any other input is largest, counting only the sequences the alignment uses (min_run_occur); ties go to the input with the most identified sequences, then to the first. If no input shares at least two sequences with every other input, the inputs are aligned to the consensus instead. The unreleased parameter value 'most_ids' is renamed 'best_run'. A new class test covers both cases, with the overlap pattern from the review. The ProteomicsLFQ, MS1LabeledWorkflow and MapAligner* TOPP tests pass unchanged: the new rule picks the same references there. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gk4HywNyfqiiq6gFZxUafB
… if the automatic reference provides too few alignment points With 'auto_reference best_run', an input that shares only a few sequences with the chosen reference gets only a few alignment points, and ProteomicsLFQ and MS1LabeledWorkflow do not fit an RT model to 10 or fewer. The new parameter 'auto_reference_min_points' (default 11) sets how many points the chosen input should provide for every other input, counted after the 'max_rt_shift' outlier filter. If an input gets fewer, a consensus of all inputs is computed as well and used if it raises the smallest number of alignment points of any input. A run with few IDs overall gets no more points from a consensus either, so it does not pull the other runs back to the consensus. selectReference_() now only chooses the reference; the new alignToAutoReference_() aligns to it and falls back if needed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gk4HywNyfqiiq6gFZxUafB
|
Independent review and simulations of c30617f. I would request changes for one confirmed regression. The simulations otherwise strongly support the main approach. 1. [P2] A sparse run can prevent recovery of another runThe fallback compares only the smallest point count. An intrinsically sparse run can keep that minimum unchanged even when another run would gain enough points to fit a model. Reproducer with disjoint sequence sets X (30), Y (5), W (30), Z (2), and U (100):
Assign sequence indices X=0–29, Y=30–34, W=35–64, Z=65–66, U=67–166, and RT All candidate references have minimum overlap 2 because of D. A wins the ID-count tie-break.
The fallback is attempted but rejected because both minima are 2. ProteomicsLFQ and MS1LabeledWorkflow only fit transformations with more than 10 points, so B remains untransformed and retains its 180-second offset. Explicitly choosing C reduces the spread among A/B/C to below 0.002 seconds at the 95th percentile. D is intrinsically too sparse for the workflow fit under every strategy. I reproduced the same counts using FeatureMaps with Suggested fix: assess recoverable deficiencies per run and try alternative references. An intrinsically sparse run should not mask another run crossing the fitting threshold. Please add a test containing both a sparse run and a second, recoverable under-covered run. 2. Remaining limitation: reference selection ignores RT filteringThe reference ranking counts shared sequences before RT filtering. A second fixture has four runs containing the same 100 sequences, with RTs evenly spaced from 300 to 3300 seconds and offsets
Fitting all transformations, as MapAlignerIdentification does, throws Legacy consensus also fails this fixture, so this is a remaining robustness gap, not a newly introduced regression. Evaluating alternative candidates after RT filtering would avoid it. Independent simulation resultsI ran 60 independent five-run synthetic datasets: 20 deterministic seeds each for constant offsets, offsets plus gradient scaling, and additional nonlinear drift. Each dataset has 2,000 possible peptide IDs, independent 60% ID detection per run, and Gaussian RT noise with standard deviation 1 second. Evaluation uses 351 held-out RT grid points per run with independent noise. Both modes use the actual OpenMS default B-spline model. Mean of the per-dataset median inter-run RT spreads:
No fitting errors occurred in these 120 head-implementation comparisons. The retained consensus mode matched the separately compiled base implementation's printed transformed values and point counts in the comparisons performed. Validation scope: compiled the actual head and base alignment implementations against the same existing OpenMS library, with class-symbol renaming to isolate the reviewed implementations. The complete PR alignment class test passed. The workflow fit gate was reproduced in the native harness, including FeatureMap checks. This was a targeted native build, not a full PR/workflow build or real-data feature-linking benchmark. |
…e first choice leaves recoverable inputs short The fallback of c30617f compared only the smallest number of alignment points, so an input with few IDs overall could hide another input that a different reference would give enough points: with a sparse run D and the first choice A leaving run B with 7 points, the consensus was rejected, although run C as reference gives A and B 32 points each. Now, if the first choice leaves inputs with fewer than 'auto_reference_min_points' points, and one of them shares at least that many sequences with other inputs (the most any reference can give it), every input and a consensus are tried as the reference. The one that gives the most inputs at least that many points is used (the reference counts); on ties, the first choice is kept, then the one whose weakest covered input has the most points, and an input is preferred over the consensus. The candidates are compared after the 'max_rt_shift' outlier filter, so a run shifted beyond the filter for the first choice no longer ends up with zero points when another run would align all of them. computeTransformations_() gets a 'verbose' switch so that the candidates are evaluated without log output. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gk4HywNyfqiiq6gFZxUafB
|
Thanks, both confirmed with your fixtures, which are now class tests, and fixed in 5381c9e. 1. A sparse run hiding a recoverable one. The fallback no longer compares only the smallest point count. If the first choice leaves inputs below 2. RT filtering. The candidates are compared by their points after the Some notes on scope and cost:
Generated by Claude Code |
Description
Fixes #2541. Without a reference,
MapAlignmentAlgorithmIdentificationaligned every run to per-peptide median RTs over all runs. That target is not one consistent RT scale: which run supplies a peptide's median depends on which runs identified it, so a run's trafo data points split into parallel bands. The run being aligned is also part of every median it is compared against, so it pulls the target towards itself. In simulations, one pass left about 10% of the RT offset between runs uncorrected (details, figures and scripts in this comment).ProteomicsLFQ (default
alignment_order=star) and MS1LabeledWorkflow use this code path, and their docs already say they align to a single reference run. This PR makes that true:best_run): without a reference file or index, the input that shares the most identified sequences with every other input becomes the reference. That is the input whose smallest overlap with any other input is largest, counting only sequences that passmin_run_occur; ties go to the input with the most identified sequences, then to the first. Every other run is fitted against a single consistent scale that it doesn't contribute to.auto_reference_min_pointssets how many alignment points the reference should give every other input, counted after themax_rt_shiftoutlier filter. The default, 11, is the smallest number of points to which ProteomicsLFQ and MS1LabeledWorkflow fit an RT model. If the first choice leaves inputs short, and one of them shares at least that many sequences with other inputs, every input and the consensus are tried as the reference. The choice that gives the most inputs enough points is used; the reference counts. On ties, the first choice is kept, then the one whose weakest covered input has the most points, and an input is preferred over the consensus. A run with few IDs overall, e.g. a failed injection, can't reach the threshold with any reference, so it doesn't trigger this search.auto_reference=consensus(defaultbest_run). Both new parameters are advanced in ProteomicsLFQ and MS1LabeledWorkflow.align(), so it no longer leaks into later calls as if it were an external reference.Simulation: 5 runs with RT shifts of ±180 s, run through the patched
MapAlignerIdentification.-algorithm:auto_reference consensusit reproduces the nightly's result exactly: 35 s RT spread left between runs.Tests:
MapAlignmentAlgorithmIdentification_testcovers the new default: a tie picks the first map, a map with more IDs wins, and the picked reference doesn't carry over into the next call. The consensus part now setsauto_referenceexplicitly.auto_reference_min_points:max_rt_shiftfor the first choice makes the central run the reference: every run gets 100 points, instead of 0 for one.TOPP_MapAlignerIdentification_1and_5set-algorithm:auto_reference consensusand keep their reference files, so the consensus mode stays covered and is shown to be unchanged.TOPP_MapAlignerIdentification_9runs without a reference and must reproduce test 3, which sets the same input as reference explicitly.qualityvalues and, in the untargeted tests 3 and 3_seedRT, the grouping of unidentified features changed.qualityvalues changed; the tolerance is now derived from deviations to the reference instead of to the consensus.How this was tested:
Checklist
align()docstring changed; the new parameters are set throughParam)How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkinswill retrigger Jenkins-based CI builds🤖 Generated with Claude Code
https://claude.ai/code/session_01Gk4HywNyfqiiq6gFZxUafB
Summary by CodeRabbit