Skip to content

feat: default fragment:min_ion_index=2 in FragmentIndex (skip b1/b2/y1/y2) - #9094

Merged
timosachsenberg merged 2 commits into
developfrom
feat/fragment-index-min-ion-default
Apr 7, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
feat/fragment-index-min-ion-default

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Change the default value of fragment:min_ion_index from 0 to 2 in the FragmentIndex / PeptideDataBaseSearchFI search engine. This matches Sage's default behavior of excluding the four shortest fragment ions (b1, b2, y1, y2) which are often noisy and unreliable.

Motivation

Low-index fragment ions (b1, b2, y1, y2) tend to:

  • Have lower signal-to-noise ratios
  • Match many random peaks across decoys
  • Inflate the candidate count without improving discrimination

Removing them improves both speed and identification rate.

Benchmark

DDA TimsTOF HeLa + Human SwissProt (with decoys), Trypsin/P, 2 missed cleavages, Oxidation(M) + Acetyl(Protein N-term) variable:

Setting Wall time PSMs @ 1% FDR Peak memory
min_ion_index=0 (previous default) 59s 4,339 4,283 MB
min_ion_index=2 (new default) 48s 4,374 3,984 MB
  • +35 PSMs at 1% FDR (improved discrimination)
  • -11s wall time (-19%)
  • -300 MB peak memory (-7%)

Changes

  • FragmentIndex.cpp: change default from 0 to 2
  • PeptideSearchEngineFIAlgorithm.cpp: expose fragment:min_ion_index parameter and set default 2
  • FragmentIndex_test.cpp: update tests that depend on full ion counts to set min_ion_index=0 explicitly (lightweight_fragment_count, multi_mod_per_site, fixed_plus_variable_mods, querySpectrum, tolerance)
  • tests/topp/CMakeLists.txt: update Sage DDA benchmark to use -min_ion_index 2 (matching new FI default for fair comparison)

Test plan

  • FragmentIndex unit tests pass
  • TOPP unit tests pass (PeptideDataBaseSearchFI_1/2, SimpleSearchEngine_1/2)
  • DDA benchmark validates improved PSM count + speed + memory
  • CI passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Configuration Updates
    • New configurable minimum fragment ion index (default: 2). Low-index ions (e.g., b1/b2/y1/y2) are now excluded by default; help text updated to describe inclusive "less than or equal" behavior.
  • Tests
    • Test and CI test-invocation updates to cover both exhaustive (include all ions) and default (skip low-index ions) configurations.

Match Sage's default behavior of excluding the four shortest fragment
ions (b1, b2, y1, y2) from the fragment index. These low-index ions
are often noisy and unreliable, and skipping them:
- Improves PSM count at 1% FDR (DDA HeLa: 4339 → 4374, +35)
- Reduces wall time (59s → 48s, -11s)
- Reduces memory usage (4283 MB → 3984 MB, -300 MB)

Also expose fragment:min_ion_index parameter through
PeptideSearchEngineFIAlgorithm so it can be set by TOPP tools.

Update tests that depend on full ion counts to set min_ion_index=0
explicitly (lightweight_fragment_count, multi_mod_per_site,
fixed_plus_variable_mods, querySpectrum, tolerance).

Update Sage DDA test to use -min_ion_index 2 (matching new FI default).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

@timosachsenberg Please consider adding the following names to the
AUTHORS file:

Timo Sachsenberg

Here's a patch that does this:

@coderabbitai

coderabbitai Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79916ab0-5f9a-4ebb-ac6a-44451d06f4eb

📥 Commits

Reviewing files that changed from the base of the PR and between 5f5b626 and e8b135c.

📒 Files selected for processing (2)
  • src/openms/source/ANALYSIS/ID/FragmentIndex.cpp
  • src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp

📝 Walkthrough

Walkthrough

Changed fragment-indexing behavior and defaults: the in-code filter now excludes ions with index <= configured fragment:min_ion_index (i.e., inclusive), the default value was set to 2 in core components, a matching parameter was added to the peptide-search algorithm, tests were adjusted, and a test invocation updated.

Changes

Cohort / File(s) Summary
Fragment index logic & defaults
src/openms/source/ANALYSIS/ID/FragmentIndex.cpp
Adjusted fragment-generation filter from (i+1) < min_ion_index to (i+1) <= min_ion_index (making the threshold inclusive). Updated default fragment:min_ion_index from 0 to 2; retained minimum constraint setMinInt("fragment:min_ion_index", 0).
Search algorithm parameter
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
Added fragment:min_ion_index defaulting to 2 and added a minimum-integer constraint (defaults_.setMinInt("fragment:min_ion_index", 0)).
Unit tests
src/tests/class_tests/openms/source/FragmentIndex_test.cpp
Test configurations explicitly set fragment:min_ion_index to 0 to force full fragment generation for self-hit and fragment-count assertions.
Topp test invocation
src/tests/topp/CMakeLists.txt
Updated SageAdapter DDA test argument -min_ion_index from 0 to 2 to align the test run with the new default.

Poem

🐰
I nibble at code, hop through the dew,
b1 and y1, I bid adieu.
From two we start, neat and bright—
index trimmed, the matches light.
Hoppity-hop, the fragments chew.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: setting the default fragment:min_ion_index to 2 in FragmentIndex, with the specific effect of skipping b1/b2/y1/y2 ions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fragment-index-min-ion-default

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/openms/source/ANALYSIS/ID/FragmentIndex.cpp`:
- Line 1089: The help string passed to
defaults_.setValue("fragment:min_ion_index", ...) is inconsistent with the
implementation (which skips ions with index <= min_ion_index_); update the
wording so it accurately states the threshold semantics—e.g., "Ions with index
less than or equal to this value are not added to the fragment index (use 0 to
include all ions; 2 skips b1/b2/y1/y2)." Mention the exact symbol
defaults_.setValue("fragment:min_ion_index", ...) and the variable
min_ion_index_ so the change is made at the correct location.
🪄 Autofix (Beta)

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

Run ID: cf20f429-8a8a-4453-ad85-68dd5b528cdf

📥 Commits

Reviewing files that changed from the base of the PR and between 496c26c and 5f5b626.

📒 Files selected for processing (4)
  • src/openms/source/ANALYSIS/ID/FragmentIndex.cpp
  • src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
  • src/tests/class_tests/openms/source/FragmentIndex_test.cpp
  • src/tests/topp/CMakeLists.txt

The previous wording "Minimum ion index to consider" and "Ions below
this index" was inconsistent with the actual implementation, which
skips ions with index ≤ min_ion_index_ (note: less-than-OR-EQUAL, not
strictly below). With min_ion_index=2, b1 and b2 are both skipped
(min ion considered is actually 3, not 2).

Update help string in both FragmentIndex.cpp and
PeptideSearchEngineFIAlgorithm.cpp, plus the inline comment that
incorrectly said "<" instead of "<=".

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@timosachsenberg
timosachsenberg merged commit 15943b8 into develop Apr 7, 2026
19 checks passed
@timosachsenberg
timosachsenberg deleted the feat/fragment-index-min-ion-default branch April 7, 2026 07:43
github-actions Bot pushed a commit that referenced this pull request Apr 8, 2026
Add missing entries for changes since last sync:
- PeptideDataBaseSearchFI: BREAKING default fragment:min_ion_index=2 (#9094)
- PyOpenMS: Fix AASequence.__str__() and copy constructor dispatch (#9098)
- Build: minimum Boost version bumped to 1.81 (#9095)

Co-authored-by: Copilot <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Apr 8, 2026
Add missing entries for commits since last sync (2026-04-06):
- Boost minimum version raised to 1.81 (#9095)
- FragmentIndex default min_ion_index=2, skipping b1/b2/y1/y2 (#9094)
- FragmentIndex faster build with bitmask/SoA/SIMD (#9088)
- AASequence copy constructor fix in pyOpenMS bindings (#9098)

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Apr 8, 2026
Add missing entries for commits since last sync (2026-04-06):
- Boost minimum version raised to 1.81 (#9095)
- FragmentIndex default min_ion_index=2, skipping b1/b2/y1/y2 (#9094)
- FragmentIndex faster build with bitmask/SoA/SIMD (#9088)
- AASequence copy constructor fix in pyOpenMS bindings (#9098)

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg added a commit that referenced this pull request Apr 8, 2026
Add missing entries for changes since last sync:
- PeptideDataBaseSearchFI: BREAKING default fragment:min_ion_index=2 (#9094)
- PyOpenMS: Fix AASequence.__str__() and copy constructor dispatch (#9098)
- Build: minimum Boost version bumped to 1.81 (#9095)

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>
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.

1 participant