Skip to content

Make FeatureLinker consensus output order reproducible (supersedes #9748) - #10660

Merged
timosachsenberg merged 2 commits into
developfrom
claude/featurelinker-reproducible-order
Oct 20, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
claude/featurelinker-reproducible-order

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Timo · project thread

Description

This carries @jonasscheid's fix from #9748 onto the current develop. The fix commit is cherry-picked with its original author. I opened a new PR because the fork branch can't be pushed to from here, and #9748 conflicts with develop in 8 reference files.

FeatureGroupingAlgorithm::postprocess_ used to order the consensus features with a chain of stable sorts (quality, maps, size). Many features tie on these keys, so tied features kept the grouping order. That order depends on the random unique ids of the input features. The fix sorts by position (RT, m/z) first, and uses size, maps and quality only to break exact-position ties.

The second commit regenerates the references whose order changes. #9748 had covered only the FeatureLinker files, so its CI failed on every platform. This PR updates 33 files:

  • FeatureLinkerUnlabeledQT 1–6 and FeatureLinkerUnlabeledKD 1–7 (consensusXML)
  • ProteomicsLFQ 1, 1_subset, 2, 3, 3_seedRT, 5, 7, 8 and strictly_unique (consensusXML and mzTab)
  • MS1LabeledWorkflow 2 and 3_targeted

For every regenerated file I checked that the new output contains the same consensus features (and the same mzTab rows) as the old reference, in a different order. In the regenerated files, the machine-specific paths were reset to the values they had before. The mzTab MTD sections are unchanged.

Local check (Linux, clang 18): I ran the TOPP_FeatureLinker*, TOPP_ProteomicsLFQ* and TOPP_MS1LabeledWorkflow* tests and the FeatureGrouping/QTClusterFinder/StablePairFinder/PipEcho/MS1Labeled class tests, with and without the change. With the new references, the failing set is the same as on develop: 22 tests that fail locally on develop too, presumably because helper tools and test data aren't built in my partial build. The full suite, the FeatureLinkerWNet test (WITH_WNETALIGN) and the pyOpenMS tests are left to CI.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Feature grouping results now use consistent, stable ordering based on position, size, map count, and quality. Ties retain their original order.
  • Tests

    • Updated workflow validation outputs to reflect corrected grouping, feature assignments, peptide identifications, numeric precision, and record ordering.
    • Refreshed quantification and labeled-workflow results with synchronized feature references and current inference metadata.

jonasscheid and others added 2 commits October 20, 2026 13:40
FeatureGroupingAlgorithm::postprocess_ ordered the consensus features with a
chain of stable sorts (quality, maps, size). These keys tie on many consensus
features (e.g. all singletons share size and quality), so tied features kept the
grouping order, which depends on the input features' randomly assigned unique
ids and is not reproducible across runs. Replace the chain with a single
stable_sort whose comparator makes position (RT, m/z) the primary, unique-id
independent key; size/maps/quality only break exact-position ties. Ordering is
equivalent to the previous chain followed by a sortByPosition().
FeatureGroupingAlgorithm now sorts the consensus features by position, so the
FeatureLinkerUnlabeledQT/KD, ProteomicsLFQ and MS1LabeledWorkflow references list
the same consensus features in a new order. Checked for each file: the set of
consensus features (and of mzTab rows) is unchanged, only the order differs.
Machine paths in the regenerated files are kept as they were.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01N27gUPMwAazeK8SAKECuCa
@timosachsenberg timosachsenberg self-assigned this Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4b70398e-1b31-40e9-b711-06a56a30a1e4
📥 Commits

Reviewing files that changed from the base of the PR and between 3f47481 and 2db5725.

📒 Files selected for processing: 34
  • src/openms/include/OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithm.h
  • src/tests/topp/FeatureLinkerUnlabeledKD_1_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledKD_2_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledKD_3_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledKD_4_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledKD_5_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledKD_6_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledKD_7_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledQT_1_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledQT_2_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledQT_3_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledQT_4_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledQT_5_output.consensusXML
  • src/tests/topp/FeatureLinkerUnlabeledQT_6_output.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_2_out.consensusXML
  • src/tests/topp/MS1LabeledWorkflow_2_out.mzTab
  • src/tests/topp/MS1LabeledWorkflow_3_targeted_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_1_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_1_out.mzTab
  • src/tests/topp/ProteomicsLFQ_1_subset_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_1_subset_out.mzTab
  • src/tests/topp/ProteomicsLFQ_2_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_2_out.mzTab
  • src/tests/topp/ProteomicsLFQ_3_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_3_out.mzTab
  • src/tests/topp/ProteomicsLFQ_3_seedRT_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_3_seedRT_out.mzTab
  • src/tests/topp/ProteomicsLFQ_5_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_5_out.mzTab
  • src/tests/topp/ProteomicsLFQ_7_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_7_out.mzTab
  • src/tests/topp/ProteomicsLFQ_8_out.consensusXML
  • src/tests/topp/ProteomicsLFQ_8_out.mzTab
  • src/tests/topp/ProteomicsLFQ_strictly_unique_out.mzTab

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

Feature grouping now sorts consensus features stably by position, size, map count, and quality. TOPP expected outputs were updated across FeatureLinker, MS1-labeled workflow, and ProteomicsLFQ runs.

Changes: Feature grouping and output snapshots

Layer / File(s) Summary
Sort order and feature-linker outputs
src/openms/include/OpenMS/ANALYSIS/MAPMATCHING/FeatureGroupingAlgorithm.h, src/tests/topp/FeatureLinkerUnlabeled*_output.consensusXML
Feature grouping uses a stable ordering by position ascending, size descending, map count ascending, and quality ascending. FeatureLinker snapshots contain reordered or revised consensus records and peptide annotations.
MS1-labeled workflow outputs
src/tests/topp/MS1LabeledWorkflow_2_out.*, src/tests/topp/MS1LabeledWorkflow_3_targeted_out.consensusXML
The snapshots update inference-version metadata and feature references. The mzTab records also use updated F2 spectra references and file names.
ProteomicsLFQ output snapshots
src/tests/topp/ProteomicsLFQ_*_out.*
The snapshots update inference-version metadata and feature identifiers across consensusXML and mzTab. Some numeric precision, abundance, score formatting, and spectra-path values also change.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2db57

This change makes consensus feature output order reproducible by sorting on retention time and m/z, with deterministic tie-breaks. Most updated test references reflect only reordering or regenerated identifiers. The cross-file identifiers that were checked are consistent. No outstanding issues block merging, apart from normal CI confirmation of the full suite.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (25 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: making FeatureLinker consensus output order reproducible. The issue reference is relevant but not required for understanding the change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (25 skipped: 25 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

I’m a rabbit beside the row,
Watching features sort and flow.
IDs hop into place anew,
Snapshots match the changed view.
I nibble clover, pleased to see,
Each record where it ought to be.

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg
timosachsenberg merged commit 2b8ceb0 into develop Oct 20, 2026
33 checks passed
@timosachsenberg
timosachsenberg deleted the claude/featurelinker-reproducible-order branch October 20, 2026 16:19
timosachsenberg pushed a commit that referenced this pull request Oct 21, 2026
Conflicts in the ProteomicsLFQ_3 and ProteomicsLFQ_3_seedRT references:
develop (#10660) reordered their consensus features and gave them new
unique ids, without changing their contents. Resolved by taking develop's
references and adding the 16 mbr_transfer_map_indices values of this
branch to the same consensus features, matched by content (centroid,
grouped elements, peptide hits), plus the mzTab column, matched by
opt_global_feature_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MzD9y3qFyEZWkAYVLqcghM
singjc pushed a commit to singjc/OpenMS that referenced this pull request Oct 21, 2026
…enMS#9748) (OpenMS#10660)

* Sort consensus map by position after grouping for reproducible output

FeatureGroupingAlgorithm::postprocess_ ordered the consensus features with a
chain of stable sorts (quality, maps, size). These keys tie on many consensus
features (e.g. all singletons share size and quality), so tied features kept the
grouping order, which depends on the input features' randomly assigned unique
ids and is not reproducible across runs. Replace the chain with a single
stable_sort whose comparator makes position (RT, m/z) the primary, unique-id
independent key; size/maps/quality only break exact-position ties. Ordering is
equivalent to the previous chain followed by a sortByPosition().

* [TEST] Update references for the position-sorted consensus output

FeatureGroupingAlgorithm now sorts the consensus features by position, so the
FeatureLinkerUnlabeledQT/KD, ProteomicsLFQ and MS1LabeledWorkflow references list
the same consensus features in a new order. Checked for each file: the set of
consensus features (and of mzTab rows) is unchanged, only the order differs.
Machine paths in the regenerated files are kept as they were.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01N27gUPMwAazeK8SAKECuCa

---------

Co-authored-by: jonasscheid <[email protected]>
Co-authored-by: Claude <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Oct 21, 2026
…#10677, ...)

Conflicts:
- ConsensusMap::appendColumns: develop shifts the map indices of match-between-runs transfers
  (#10672); the identification data of the branch keeps its own map index shift.
- FileTypes: .raw is compressed-readable (#10647); .oms stays a removed format.
- CHANGELOG: both entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
timosachsenberg pushed a commit that referenced this pull request Oct 21, 2026
…tively

- #10660: the feature grouping algorithms sort the consensus map by position in
  postprocessMaps().
- #10633: the PIP-ECHO donor gate reads the q-value of a donor's identifications from
  the identification data of its map: the primary score if it is a q-value, else a
  q-value meta value or supplementary score of the first match (as legacy export gives
  them to the peptide hit). The test covers both and builds its maps as identification
  data.
- #10672: IDConflictResolverAlgorithm::annotateTransfers() reads the "map_index" of the
  identifications that a consensus feature links; its C++ and Python tests build their
  maps as identification data. ConsensusMap::appendColumns() shifts the transfer map
  indices.
- #10656: FeatureFinderIdentificationAlgorithm extracts the seeds of a FAIMS CV only at
  that CV.
- bfc1c83/1781d9e621: protein inference on a consensus map skips grouping and
  resolution of an empty graph; the new test runs on identification data.
- #10652: the mzTab tests build their consensus maps as identification data.

ProteomicsLFQ reference outputs: develop's new references with the order of the
identifications that this branch writes (the same consensus features, identifications
and values; mzTab: the PSM rows of develop, in this branch's order and numbering).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants