Repository navigation
[TEST] Point the FuzzyDiff caveat in ProteinQuantifier_29 at issue #9859 - #9860
timosachsenberg wants to merge 3 commits into
Conversation
Two defects in the '-ratios' / '-ratiosSILAC' columns, found while auditing the "a stored zero is not a detected peptide" fixes (#9851, #9852). Both are pre-existing and independent of those. 1. Undefined behaviour, and an unquantified protein reported as unchanged. total_abundances is deliberately sparse: calculateProteinAbundances_ skips a sample in which the protein has fewer than 'top:N' detected peptides. The ratio blocks read it with find(0)->second and find(0)/find(1)/find(2)->second and no end() check. The only guard is 'if (total_abundances.empty()) continue;', which says the map has some key, not key 0 -- and fifteen lines earlier the same map is read defensively for the abundance columns, so the writer contradicted itself. Where the key did exist as 0.0 ("not detected") the division gave +-inf or NaN; where it was absent the fallback printed 0.0, which in a log2-ratio column asserts the sample is exactly equal to the reference. Reproducible on the shipped fixture with stock defaults, exit code 0: "Protein" 1 0.9097 4 200.0 30.0 0.0 -inf -inf -2.7369655941662060 A ratio is now written only where both samples carry a positive abundance, and 'nan' otherwise, via SVOutStream::writeValueOrNan -- the missing-value convention MSstats and every comparable tool use. Ratios of quantified proteins are byte-identical: the original log(x)/log(2.0) is kept rather than std::log2, which can differ in the last ulp, and the self-ratio stays the bare int 0. 2. Value columns the header never emitted. writeProteinTableHeader_ emits the ratio names only in the branch it shares with the sample-level abundance columns -- not for 'file_and_channel_level_output', not for a single sample -- while the body wrote the values outside that branch split. '-ratios -file_and_channel_level_output true' produced a 7-field header over a 10-field row; pandas.read_csv then promotes column 0 to an index and shifts every value. The body now uses the header's guard. Tests. Neither defect was caught because TOPP_ProteinQuantifier_12/13, the only tests exercising these flags, both pass 'top:include_all' -- the one configuration in which no sample key can be missing. New _29 covers the sparse case (one finite ratio next to two nan, so the finite path is pinned too) and _30 the header/body mismatch. Note for anyone extending this: FuzzyDiff compares these files numerically and reports "No numeric differences were found" between 'nan' and '-inf', so a reference diff alone CANNOT fail on defect 1 -- _29_out1 passes against the old binary. _29_out2 asserts the token textually via FAIL_REGULAR_EXPRESSION, and that one does fail pre-fix, as does _30_out1. Whether these columns should exist at all is a separate question, raised in #9853: nothing in the tree consumes them, and the field exchanges intensities rather than precomputed ratios. 138 ProteinQuantifier / PeptideAndProteinQuant / IsobaricWorkflow / ProteomicsLFQ tests pass; no existing reference file changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VcFtJVe1PcMsBzMnnnpWBJ
The comment explaining why the reference diff alone cannot fail on defect 1 now
names OpenMS#9859, where the underlying comparator behaviour is tracked: any
numeric comparison involving NaN is accepted, so a value regressing to NaN is
invisible to all 778 ${DIFF} comparisons, not just this one.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01VcFtJVe1PcMsBzMnnnpWBJ
|
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 (5)
📝 WalkthroughWalkthroughProteinQuantifier now emits ChangesProteinQuantifier ratio output
Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1⚔️ Resolve merge conflicts 💡
📝 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. Comment |
One-line comment change. #9854 merged before this follow-up landed, so it is on its own.
src/tests/topp/CMakeLists.txt:2948explains whyTOPP_ProteinQuantifier_29_out1cannot fail on its own and is paired with a textual assertion. It now names #9859, where the underlying cause is tracked:FuzzyStringComparatoraccepts any numeric comparison involvingNaN, so a value regressing toNaNis invisible to all 778\${DIFF}comparisons in the TOPP suite and toTEST_FILE_EQUALin 12 class tests — not just to this one test.No behaviour change;
TOPP_ProteinQuantifier_29/30pass unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01VcFtJVe1PcMsBzMnnnpWBJ
Summary by CodeRabbit
nanwhen sample abundances are missing or non-positive.