Repository navigation
[BREAKING,TEST] ProteomicsLFQ: stop normalizing; export raw intensities (#9864) - #9880
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughProteomicsLFQ no longer applies implicit per-fraction median normalization. Documentation and the changelog describe explicit alternatives. Regression tests verify stable QPX and mzTab outputs when auxiliary exports are requested. Median normalizer tests cover core operations and edge cases. ChangesProteomicsLFQ normalization
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/tests/class_tests/openms/source/ConsensusMapNormalizerAlgorithmMedian_test.cpp (1)
128-144: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMark the pinned defect so a future fix updates this test.
This block asserts the current defective reference selection as expected behavior. If someone repairs
computeMediansto use the actual handle counts, this section fails without an obvious pointer to the intent. Add aTODOmarker next to the assertion so the tracker link is visible at the failure site.♻️ Proposed change
vector<double> medians; + // TODO(issue `#9864`): update this expectation when the reference selection is fixed. TEST_EQUAL(ConsensusMapNormalizerAlgorithmMedian::computeMedians(map, medians, "", ""), 0)🤖 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/ConsensusMapNormalizerAlgorithmMedian_test.cpp` around lines 128 - 144, Add a TODO marker with the relevant OpenMS issue reference next to the computeMedians assertion in the degenerate-reference test block, clearly indicating that the expectation must be updated when reference selection uses actual handle counts.
🤖 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.
Nitpick comments:
In
`@src/tests/class_tests/openms/source/ConsensusMapNormalizerAlgorithmMedian_test.cpp`:
- Around line 128-144: Add a TODO marker with the relevant OpenMS issue
reference next to the computeMedians assertion in the degenerate-reference test
block, clearly indicating that the expectation must be updated when reference
selection uses actual handle counts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 871e555a-c869-4e76-8cbb-012c81bd1cf1
📒 Files selected for processing (5)
CHANGELOGsrc/tests/class_tests/openms/source/ConsensusMapNormalizerAlgorithmMedian_test.cppsrc/tests/topp/CMakeLists.txtsrc/tests/topp/ProteomicsLFQ_in_feat_multi_out.mzTabsrc/topp/ProteomicsLFQ.cpp
…es (OpenMS#9864) A median scaling ran over each fraction's consensus map unless -out_msstats or -out_triqler was requested. The same input written to the same -out_qpx directory therefore held normalized or raw intensities depending on whether an unrelated output file had also been asked for, and nothing recorded which: normalizeMaps() only calls setIntensity(), and the QPX schema has no field for a normalization. The gate is removed by deleting the normalization, not by normalizing unconditionally. Per-fraction normalization followed by the cross-fraction sum in PeptideAndProteinQuant is only ratio-preserving when the reference is the same sample in every fraction, which the map-index-0 reference does not guarantee for a non-rectangular design: on BSA_design_onetable_nonconsec.tsv the scaling moved feature intensities by a median factor of 5.3 and a maximum of 12.0 (rectangular BSA_design.tsv: 1.3 and 2.1). No comparable tool normalizes per fraction against a per-fraction reference run - MSstats and DIA-NN target a global median with no reference run, MaxQuant and FlashLFQ fit the fraction coefficients jointly with the fraction summation. Normalizing becomes an explicit step: ConsensusMapNormalizer on -out_cxml, the existing ProteinQuantification:consensus:normalize parameter, or the downstream tool's own normalization. Row counts and primary keys of the QPX views are unchanged; only values move. ProteomicsLFQ_in_feat_multi_out.mzTab is the only shipped reference that changes, in 10 abundance lines. New TOPP_ProteomicsLFQ_qpx_flags runs the same input twice, differing only in -out_msstats/-out_triqler, and requires the QPX feature and pg tables and the mzTab to be equal. Verified to fail for its stated reason: with the normalization call restored, all three comparisons go red. ConsensusMapNormalizerAlgorithmMedian had no test coverage at all - its two stub sections named signatures that no longer exist. It now has a class test pinning the per-map medians, the ColumnHeader::size-derived reference, the degenerate all-sizes-zero case (OpenMS#9864 A3, now latent since ProteomicsLFQ was its only live caller), the silent bail-out to all-1.0 medians, and that NM_SHIFT derives its own reference. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
a423f97 to
26aebf5
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
OpenMS#9880 (ProteomicsLFQ stops normalizing, exports raw intensities) landed on develop and changes the same lines as this branch. Two conflicts, both in files the two changes share: CHANGELOG -- both sides append bullets to the ProteomicsLFQ section. Kept both, develop's BREAKING entry first. ProteomicsLFQ_in_feat_multi_out.mzTab -- neither side's reference is correct after the merge. This branch's version has the deduplicated PSM rows and the q-values that follow from them; develop's still has the 18 duplicates but carries the raw, un-normalized intensities. Regenerated by running the merged tool, then verified to be exactly the composition of the two rather than accepted on the strength of the test going green: vs this branch's reference: the only fields that move are abundances (PEP col 19, PRT cols 13/17), and every one of them moves by the identical factor 1.583596 -- the fraction-2 median scaling OpenMS#9880 removed. No q-value and no row-set change. vs develop's reference: 18 fewer PSM rows (62 -> 44) and 36 q-value changes across the 18 shared PEP rows, and zero abundance differences. So the new reference is this branch's rows and q-values with develop's raw intensities, which is what the merged code should produce. The four whitelisted MTD lines (software[1..2], ms_run[1..2]-location) are kept in the reference's own form instead of the local build's version string and paths. src/topp/ProteomicsLFQ.cpp and src/tests/topp/CMakeLists.txt auto-merged; checked that OpenMS#9880's normalization removal and its five qpx_flags tests survive alongside this branch's -in_feat dedup and -out_feat tests. Local: TOPP_ProteomicsLFQ_{in_feat,out_feat}* 11/11, and 221/221 over QPX/Arrow/ParquetDiff/ProteomicsLFQ/ProteinQuantifier/IsobaricWorkflow/ MzTab/ConsensusMapNormalizer. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
Audited PRs merged since the last CHANGELOG update (#9881): most of them (#9879, #9880, #9882, #9884, #9886, #9892, #9896, #9898, #9900, #9901, #9888) already carried their own CHANGELOG entries. Only the Docker library-stage fix (#9891) was missing one. Claude-Session: https://claude.ai/code/session_01Jgrv6mFL3oawgLdYs1efPH Co-authored-by: Claude <[email protected]>
Implements the decision recorded in #9864 (comment) (§A4, §D5, item 1.4 of §G).
The problem
ProteomicsLFQapplied a median scaling to each fraction's consensus map — unless-out_msstatsor-out_triqlerwas requested:https://github.com/OpenMS/OpenMS/blob/develop/src/topp/ProteomicsLFQ.cpp#L1425-L1428
Traced end to end, that is a reproducibility defect rather than a stylistic question:
ConsensusMapArrowExportwrites intoquantms.feature.parquet(ConsensusMapArrowExport.cpp:1162writesfh->getIntensity(), andNM_SCALErewrites exactly that atConsensusMapNormalizerAlgorithmMedian.cpp:134), and whatPeptideAndProteinQuant::readQuantDataaggregates into the protein groups;normalizeMapsrecords nothing — it only callssetIntensity, leaving noDataProcessingentry and no meta value — andgrep -n normaliz src/openms/source/FORMAT/ArrowSchemaRegistry.cppreturns zero hits, so the QPX schema has no field for it either.Why the gate existed has never been documented (§D5).
Why deletion rather than "remove the gate"
Normalizing per fraction and then summing across fractions (
PeptideAndProteinQuant.cpp:380) is only ratio-preserving when the reference is the same sample in every fraction. The reference ismedians[index_of_largest_map], andindex_of_largest_mapdegenerates to 0 in the LFQ linking path (§A3), i.e. the lowest fraction group present in that fraction — a different sample per fraction under a non-rectangular design.Measured on this branch, before vs. after, via
ParquetDiff -out_tsv:TOPP_ProteomicsLFQ_qpxBSA_design_onetable_nonconsec.tsv(non-rectangular)TOPP_ProteomicsLFQ_qpx_seedsBSA_design.tsv(rectangular)Row counts and primary keys are identical in all four tables; the
psmview does not move at all. So this changes values only — nothing appears or disappears.No comparable tool picks a reference run per fraction. MSstats' default
equalizeMediansand DIA-NN's cross-run normalization target a global median with no reference run at all; MaxQuant's delayed normalization and FlashLFQ fit the per-fraction coefficients jointly with the fraction summation, precisely because per-fraction normalization followed by summation is not well defined. Reimplementing MaxLFQ here is out of scope, so the tool stops normalizing and the choice moves to the consumer.The capability is not lost
Three existing routes, none of them new:
ConsensusMapNormalizeron-out_cxml— median, quantile, robust regression or thresholded scaling;ProteinQuantification:consensus:normalize, already a registered user-visibleProteomicsLFQparameter, which normalizes at the (fraction group, label) assay level;The tool documentation now names all three in place of the paragraph describing the removed behaviour.
Test changes
TOPP_ProteomicsLFQ_qpx_flags(new) runs the same input twice, differing only in-out_msstats/-out_triqler, and requires the QPXfeatureandpgtables and the mzTab to be equal. Exact comparison on purpose — the two runs perform the same computation, so any tolerance would be tolerance for a transform that is not supposed to exist.Verified to fail for its stated reason, not merely to fail: with the normalization call restored and everything else untouched, all three comparisons go red; with it removed, all three pass.
ConsensusMapNormalizerAlgorithmMedian_test.cpp— this class had no coverage at all; its two non-trivial sections were// TODOstubs namingnormalizeMaps(ConsensusMap&)andcomputeNormalizationFactors(...), neither of which exists. It now pins:ColumnHeader::sizerather than of the handles actually present (all three maps hold three handles; only the stored sizes differ), including the>-tie going to the lowest index;0initializer the reference collapses to map 0 even though map 2 holds the most handles. This PR removes its only live caller —ConsensusMapNormalizer's consensusXML input restoressizeon read — so the section keeps the defect visible while it is latent;1.0medians when any map has no passing feature, and that it is a no-op rather than an error;NM_SHIFTscans for the largest median itself and so is unaffected by the size-derived reference;passesFilters_with and without an accession filter.Probed the same way: flipping the §A3 expectation makes the section fail.
Reference churn is one file.
ProteomicsLFQ_in_feat_multi_out.mzTab, 10 abundance lines. Patched line by line rather than regenerated — the 10 lines that move are disjoint from the 29 where the reference already differs from the output in whitelisted fields, so no unrelated drift is swept in. The other 12 of 19ProteomicsLFQproducers were already un-normalized: 10 request-out_msstats/-out_triqler, and_4/_6use spectral counting, which never reachesquantifyFraction_.Full local suite: 2813 tests, 8 failures, all in the known environmental baseline (6
CometAdapter_*_out1version-string,PercolatorAdapter_1_subprocess_outnumerics,Doxygen_Warning_testHAVE_DOT).doxygen-error.logholds only the two pre-existingHAVE_DOTwarnings.Notes for review
intensitymean" ambiguity unless the applied transform were also recorded in the output, which is §D3 and still open.develop. Expect a small textual conflict insrc/tests/topp/CMakeLists.txtwith [TEST,FIX] QPX: assert schema and a row-count floor instead of file existence (#9864 Phase 0.1) #9878, which rewrites the adjacent QPX assertion lines.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
Summary by CodeRabbit
Behavior Changes
Documentation
Tests