Repository navigation
[FIX,API,TEST] Drop the sample abundance grain; report per assay - #9869
Conversation
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openms/source/FORMAT/MzTab.cpp (1)
992-1002: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winUse a unique assay-based key for subfeature optional columns.
This path can write several assay handles per fraction and replicate in one consensus feature. The loop emits
opt_global_mass_to_charge_study_variable[...]andopt_global_retention_time_study_variable[...]for every handle, so rows under a fractionated/replicated design get duplicate optional column names, which makes invalid mzTab PEP headers. Key these columns by assay instead of study variable, and keep the study-variable columns only when one study variable contains a single assay.🤖 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/FORMAT/MzTab.cpp` around lines 992 - 1002, The subfeature export in the consensus-feature loop currently keys optional mass-to-charge and retention-time columns by study variable, causing duplicate names across multiple assays. Update the logic around opt_global_mass_to_charge_study_variable and opt_global_retention_time_study_variable to use each handle’s unique assay identifier; emit the existing study-variable keys only when that study variable contains exactly one assay.
🧹 Nitpick comments (9)
src/topp/ProteinQuantifier.cpp (1)
447-447: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
OpenMS::nlfor SVOutStream line breaks.
src/topp/ProteinQuantifier.cpp:447usesendlonSVOutStream. Replace it withOpenMS::nl, which writes a newline without flushing.🤖 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/topp/ProteinQuantifier.cpp` at line 447, Update the SVOutStream output in ProteinQuantifier to replace endl after the "fraction" header with OpenMS::nl, preserving the existing line break without flushing.Source: Coding guidelines
src/openms/include/OpenMS/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.h (1)
307-344: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider making
orderBest_static.
orderBest_uses no instance state. It only calls the staticcountQuantifiedAssays_. A static template keeps the intent explicit and matches the helper next to it.🤖 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/include/OpenMS/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.h` around lines 307 - 344, Make the template method orderBest_ static, since it uses no instance state and only invokes the static helper countQuantifiedAssays_. Preserve its existing ordering and filtering behavior.src/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cpp (1)
457-459: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer
\noverendlin new log statements.The new warnings at Line 459 and Line 491 end with
endl. The coding guidelines forsrc/**/*.cppask for\ninstead. The surrounding file usesendl, so this is a consistency choice only.As per coding guidelines: "Prefer
\noverstd::endl."🤖 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/PeptideAndProteinQuant.cpp` around lines 457 - 459, Update the new warning log statements in the relevant quantitation code, including the one containing “fewer than two assays” and the warning near the other reported location, to terminate with "\n" instead of endl while preserving their existing messages.Source: Coding guidelines
src/tests/class_tests/openms/source/ProteinGroupArrowExport_test.cpp (1)
689-690: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression case for legacy sample-only annotations.
The current case removes the legacy
"abundances"array but keeps the new fraction-group arrays. The previous detection logic also passes that case. Add a group with only"abundances"and assert that export succeeds and treats it as identification-only, with null label and intensity. If equivalent coverage already exists, point to that case.As per coding guidelines,
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/ProteinGroupArrowExport_test.cpp` around lines 689 - 690, Add a regression test in the relevant ProteinGroupArrowExport test case that constructs a group containing only the legacy “abundances” annotation, then verifies export succeeds and produces null label and intensity for identification-only data. If an existing test already covers this exact scenario, reference that case instead of duplicating coverage.Source: Coding guidelines
src/openms/source/FORMAT/MzTab.cpp (2)
955-964: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winGate the assay columns on the mapping, not on equal counts.
has_distinct_assay_graincompares onlyn_assaysagainstn_study_variables. A design with the same number of assays and samples but a non-identity mapping (for example sample 1 -> assay 2 and sample 2 -> assay 1) sets the flag to false. The PEP section then emits nopeptide_abundance_assaycolumn at all, whileapplyAssayProteinQuantificationat Line 1831 always emitsprotein_abundance_assayfor every assay key. The same file then reports assay-level protein abundances but no assay-level peptide abundances.Derive the flag from the mapping instead. Every study variable that owns exactly one assay is the condition that makes the compact layout equivalent.
♻️ Proposed refactor
- const bool has_distinct_assay_grain = n_assays != n_study_variables; + // The compact layout is only equivalent when every study variable owns exactly one assay + // and the assay indices coincide with the study-variable indices. + bool has_distinct_assay_grain = n_assays != n_study_variables; + for (Size assay = 1; !has_distinct_assay_grain && assay <= n_assays; ++assay) + { + if (assay_to_study_variable.at(assay) != assay) { has_distinct_assay_grain = true; } + }🤖 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/FORMAT/MzTab.cpp` around lines 955 - 964, Update the assay-column gating near has_distinct_assay_grain to derive it from the study-variable-to-assay mapping rather than comparing n_assays and n_study_variables. Treat the layout as compact only when every study variable owns exactly one assay; otherwise initialize every assay entry in row.peptide_abundance_assay, preserving assay-level peptide columns for non-identity mappings with equal counts.
3057-3086: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winReport a clear error when a column header has no MS run or assay.
Line 3063 and Line 3078 both use
std::map::at. If aColumnHeaderfilename is absent from the experimental design MS file section, or absent fromms_runs_, the export terminates with a barestd::out_of_range. The rest of this constructor raisesException::MissingInformationwith a message that names the cause. Use the same style here so a mismatched design or a missing primary MS run path is diagnosable.♻️ Proposed change
- const Size curr_run_index = path_to_ms_run_index.at(c.second.filename); + const auto run_it = path_to_ms_run_index.find(c.second.filename); + if (run_it == path_to_ms_run_index.end()) + { + throw Exception::MissingInformation( + __FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, + "The consensus map column header '" + c.second.filename + "' is not a primary MS run path."); + } + const Size curr_run_index = run_it->second;🤖 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/FORMAT/MzTab.cpp` around lines 3057 - 3086, Update the column-header processing loop to replace the `path_label_to_assay_.at` and `path_to_ms_run_index.at` lookups with checks that catch missing entries and throw `Exception::MissingInformation` containing the affected filename and whether the assay or MS run mapping is absent. Preserve the existing assay and MS-run population behavior for valid mappings.src/tests/class_tests/openms/source/MzTab_test.cpp (1)
207-303: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGood coverage of the assay grain. Add the fallback case.
The reversed key order at Lines 245-254 proves name-based and key-based matching, and the assay-1 sum of 5.0 proves fraction aggregation. Two paths of
applyAssayProteinQuantificationstay untested: mismatched parallel array lengths, and a duplicate(fraction_group, label)key. Both must keep the pre-existing abundance columns and only warn. Add one section that supplies unequal array lengths and asserts thatprotein_abundance_assayis unchanged.🤖 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/MzTab_test.cpp` around lines 207 - 303, The consensus-map MzTab test around applyAssayProteinQuantification lacks coverage for malformed assay metadata. Add a test section with unequal parallel quantification-array lengths, then verify export preserves the pre-existing protein_abundance_assay values and emits only a warning without replacing them; keep the existing assay-grain assertions unchanged.src/tests/class_tests/openms/source/ConsensusXMLFile_test.cpp (2)
311-331: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the restored names of the fraction-group arrays.
The whole assay contract depends on name-based lookup of
fraction_group_level_abundance,fraction_group_level_fraction_groupandfraction_group_level_label.fillCanonicalappends the two integer arrays in map order, not in fixture order, so their positions are not the ones set at Lines 294-297. The test asserts only the count of the integer arrays and the name of index 0, so a change in the append order or a rename of either key would not fail here.Add name and value assertions for the two restored integer arrays.
💚 Proposed additions
TEST_EQUAL(rt.getIntegerDataArrays()[0].size(), 4) TEST_EQUAL(rt.getIntegerDataArrays()[0][0], 1) TEST_EQUAL(rt.getIntegerDataArrays()[0][3], 2) + + // the three parallel assay arrays are matched by name, so pin their names and values + TEST_EQUAL(rt.getIntegerDataArrays()[2].getName(), "fraction_group_level_fraction_group") + TEST_EQUAL(rt.getIntegerDataArrays()[3].getName(), "fraction_group_level_label") + TEST_EQUAL(rt.getIntegerDataArrays()[2].size(), 2) + TEST_EQUAL(rt.getIntegerDataArrays()[2][0], 1) + TEST_EQUAL(rt.getIntegerDataArrays()[2][1], 2) + TEST_EQUAL(rt.getIntegerDataArrays()[3][0], 1) + TEST_EQUAL(rt.getIntegerDataArrays()[3][1], 1)🤖 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/ConsensusXMLFile_test.cpp` around lines 311 - 331, Extend the assay-only restoration assertions after the existing integer-array checks to verify the names fraction_group_level_fraction_group and fraction_group_level_label by locating each through its actual restored array entry rather than assuming fixture order, and assert representative values from both arrays. Keep the existing count and file-channel assertions unchanged.
337-355: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a key prefix that actually covers the new quantity metavalue names.
Line 342 checks
_abundances, butConsensusXMLFilecan write keys such asindistinguishable_proteins_0_fraction_group_level_abundance. That does not contain_abundances, so this leftover-key check can miss leaked quantity metavalue state. Use the same tight group prefix used later in the file.💚 Proposed change
for (const std::string& key : keys) { - TEST_FALSE(StringUtils::hasSubstring(key, "_abundances")) - TEST_FALSE(StringUtils::hasSubstring(key, "_quantified_proteins")) + TEST_FALSE(StringUtils::hasSubstring(key, "indistinguishable_proteins_0_")) }Protein group re-store stability already includes data arrays.
ProteinIdentification::ProteinGroup::operator==comparesprobability,accessions, and the float/string/integer data arrays, so theloaded2.getProteinIdentifications()[0] == rtcheck already tests the quantity arrays.🤖 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/ConsensusXMLFile_test.cpp` around lines 337 - 355, Update the leftover-key assertion loop in the ConsensusXMLFile test to check the established tight group prefix used later in the file, so keys such as indistinguishable_proteins_0_fraction_group_level_abundance are detected. Leave the existing re-store stability assertion unchanged.
🤖 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.
Inline comments:
In `@CHANGELOG`:
- Line 20: Update the ProteinQuantifier migration guidance in the changelog to
replace references to removed abundance_sample* columns with
abundance_fractiongroup{F}_label{L} assay-level columns, and state that
downstream contrasts should use the corresponding fraction-group and label
outputs.
In `@src/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cpp`:
- Around line 1300-1304: Update the top-peptide selection block around
orderBest_ and peptides.resize in the fix_peptides path so it truncates the
vector to at most top_n without padding it with empty strings. Preserve all
valid peptide names returned by orderBest_, including cases where zero-abundance
entries cause the result to contain fewer than top_n items.
In `@src/openms/source/FORMAT/MzTab.cpp`:
- Around line 1811-1824: Update the fraction-group validation in the
assay-abundance loop to use the same boundary and consecutive-key rules as
ExperimentalDesign::fractionGroupAbundances, rejecting zero and non-consecutive
fraction groups while preserving the existing label and duplicate-key checks.
In `@src/tests/class_tests/openms/source/PeptideAndProteinQuant_test.cpp`:
- Around line 606-611: Update the trailing comment on the
(*pep_data.abundances[1].begin()).second.size() assertion to say “one charge,”
matching the assertion and the corresponding comments used at lines 630 and 640.
---
Outside diff comments:
In `@src/openms/source/FORMAT/MzTab.cpp`:
- Around line 992-1002: The subfeature export in the consensus-feature loop
currently keys optional mass-to-charge and retention-time columns by study
variable, causing duplicate names across multiple assays. Update the logic
around opt_global_mass_to_charge_study_variable and
opt_global_retention_time_study_variable to use each handle’s unique assay
identifier; emit the existing study-variable keys only when that study variable
contains exactly one assay.
---
Nitpick comments:
In `@src/openms/include/OpenMS/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.h`:
- Around line 307-344: Make the template method orderBest_ static, since it uses
no instance state and only invokes the static helper countQuantifiedAssays_.
Preserve its existing ordering and filtering behavior.
In `@src/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cpp`:
- Around line 457-459: Update the new warning log statements in the relevant
quantitation code, including the one containing “fewer than two assays” and the
warning near the other reported location, to terminate with "\n" instead of endl
while preserving their existing messages.
In `@src/openms/source/FORMAT/MzTab.cpp`:
- Around line 955-964: Update the assay-column gating near
has_distinct_assay_grain to derive it from the study-variable-to-assay mapping
rather than comparing n_assays and n_study_variables. Treat the layout as
compact only when every study variable owns exactly one assay; otherwise
initialize every assay entry in row.peptide_abundance_assay, preserving
assay-level peptide columns for non-identity mappings with equal counts.
- Around line 3057-3086: Update the column-header processing loop to replace the
`path_label_to_assay_.at` and `path_to_ms_run_index.at` lookups with checks that
catch missing entries and throw `Exception::MissingInformation` containing the
affected filename and whether the assay or MS run mapping is absent. Preserve
the existing assay and MS-run population behavior for valid mappings.
In `@src/tests/class_tests/openms/source/ConsensusXMLFile_test.cpp`:
- Around line 311-331: Extend the assay-only restoration assertions after the
existing integer-array checks to verify the names
fraction_group_level_fraction_group and fraction_group_level_label by locating
each through its actual restored array entry rather than assuming fixture order,
and assert representative values from both arrays. Keep the existing count and
file-channel assertions unchanged.
- Around line 337-355: Update the leftover-key assertion loop in the
ConsensusXMLFile test to check the established tight group prefix used later in
the file, so keys such as
indistinguishable_proteins_0_fraction_group_level_abundance are detected. Leave
the existing re-store stability assertion unchanged.
In `@src/tests/class_tests/openms/source/MzTab_test.cpp`:
- Around line 207-303: The consensus-map MzTab test around
applyAssayProteinQuantification lacks coverage for malformed assay metadata. Add
a test section with unequal parallel quantification-array lengths, then verify
export preserves the pre-existing protein_abundance_assay values and emits only
a warning without replacing them; keep the existing assay-grain assertions
unchanged.
In `@src/tests/class_tests/openms/source/ProteinGroupArrowExport_test.cpp`:
- Around line 689-690: Add a regression test in the relevant
ProteinGroupArrowExport test case that constructs a group containing only the
legacy “abundances” annotation, then verifies export succeeds and produces null
label and intensity for identification-only data. If an existing test already
covers this exact scenario, reference that case instead of duplicating coverage.
In `@src/topp/ProteinQuantifier.cpp`:
- Line 447: Update the SVOutStream output in ProteinQuantifier to replace endl
after the "fraction" header with OpenMS::nl, preserving the existing line break
without flushing.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: dab57708-acf7-4f2b-84cf-6733daa70876
📒 Files selected for processing (51)
CHANGELOGsrc/openms/include/OpenMS/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.hsrc/openms/include/OpenMS/FORMAT/MzTab.hsrc/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport_impl.hsrc/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cppsrc/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cppsrc/openms/source/FORMAT/MzTab.cppsrc/openms/source/FORMAT/ProteinGroupArrowExport.cppsrc/openms/source/PROCESSING/ID/IDFilter.cppsrc/pyOpenMS/bindings/bind_analysis.cppsrc/pyOpenMS/tests/unittests/test_PeptideAndProteinQuant.pysrc/tests/class_tests/openms/source/ConsensusXMLFile_test.cppsrc/tests/class_tests/openms/source/MzTab_test.cppsrc/tests/class_tests/openms/source/PeptideAndProteinQuant_test.cppsrc/tests/class_tests/openms/source/ProteinGroupArrowExport_test.cppsrc/tests/topp/CMakeLists.txtsrc/tests/topp/IsobaricWorkflow_1_out.consensusXMLsrc/tests/topp/ProteinQuantifier_12_output.txtsrc/tests/topp/ProteinQuantifier_13_output.txtsrc/tests/topp/ProteinQuantifier_14_output1.txtsrc/tests/topp/ProteinQuantifier_14_output2.txtsrc/tests/topp/ProteinQuantifier_15_output.txtsrc/tests/topp/ProteinQuantifier_16_output.txtsrc/tests/topp/ProteinQuantifier_1_output1.txtsrc/tests/topp/ProteinQuantifier_1_output2.txtsrc/tests/topp/ProteinQuantifier_26_output.txtsrc/tests/topp/ProteinQuantifier_29_output.txtsrc/tests/topp/ProteinQuantifier_2_output1.txtsrc/tests/topp/ProteinQuantifier_30_output.txtsrc/tests/topp/ProteinQuantifier_3_output1.txtsrc/tests/topp/ProteinQuantifier_3_output2.txtsrc/tests/topp/ProteinQuantifier_4_output.txtsrc/tests/topp/ProteinQuantifier_5_output.txtsrc/tests/topp/ProteinQuantifier_6_output.txtsrc/tests/topp/ProteinQuantifier_7_output.txtsrc/tests/topp/ProteinQuantifier_8_output.txtsrc/tests/topp/ProteinQuantifier_9_output.txtsrc/tests/topp/ProteomicsLFQ_1_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_1_subset_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_1_subset_out.mzTabsrc/tests/topp/ProteomicsLFQ_2_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_3_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_3_seedRT_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_4_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_5_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_6_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_7_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_8_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_9_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_9_seedRT_out.consensusXMLsrc/topp/ProteinQuantifier.cpp
💤 Files with no reviewable changes (18)
- src/tests/topp/ProteinQuantifier_12_output.txt
- src/tests/topp/ProteinQuantifier_13_output.txt
- src/tests/topp/ProteinQuantifier_29_output.txt
- src/tests/topp/ProteinQuantifier_30_output.txt
- src/tests/topp/IsobaricWorkflow_1_out.consensusXML
- src/tests/topp/ProteomicsLFQ_8_out.consensusXML
- src/tests/topp/ProteomicsLFQ_9_seedRT_out.consensusXML
- src/tests/topp/ProteomicsLFQ_9_out.consensusXML
- src/tests/topp/ProteomicsLFQ_5_out.consensusXML
- src/tests/topp/CMakeLists.txt
- src/tests/topp/ProteomicsLFQ_3_seedRT_out.consensusXML
- src/tests/topp/ProteomicsLFQ_3_out.consensusXML
- src/tests/topp/ProteomicsLFQ_1_subset_out.consensusXML
- src/tests/topp/ProteomicsLFQ_1_out.consensusXML
- src/tests/topp/ProteomicsLFQ_2_out.consensusXML
- src/tests/topp/ProteomicsLFQ_6_out.consensusXML
- src/tests/topp/ProteomicsLFQ_7_out.consensusXML
- src/tests/topp/ProteomicsLFQ_4_out.consensusXML
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change replaces sample-level abundance aggregation with fraction-group/label assay quantification across peptide and protein workflows, exports, persistence, bindings, and tests. Legacy metadata remains readable, while ProteinQuantifier outputs use assay-level abundance fields. ChangesAssay-level quantification
Sequence Diagram(s)sequenceDiagram
participant ProteinQuantifier
participant PeptideAndProteinQuant
participant ConsensusXML
participant MzTab
ProteinQuantifier->>PeptideAndProteinQuant: request assay-level quantities
PeptideAndProteinQuant-->>ProteinQuantifier: return fraction-group/label abundances
ProteinQuantifier->>ConsensusXML: export assay quantities
ProteinQuantifier->>MzTab: map validated assay arrays to output columns
Possibly related issues
Possibly related PRs
Suggested reviewers: 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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp (1)
939-947: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider listing the assay arrays in the canonical name lists.
canonicalFloatNames()omitsfraction_group_level_abundance, andcanonicalIntegerNames()omits the two fraction-group key arrays.fillCanonicaltherefore appends them as unknown names, instd::mapkey order. The current round trip lands them at the same indices the producer uses only because they are the sole extra arrays. If another producer adds a float array whose name sorts beforefraction_group_level_abundance, the positions shift, and tests that indexgetFloatDataArrays()[3]break. Consumers read these arrays by name, so this is robustness only.♻️ Proposed refactor
static const StringList& canonicalFloatNames() { - static const StringList names {"psm_count", "distinct_peptides", "file_channel_level_abundance"}; + static const StringList names {"psm_count", "distinct_peptides", "file_channel_level_abundance", + "fraction_group_level_abundance"}; return names; }Add the matching integer names, and keep the legacy list unchanged.
🤖 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/FORMAT/HANDLERS/ConsensusXMLHandler.cpp` around lines 939 - 947, Update canonicalFloatNames() to include fraction_group_level_abundance and update canonicalIntegerNames() to include both fraction-group key array names, so fillCanonical orders these assay arrays canonically rather than appending them as unknown names. Preserve the existing legacy entries and ordering.src/topp/ProteinQuantifier.cpp (1)
447-447: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueUse
'\n'instead ofendl.
endlflushes the output stream after the header. Use'\n'to end the record without an unnecessary flush.Proposed change
- out << "fraction" << endl; + out << "fraction" << '\n';As per coding guidelines, prefer
\noverstd::endl.🤖 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/topp/ProteinQuantifier.cpp` at line 447, Update the output statement in ProteinQuantifier to write the “fraction” header followed by '\n' instead of endl, avoiding the unnecessary stream flush while preserving the same line termination.Source: Coding guidelines
🤖 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.
Inline comments:
In `@src/topp/ProteinQuantifier.cpp`:
- Around line 770-784: Update the detailed_file_columns legend logic around
sample_id_to_filename so fractionated samples retain every associated filename
instead of overwriting earlier entries. Either remove this legend or change the
mapping and subsequent description construction to collect and print all
filenames for each sample, while preserving the existing sample ordering and
formatting.
---
Nitpick comments:
In `@src/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cpp`:
- Around line 939-947: Update canonicalFloatNames() to include
fraction_group_level_abundance and update canonicalIntegerNames() to include
both fraction-group key array names, so fillCanonical orders these assay arrays
canonically rather than appending them as unknown names. Preserve the existing
legacy entries and ordering.
In `@src/topp/ProteinQuantifier.cpp`:
- Line 447: Update the output statement in ProteinQuantifier to write the
“fraction” header followed by '\n' instead of endl, avoiding the unnecessary
stream flush while preserving the same line termination.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b6b4c818-f969-45d1-8847-d1a7557596c5
📒 Files selected for processing (50)
CHANGELOGsrc/openms/include/OpenMS/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.hsrc/openms/include/OpenMS/FORMAT/MzTab.hsrc/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport_impl.hsrc/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cppsrc/openms/source/FORMAT/HANDLERS/ConsensusXMLHandler.cppsrc/openms/source/FORMAT/MzTab.cppsrc/openms/source/FORMAT/ProteinGroupArrowExport.cppsrc/openms/source/PROCESSING/ID/IDFilter.cppsrc/pyOpenMS/bindings/bind_analysis.cppsrc/tests/class_tests/openms/source/ConsensusXMLFile_test.cppsrc/tests/class_tests/openms/source/MzTab_test.cppsrc/tests/class_tests/openms/source/PeptideAndProteinQuant_test.cppsrc/tests/class_tests/openms/source/ProteinGroupArrowExport_test.cppsrc/tests/topp/CMakeLists.txtsrc/tests/topp/IsobaricWorkflow_1_out.consensusXMLsrc/tests/topp/ProteinQuantifier_12_output.txtsrc/tests/topp/ProteinQuantifier_13_output.txtsrc/tests/topp/ProteinQuantifier_14_output1.txtsrc/tests/topp/ProteinQuantifier_14_output2.txtsrc/tests/topp/ProteinQuantifier_15_output.txtsrc/tests/topp/ProteinQuantifier_16_output.txtsrc/tests/topp/ProteinQuantifier_1_output1.txtsrc/tests/topp/ProteinQuantifier_1_output2.txtsrc/tests/topp/ProteinQuantifier_26_output.txtsrc/tests/topp/ProteinQuantifier_29_output.txtsrc/tests/topp/ProteinQuantifier_2_output1.txtsrc/tests/topp/ProteinQuantifier_30_output.txtsrc/tests/topp/ProteinQuantifier_3_output1.txtsrc/tests/topp/ProteinQuantifier_3_output2.txtsrc/tests/topp/ProteinQuantifier_4_output.txtsrc/tests/topp/ProteinQuantifier_5_output.txtsrc/tests/topp/ProteinQuantifier_6_output.txtsrc/tests/topp/ProteinQuantifier_7_output.txtsrc/tests/topp/ProteinQuantifier_8_output.txtsrc/tests/topp/ProteinQuantifier_9_output.txtsrc/tests/topp/ProteomicsLFQ_1_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_1_subset_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_1_subset_out.mzTabsrc/tests/topp/ProteomicsLFQ_2_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_3_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_3_seedRT_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_4_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_5_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_6_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_7_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_8_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_9_out.consensusXMLsrc/tests/topp/ProteomicsLFQ_9_seedRT_out.consensusXMLsrc/topp/ProteinQuantifier.cpp
💤 Files with no reviewable changes (19)
- src/tests/topp/ProteinQuantifier_30_output.txt
- src/tests/topp/ProteinQuantifier_13_output.txt
- src/tests/topp/ProteinQuantifier_29_output.txt
- src/tests/topp/ProteinQuantifier_12_output.txt
- src/tests/topp/IsobaricWorkflow_1_out.consensusXML
- src/tests/topp/ProteomicsLFQ_9_seedRT_out.consensusXML
- src/tests/topp/ProteomicsLFQ_7_out.consensusXML
- src/tests/topp/ProteomicsLFQ_1_subset_out.consensusXML
- src/tests/topp/ProteomicsLFQ_3_out.consensusXML
- src/tests/topp/ProteomicsLFQ_5_out.consensusXML
- src/tests/topp/ProteomicsLFQ_2_out.consensusXML
- src/tests/topp/ProteomicsLFQ_8_out.consensusXML
- src/tests/topp/ProteomicsLFQ_4_out.consensusXML
- src/tests/topp/CMakeLists.txt
- src/tests/topp/ProteomicsLFQ_9_out.consensusXML
- src/tests/topp/ProteomicsLFQ_3_seedRT_out.consensusXML
- src/pyOpenMS/bindings/bind_analysis.cpp
- src/tests/topp/ProteomicsLFQ_6_out.consensusXML
- src/tests/topp/ProteomicsLFQ_1_out.consensusXML
3c6f009 to
a73b02c
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. |
a73b02c to
f419288
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. |
f419288 to
e322684
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. |
There was a problem hiding this comment.
Actionable comments posted: 2
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/FORMAT/MzTab.cpp (2)
1355-1380: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftUpdate the identification export for named assay arrays.
getQuantStudyVariables_now returns non-zero forfraction_group_level_*arrays.IDMzTabStreamuses that value at Line [2372] to suppress general groups, but Line [2434] still callsnextProteinSectionRowFromIndistinguishableGroup_. That row builder only consumes the legacy firstabundancesarray at Lines [1679-1693]. It does not callapplyAssayProteinQuantification.Therefore,
exportIdentificationsToMzTabcan omit all protein abundance columns for the new format while also changing the emitted row set. Route the ID stream through the named-array serializer, or keep this detector limited to formats that the ID row builder supports.🤖 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/FORMAT/MzTab.cpp` around lines 1355 - 1380, Limit getQuantStudyVariables_ to detection formats supported by the ID export row builder, or update IDMzTabStream/exportIdentificationsToMzTab so named fraction_group_level_* arrays are serialized through applyAssayProteinQuantification instead of nextProteinSectionRowFromIndistinguishableGroup_. Ensure named-array detection does not suppress general groups while omitting protein abundance columns.
1789-1816: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winFall back when named assay arrays are empty.
An all-empty set of the three named arrays passes the presence and equal-length checks.
applyAssayProteinQuantificationthen clears pre-existing abundance maps at Lines [1854-1857] and writes nulls for every expected assay at Lines [1862-1865]. If a legacy group also contains usableabundances, the exporter discards those values instead of using the fallback path.Reject zero-length named arrays before clearing the row.
Proposed fix
if (assay_abundances->size() != fraction_groups->size() || assay_abundances->size() != labels->size()) { return warnAndFallback("the named parallel arrays have different lengths"); } + if (assay_abundances->empty()) + { + return warnAndFallback("the named parallel arrays are empty"); + }🤖 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/FORMAT/MzTab.cpp` around lines 1789 - 1816, Update the named-array validation in the assay quantification flow around applyAssayProteinQuantification so the presence check also requires the three named arrays to contain usable, non-empty data. Treat an all-empty set as unavailable and return false before existing abundance maps are cleared, allowing the legacy abundances fallback to run.
🤖 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.
Inline comments:
In `@src/openms/source/FORMAT/MzTab.cpp`:
- Around line 1010-1026: Update the optional-column suffix construction in the
handle loop around opt_global_mass_to_charge and opt_global_retention_time so
each handle produces a unique key even when handles share the same assay and
study_variable. Incorporate the stable handle or fraction identifier available
in the loop into the suffix, while preserving the established naming for
contexts where uniqueness is already guaranteed.
- Around line 1838-1844: Update the validation around the fraction_groups/labels
loop to verify each (fraction_group, label) pair exists in the current
assay_keys collection before accepting it. For any unknown key, call
warnAndFallback with a clear message, preserving the existing positivity and
duplicate checks and preventing unsupported entries from reaching the
map-clearing/output flow.
---
Outside diff comments:
In `@src/openms/source/FORMAT/MzTab.cpp`:
- Around line 1355-1380: Limit getQuantStudyVariables_ to detection formats
supported by the ID export row builder, or update
IDMzTabStream/exportIdentificationsToMzTab so named fraction_group_level_*
arrays are serialized through applyAssayProteinQuantification instead of
nextProteinSectionRowFromIndistinguishableGroup_. Ensure named-array detection
does not suppress general groups while omitting protein abundance columns.
- Around line 1789-1816: Update the named-array validation in the assay
quantification flow around applyAssayProteinQuantification so the presence check
also requires the three named arrays to contain usable, non-empty data. Treat an
all-empty set as unavailable and return false before existing abundance maps are
cleared, allowing the legacy abundances fallback to run.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7e5f948f-4e20-4864-aecd-74cf4c35654a
📒 Files selected for processing (9)
src/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport_impl.hsrc/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cppsrc/openms/source/FORMAT/MzTab.cppsrc/openms/source/METADATA/ExperimentalDesign.cppsrc/tests/class_tests/openms/source/ExperimentalDesign_test.cppsrc/tests/class_tests/openms/source/PeptideAndProteinQuant_test.cppsrc/tests/topp/ProteinQuantifier_14_output1.txtsrc/tests/topp/ProteinQuantifier_14_output2.txtsrc/topp/ProteinQuantifier.cpp
🚧 Files skipped from review as they are similar to previous changes (6)
- src/tests/topp/ProteinQuantifier_14_output1.txt
- src/tests/topp/ProteinQuantifier_14_output2.txt
- src/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport_impl.h
- src/topp/ProteinQuantifier.cpp
- src/openms/source/ANALYSIS/QUANTITATION/PeptideAndProteinQuant.cpp
- src/tests/class_tests/openms/source/PeptideAndProteinQuant_test.cpp
d93e54d to
59e5f6c
Compare
PeptideAndProteinQuant reported two grains from one run. The sample grain summed across every file mapped to a Sample, so a Sample measured in several fraction groups had its technical replicates added together (OpenMS#9864 A1). Declaring two runs of one sample as replicates inflated a reported fold change from 6.4x to 11.9x on a BSA test design, and the sum was not even decomposable back into its parts, because the two grains ran independent top-N passes. Nothing chose that summation: ProteinQuantifier documents a sample as "all fractions of its fraction group at that label" -- one fraction group. The multi-fraction-group case was never part of the contract; a test had frozen it. So the grain goes, rather than getting an aggregator. The quantification unit (fraction_group, label) -- the mzTab assay of the preceding commit -- is now the only reported grain, and no aggregation across replicates happens inside OpenMS at all. Sample stays in ExperimentalDesign as SampleSection metadata, which is how MSstats already consumes it. - PeptideData/ProteinData::total_abundances and calculateProteinAbundances_ are gone; countQuantifiedSamples_ and orderBest_ now count assays. - normalizePeptides_ scales per assay, so the (fraction group, label) -> sample lookup and its throw are no longer needed. - ProteinQuantifier writes abundance_fractiongroupF_labelL columns. - The "abundances" float array was doing double duty as a "this group was quantified" flag. mzTab, ConsensusXMLHandler and ProteinGroupArrowExport now gate on the named fraction-group/label arrays instead, and old consensusXML still round-trips. pyOpenMS keeps total_abundances for one release as a deprecated property: it warns, reads empty and ignores assignment. Reference churn is the sample grain disappearing -- the indistinguishable_proteins_N_abundances UserParam and the abundance_sampleN columns -- plus the renamed columns. The assay values in those same files are unchanged. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two members of the sample grain were left behind by the previous commit: ProteinData::peptide_abundances (peptide -> sample -> abundance) fed the sample-grain top-N gate, peptide selection and calculateProteinAbundances_. All three either moved to peptide_fraction_group_abundances or were deleted, and its only writer read total_abundances, so nothing writes or reads it any more. It was still exposed read-write to pyOpenMS, where it returned an empty dict with no warning - indistinguishable from a protein with no peptides. PeptideData/ProteinData::total_abundances survived only as a pyOpenMS compatibility property. With the C++ members gone there is nothing to be compatible with: it warned, read empty and ignored assignment. Both are removed outright, together with their bindings and the test that exercised the compatibility shim. Callers want fraction_group_abundances resp. peptide_fraction_group_abundances. Note the getBestCharge_ parameter also named peptide_abundances is unrelated (fraction -> filename -> charge -> channel) and stays. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The ratio-removal entry told users to migrate to 'abundance_sample*', which this branch deletes. It now points at the per-assay columns that replace them. Adds the missing entry for the sample-grain removal itself, which is breaking for ProteinQuantifier's columns, mzTab, the consensusXML abundance UserParam and the pyOpenMS bindings. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…lumns The assay-abundance validator rejected fraction_group 0. Only designs built through ExperimentalDesign's validating constructor must start at 1 (isValid_(), ExperimentalDesign.cpp:735); the programmatic paths never reach it. fromIdentifications() numbers fraction groups from 0 (ExperimentalDesign.cpp:269 and :279) and fromConsensusMap() passes an annotated 'fraction_group' through unchanged (:136), so a consensusXML carrying 0 reaches the validator via ProteinQuantifier. It fell back to the sample-grain array, which this branch removes, so the run's protein quantities would simply have disappeared. The boundary is now '< 0' for the fraction group and '<= 0' for the label, matching the QPX sibling in ProteinGroupArrowExport_impl.h exactly. The subfeature optional columns keyed on the study variable. That was unique only while a study variable owned one assay; now that it groups replicates, two handles emitted the same column name. The established name is kept in the single-assay case and the assay is used otherwise, so no shipped output changes. 'peptides.resize(top_n)' padded with empty peptide names: the guard counts every entry while orderBest_ drops those without a positive abundance, so fewer names can come back. It truncates now. Pre-existing, but on a line this branch already touched. Also: three warnings ended with endl, flushing for no reason, and one SVOutStream header used endl instead of nl; a test comment said "two charges" for an assertion checking one. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
ExperimentalDesign has two adjacent fields with opposite conventions: 'sample' is a zero-based index into the sample section, 'fraction_group' is a 1-based id -- MSFileSectionEntry defaults it to 1, every other producer emits 1..n, and isValid_() rejects a set that does not start at 1. fromIdentifications fed one counter to both. It was written when the counter started at 1; ac07ea0 moved it to 0 to make sample indices zero-based and left 'r.fraction_group = sample' alone, so fraction groups silently became zero-based too. The result is a factory that produces designs its own validator refuses: reconstructing an inferred design with the two-argument constructor threw InvalidValue. Nothing noticed because fromIdentifications assigns through setMSFileSection, which does not validate. The preceding commit made the defect visible rather than latent: with protein abundances reported per assay, the leaked 0 surfaced as a column literally named 'abundance_fractiongroup0_label1' in the two ProteinQuantifier_14 references. 'sample + 1' fixes it. Samples stay 0..n-1, fraction groups become 1..n, and no abundance moves -- both reference files change on the header line only, every data row is byte-identical. With the producer corrected, the two parallel-array validators go back to rejecting 0 (MzTab applyAssayProteinQuantification and the QPX sibling in ProteinGroupArrowExport_impl.h). They had been relaxed to '< 0' to accommodate exactly this bug, which institutionalised it; both now require 1-based keys, matching the documented convention. The new ExperimentalDesign_test section asserts the invariant directly: an inferred design must satisfy the same validator as a loaded one. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…intensity
Removing the sample abundance grain also removed the QPX refusal for a
group that carries ONLY the legacy sample-level "abundances" array:
- const bool quantified = sample_abundances != nullptr || quantities.present;
- if (!quantities.present) { return "carries sample abundances but no ..."; }
+ const bool quantified = quantities.present;
A consensusXML written by an older OpenMS annotates its protein groups
that way. Such a group WAS quantified, at a grain this version can no
longer interpret, but it now fell through as "not quantified" and was
emitted as identification-only. So
ProteinQuantifier -in <pre-assay-grain consensusXML> -out_qpx dir
wrote a quantms.pg.parquet in which every protein row has a null
intensity, and exited 0 -- a complete-looking collection with no
quantities in it, indistinguishable from a genuinely unquantified run.
Before, the export refused outright.
The refusal is restored, with a message that says what to do about it.
Being loud is the point: a null intensity is not a diagnosis.
The regression test was missing, which is why deleting one '||' went
unnoticed: all 8 sections of ProteinGroupArrowExport_test that set
"abundances" also set the fraction-group arrays, so nothing covered the
legacy-only shape. The new section covers it, and asserts the neighbouring
case still works -- a group with no quantity annotation at all is
identification-only data and stays exportable.
Refs OpenMS#9864
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The legend mapped sample numbers to filenames, but it was only ever printed alongside the DETAILED columns, which are named 'abundance|<file>|ch<n>' and contain no sample number at all -- so it explained numbers that appear nowhere in the table. With the assay columns now named 'abundance_fractiongroup<F>_label<L>', every column states its own coordinates and no legend has anything left to add. It was also lossy: it kept one arbitrary file per sample, so a fractionated sample was represented by whichever of its fractions happened to be visited last. Only the two references that carried the line change; nothing else in them moves. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…uns each holds Two changes to the same header. The column token drops the redundant half of its name without becoming ambiguous: 'abundance_fractiongroup1_label1' becomes 'abundance_fgroup1_label1'. Plain 'group' would have collided with the other sense of the word one column over -- 'n_proteins' counts the members of an indistinguishable protein GROUP -- in a table that is about proteins, so 'abundance_group1' invites exactly the wrong reading. Only ProteinQuantifier ever emitted this token; every other use of 'fractiongroup' in the tree is an internal variable name. And the runs behind each group are named again: # Runs per fraction group: fgroup1: 'BSA1_F1', 'BSA1_F2'; fgroup2: ... The deleted sample->file legend is not restored - this replaces it. That one named ONE file per sample, so a fractionated sample was represented by whichever fraction came last, and it printed only beside the detailed file/channel columns, where no sample number appears at all. This one lists every run of a group, in fraction order, and prints beside the assay columns, which is where the mapping was missing. It is keyed on the fraction group rather than the assay because all labels of a group are carried by the same files: keying per assay repeated one file list once per channel, 1962 characters becoming ~10 kB on the 48-file TMT fixture. It matters most when no design is given, since the fraction groups are then invented from the consensus map and nothing else in the output reveals what they mean. References change by exactly +2/-1 each: the header line renamed, the legend line inserted. No value moves, and ProteinQuantifier_17 - detailed output, so neither renamed nor annotated - is untouched. Refs OpenMS#9864 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
59e5f6c to
4edafd1
Compare
…ow counts Phase 0.1 gave the QPX views a schema check and a row-count floor. Those catch a table that collapsed or lost a column; they say nothing about what is IN it. ParquetDiff gains 'out_tsv', which writes a table out as text sorted by primary key, and four references are pinned against that with FuzzyDiff: the pg view of ProteinQuantifier_19 (48 rows) and _18 (3 rows), and the pg (20 rows) and psm (4 rows) views of IsobaricWorkflow. Text rather than committed Parquet is the whole point. A binary reference can only ever be regenerated wholesale, which is exactly the operation that hides unrelated drift; a text reference is reviewable in a pull request and patchable line by line, and it puts QPX on the same footing as every other reference in the suite rather than inventing a second kind of artefact. The dump reuses the comparator's own canonical key encoding, so it cannot disagree with the comparison about what a primary key is, and it escapes tabs and newlines inside values so one row is always one line. Rows therefore come out in length-prefixed key order - 'TMT126' before 'TMT127C' before 'TMT131' - which looks unsorted but is deterministic and byte-comparable, which is what a reference needs. A file with no derivable key still dumps, in file order, with a warning saying so, because a reference built from it would be sensitive to how the producer ordered its rows. Comparison uses the shared relative tolerance with the absolute one set to ZERO. FuzzyDiff.ini's absdiff of 0.01 exists for "zero vs. epsilon" on unbounded quantities; the QPX views carry q-values and posterior error probabilities living in [0,1], where it deletes the assertion outright - in one fixture 68 of 104 PEPs are <= 0.01, so every one of them would compare equal to every other. Verified, not argued: perturbing a PEP by 0.005 turns the psm reference red, and that is a change the shared absdiff would have absorbed silently. Both references were shown to fail on purpose - a 5% intensity change and the q-value change above - and restored afterwards. Fixtures were chosen by float-path length, not table size. ProteinQuantifier reads a committed consensusXML and does no mzML parsing, feature finding, alignment or normalization; IsobaricWorkflow adds only reporter extraction; both keys are float-free. ProteinQuantifier_19's 48 rows are 4 fraction groups x 6 TMT labels x 2 anchors with 12-entry grouped_runs lists - the design melting, fraction-group keying and label assignment that OpenMS#9869/OpenMS#9874/OpenMS#9876 touched - so it now VERIFIES rather than assumes OpenMS#9876's claim that nothing changes at the default 'fractions:aggregate'. The feature view and both ProteomicsLFQ producers are deliberately NOT pinned. The feature key contains a float32 'rt' matched with zero tolerance, and ProteomicsLFQ picks its median-normalization reference map by feature count, so one extra feature on one platform shifts every intensity by a finite factor. Those wait for the normalization fix that will move them anyway. Part of OpenMS#9864 Phase 0.1. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
…ow counts Phase 0.1 gave the QPX views a schema check and a row-count floor. Those catch a table that collapsed or lost a column; they say nothing about what is IN it. ParquetDiff gains 'out_tsv', which writes a table out as text sorted by primary key, and four references are pinned against that with FuzzyDiff: the pg view of ProteinQuantifier_19 (48 rows) and _18 (3 rows), and the pg (20 rows) and psm (4 rows) views of IsobaricWorkflow. Text rather than committed Parquet is the whole point. A binary reference can only ever be regenerated wholesale, which is exactly the operation that hides unrelated drift; a text reference is reviewable in a pull request and patchable line by line, and it puts QPX on the same footing as every other reference in the suite rather than inventing a second kind of artefact. The dump reuses the comparator's own canonical key encoding, so it cannot disagree with the comparison about what a primary key is, and it escapes tabs and newlines inside values so one row is always one line. Rows therefore come out in length-prefixed key order - 'TMT126' before 'TMT127C' before 'TMT131' - which looks unsorted but is deterministic and byte-comparable, which is what a reference needs. A file with no derivable key still dumps, in file order, with a warning saying so, because a reference built from it would be sensitive to how the producer ordered its rows. Comparison uses the shared relative tolerance with the absolute one set to ZERO. FuzzyDiff.ini's absdiff of 0.01 exists for "zero vs. epsilon" on unbounded quantities; the QPX views carry q-values and posterior error probabilities living in [0,1], where it deletes the assertion outright - in one fixture 68 of 104 PEPs are <= 0.01, so every one of them would compare equal to every other. Verified, not argued: perturbing a PEP by 0.005 turns the psm reference red, and that is a change the shared absdiff would have absorbed silently. Both references were shown to fail on purpose - a 5% intensity change and the q-value change above - and restored afterwards. Fixtures were chosen by float-path length, not table size. ProteinQuantifier reads a committed consensusXML and does no mzML parsing, feature finding, alignment or normalization; IsobaricWorkflow adds only reporter extraction; both keys are float-free. ProteinQuantifier_19's 48 rows are 4 fraction groups x 6 TMT labels x 2 anchors with 12-entry grouped_runs lists - the design melting, fraction-group keying and label assignment that OpenMS#9869/OpenMS#9874/OpenMS#9876 touched - so it now VERIFIES rather than assumes OpenMS#9876's claim that nothing changes at the default 'fractions:aggregate'. The feature view and both ProteomicsLFQ producers are deliberately NOT pinned. The feature key contains a float32 'rt' matched with zero tolerance, and ProteomicsLFQ picks its median-normalization reference map by feature count, so one extra feature on one platform shifts every intensity by a finite factor. Those wait for the normalization fix that will move them anyway. Part of OpenMS#9864 Phase 0.1. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
…ow counts Phase 0.1 gave the QPX views a schema check and a row-count floor. Those catch a table that collapsed or lost a column; they say nothing about what is IN it. ParquetDiff gains 'out_tsv', which writes a table out as text sorted by primary key, and four references are pinned against that with FuzzyDiff: the pg view of ProteinQuantifier_19 (48 rows) and _18 (3 rows), and the pg (20 rows) and psm (4 rows) views of IsobaricWorkflow. Text rather than committed Parquet is the whole point. A binary reference can only ever be regenerated wholesale, which is exactly the operation that hides unrelated drift; a text reference is reviewable in a pull request and patchable line by line, and it puts QPX on the same footing as every other reference in the suite rather than inventing a second kind of artefact. The dump reuses the comparator's own canonical key encoding, so it cannot disagree with the comparison about what a primary key is, and it escapes tabs and newlines inside values so one row is always one line. Rows therefore come out in length-prefixed key order - 'TMT126' before 'TMT127C' before 'TMT131' - which looks unsorted but is deterministic and byte-comparable, which is what a reference needs. A file with no derivable key still dumps, in file order, with a warning saying so, because a reference built from it would be sensitive to how the producer ordered its rows. Comparison uses the shared relative tolerance with the absolute one set to ZERO. FuzzyDiff.ini's absdiff of 0.01 exists for "zero vs. epsilon" on unbounded quantities; the QPX views carry q-values and posterior error probabilities living in [0,1], where it deletes the assertion outright - in one fixture 68 of 104 PEPs are <= 0.01, so every one of them would compare equal to every other. Verified, not argued: perturbing a PEP by 0.005 turns the psm reference red, and that is a change the shared absdiff would have absorbed silently. Both references were shown to fail on purpose - a 5% intensity change and the q-value change above - and restored afterwards. Fixtures were chosen by float-path length, not table size. ProteinQuantifier reads a committed consensusXML and does no mzML parsing, feature finding, alignment or normalization; IsobaricWorkflow adds only reporter extraction; both keys are float-free. ProteinQuantifier_19's 48 rows are 4 fraction groups x 6 TMT labels x 2 anchors with 12-entry grouped_runs lists - the design melting, fraction-group keying and label assignment that OpenMS#9869/OpenMS#9874/OpenMS#9876 touched - so it now VERIFIES rather than assumes OpenMS#9876's claim that nothing changes at the default 'fractions:aggregate'. The feature view and both ProteomicsLFQ producers are deliberately NOT pinned. The feature key contains a float32 'rt' matched with zero tolerance, and ProteomicsLFQ picks its median-normalization reference map by feature count, so one extra feature on one platform shifts every intensity by a finite factor. Those wait for the normalization fix that will move them anyway. Part of OpenMS#9864 Phase 0.1. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx
…es 1-2) (#9879) * [TEST] QPX: pin values against text references, not just schema and row counts Phase 0.1 gave the QPX views a schema check and a row-count floor. Those catch a table that collapsed or lost a column; they say nothing about what is IN it. ParquetDiff gains 'out_tsv', which writes a table out as text sorted by primary key, and four references are pinned against that with FuzzyDiff: the pg view of ProteinQuantifier_19 (48 rows) and _18 (3 rows), and the pg (20 rows) and psm (4 rows) views of IsobaricWorkflow. Text rather than committed Parquet is the whole point. A binary reference can only ever be regenerated wholesale, which is exactly the operation that hides unrelated drift; a text reference is reviewable in a pull request and patchable line by line, and it puts QPX on the same footing as every other reference in the suite rather than inventing a second kind of artefact. The dump reuses the comparator's own canonical key encoding, so it cannot disagree with the comparison about what a primary key is, and it escapes tabs and newlines inside values so one row is always one line. Rows therefore come out in length-prefixed key order - 'TMT126' before 'TMT127C' before 'TMT131' - which looks unsorted but is deterministic and byte-comparable, which is what a reference needs. A file with no derivable key still dumps, in file order, with a warning saying so, because a reference built from it would be sensitive to how the producer ordered its rows. Comparison uses the shared relative tolerance with the absolute one set to ZERO. FuzzyDiff.ini's absdiff of 0.01 exists for "zero vs. epsilon" on unbounded quantities; the QPX views carry q-values and posterior error probabilities living in [0,1], where it deletes the assertion outright - in one fixture 68 of 104 PEPs are <= 0.01, so every one of them would compare equal to every other. Verified, not argued: perturbing a PEP by 0.005 turns the psm reference red, and that is a change the shared absdiff would have absorbed silently. Both references were shown to fail on purpose - a 5% intensity change and the q-value change above - and restored afterwards. Fixtures were chosen by float-path length, not table size. ProteinQuantifier reads a committed consensusXML and does no mzML parsing, feature finding, alignment or normalization; IsobaricWorkflow adds only reporter extraction; both keys are float-free. ProteinQuantifier_19's 48 rows are 4 fraction groups x 6 TMT labels x 2 anchors with 12-entry grouped_runs lists - the design melting, fraction-group keying and label assignment that #9869/#9874/#9876 touched - so it now VERIFIES rather than assumes #9876's claim that nothing changes at the default 'fractions:aggregate'. The feature view and both ProteomicsLFQ producers are deliberately NOT pinned. The feature key contains a float32 'rt' matched with zero tolerance, and ProteomicsLFQ picks its median-normalization reference map by feature count, so one extra feature on one platform shifts every intensity by a finite factor. Those wait for the normalization fix that will move them anyway. Part of #9864 Phase 0.1. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx * [FIX,TEST] Address review: escape the backslash, and make the row-floor test mean what it says Three findings from CodeRabbit on #9879, all valid. 1. dumpToTsv could forge an escape. A tab is rendered as the two characters '\' 't' to keep one row on one line - but a value that ALREADY contained a backslash followed by 't' rendered to those same two characters. Two genuinely different tables therefore produced identical text and the reference comparison accepted them as equal, which is the exact failure a value reference exists to rule out. The backslash is now escaped first and unconditionally. Verified in both directions rather than assumed: two tables differing only in 'literal backslash-t' versus 'a real tab' now render as X\\tY and X\tY, and with the fix reverted the new regression section fails on TEST_NOT_EQUAL(text_a, text_b) because both collapse to [X\tY]. The section also asserts that neither dump contains a raw tab, which would split a row. None of the four committed references contains a backslash, so none of them moves - checked, and all 51 QPX/ParquetDiff tests still pass against the unchanged files. 2. TOPP_ParquetDiff_8 passed for the wrong reason. It exists to show the row floor applies to the SECOND input, and it did fail - but its two fixtures have disjoint primary keys, so it would have failed on the key mismatch even if 'min_rows' never looked at 'in2' at all. 'schema_only' now removes every other failure cause, leaving the floor as the only thing that can go red. 3. The documented canonical key order was backwards, in both the CHANGELOG and the CMake comment. Length-prefixing puts the six-character 'TMT126' and 'TMT131' ahead of the seven-character 'TMT127C', not 'TMT127C' before 'TMT131'. Full local ctest unchanged at 2826 tests, 9 pre-existing environmental failures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y9DY9JfJasCr76qof5n5rx --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Step 3 of the plan on #9864. Stacked on #9867 and #9868 — it contains both, because it rewrites the same
ProteinQuantifierCSV writer #9867 edits and builds on #9868's assay grain. Review those first; the diff here is only readable once they land.What changes
PeptideAndProteinQuantreported two grains from one run. The sample grain summed across every file mapped to aSample, so a Sample measured in several fraction groups had its technical replicates added together — #9864 §A1.Measured: declaring two runs of one sample as replicates over the BSA design moved the reported fold change from 6.4× to 11.9×, and the summed value (
2.97e8) was not even decomposable into its replicates (1.80e8+1.40e8), because the two grains ran independent top-N passes. After this PR the same design reports the two assays separately and the sum is structurally impossible.Nothing ever chose that summation.
ProteinQuantifier.cpp:86documented a sample as "all fractions of its fraction group at that label" — singular. The multi-fraction-group case was outside the contract;PeptideAndProteinQuant_test.cpp:411-508had frozen it, assertingtotal_abundances.at(0) == 70.0for a 30 + 40 replicate pair. That assertion is now "two assays holding 30.0 and 40.0".So the grain goes rather than getting an aggregator.
(fraction_group, label)— the mzTab assay from #9868 — is the only reported grain, and no across-replicate aggregation happens inside OpenMS at all.Samplestays inExperimentalDesignasSampleSectionmetadata, which is howMSstatsFilealready consumes it (:191,:484, emittingBioReplicateandTechRepMixture).Detail
PeptideData::total_abundances,ProteinData::total_abundancesandcalculateProteinAbundances_removed.countQuantifiedSamples_→countQuantifiedAssays_;orderBest_retemplated ontoFractionGroupAbundances.normalizePeptides_scales per assay, sofraction_group_label_to_sample_and its throw are gone.ProteinQuantifierwritesabundance_fractiongroup{F}_label{L}columns; the doc block is rewritten off sample terminology.-file_and_channel_level_outputkeeps its finer grain."abundances"float array was doing double duty as a "this group was quantified" flag, not just carrying data.MzTab.cpp:1300,ConsensusXMLHandler.cpp:947andProteinGroupArrowExportnow gate on the namedfraction_group_level_*arrays. Old consensusXML still round-trips via a legacy layout path.total_abundancesfor one release as a deprecated property: warns on read and write, returns empty, ignores assignment.Reference churn
Broad and expected — it is the sample grain disappearing, in two forms:
indistinguishable_proteins_N_abundancesUserParam dropping out of 12 consensusXML references (theirfraction_group_level_abundanceparams are untouched, so the assay values are unchanged);abundance_sampleN[cond]→abundance_fractiongroup{F}_label{L}across 16 ProteinQuantifier.txtreferences.Verification
Full local ctest: 2800/2802 completed, 8 failures, all pre-existing environmental — 6
TOPP_CometAdapter_*_out1(version string),TOPP_PercolatorAdapter_1_subprocess_out(numerics),Doxygen_Warning_test(HAVE_DOTunset, graphviz missing). Identical to the baseline measured before this branch. The 2 unreported wereBrukerTimsFile_testand one straggler cut off at the end of the run, neither touched by this change.Dead members removed, not deprecated
ProteinData::peptide_abundances(peptide -> sample -> abundance) fed the sample-grain top-N gate, peptide selection andcalculateProteinAbundances_; all three either moved topeptide_fraction_group_abundancesor were deleted, and its only writer readtotal_abundances.total_abundancesitself briefly survived as a pyOpenMS compatibility property, but with the C++ members gone there was nothing left to be compatible with.Both are removed outright along with their bindings, rather than left returning an empty container -- a member that silently reads empty is indistinguishable from a protein with no peptides. Callers want
fraction_group_abundances/peptide_fraction_group_abundances. (ThegetBestCharge_parameter also namedpeptide_abundancesis unrelated and stays.)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Breaking Changes