Skip to content

feat(ProteomicsLFQ): add Bruker .d (TimsTOF PASEF) support with Biosaur2 seeding - #9030

Merged
timosachsenberg merged 21 commits into
developfrom
feature/proteomicslfq-dot-d-support
Mar 29, 2026
Merged

timosachsenberg merged 21 commits into
developfrom
feature/proteomicslfq-dot-d-support

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Mar 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add Bruker .d (TimsTOF DDA-PASEF) support to ProteomicsLFQ with IM-aware loading, Biosaur2 seeding, and an OpenSwath IM array naming fix.

What changed

ProteomicsLFQ .d input support

  • Accept .d directories as input (-in)
  • New loadAndPreprocess_() method for .d input:
    • Loads via BrukerTimsFile with built-in Sage-style IM centroiding (ms1_centroid_mz_ppm=5, ms1_centroid_im_pct=3) — collapses ~245k raw peaks/frame into ~10k centroided peaks with summed intensity
    • Skips PeakPickerHiRes (destroys IM arrays), PrecursorCorrection (IM-unaware), clearMetaDataArrays() (preserves IM float arrays)
    • Removes MS2 spectra and MS1 frames without IM data
  • New Seeding:algorithm parameter (multiplex default, biosaur2 option):
    • Forced to biosaur2 for .d input (FeatureFinderMultiplex cannot handle IM_PEAK)
    • Seeding:Biosaur2: subsection exposes all Biosaur2Algorithm parameters
  • FWHM estimation from Biosaur2 feature convex hulls with Gaussian correction
  • FWHM fallback (30s) for targeted_only=true
  • Preserves IM meta values (IM_median, IM_min, IM_max) on features
  • FFId uses Sage IM annotations from idXML for 2D chromatogram extraction (m/z + IM windowing)

OpenSwath IM array naming fix

getDriftTimeArray() only matched "Ion Mobility" and "mean inverse reduced ion mobility array". BrukerTimsFile uses "raw inverse reduced ion mobility array" (CV MS:1003008) which was not recognized. Extended matching to also accept descriptions containing "inverse reduced ion mobility" or "ion mobility array".

Validation (DDA_HeLa_50ng, 5-6 min gradient)

Metric Sage v0.15.0-beta.1 (built-in LFQ) ProteomicsLFQ (tuned)
Runtime 38s 75s
Peptides quantified 2,679 2,809
Model fit success — 80%
Peak memory ~2 GB 1.3 GB
Spearman r vs Sage — 0.62

Recommended timsTOF Biosaur2 tuning: -Seeding:Biosaur2:mini 500 -Seeding:Biosaur2:minlh 3 -Seeding:Biosaur2:pasefminlh 2

Note: Sage v0.14.6 (shipped with OpenMS) cannot do LFQ on .d files — MS1 reading was added in v0.15.0-beta.1.

Test plan

  • All existing ProteomicsLFQ mzML tests pass (no regressions)
  • New biosaur2 seeding smoke test on mzML data passes
  • OpenSwath Datastructures test updated and passes
  • Optional .d integration tests (guarded by WITH_OPENTIMS + SAGE_BINARY):
    • TOPP_ProteomicsLFQ_DDA_PASEF — targeted_only, fast smoke test
    • TOPP_ProteomicsLFQ_DDA_PASEF_biosaur2 — full path with Biosaur2 seeding + tuned params

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for Bruker TimsTOF PASEF (.d) files in ProteomicsLFQ
    • Introduced biosaur2 seeding algorithm option for improved feature detection
    • Enhanced ion mobility data preprocessing and filtering
  • Bug Fixes

    • Improved drift-time array detection with more flexible naming convention matching
  • Tests

    • Added integration tests for DDA-PASEF and biosaur2-based quantification workflows

@coderabbitai

coderabbitai Bot commented Mar 28, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes extend ProteomicsLFQ to accept Bruker .d input format with ion-mobility-aware preprocessing, introduce Biosaur2 as an alternative seeding algorithm, and broaden drift-time array detection to recognize additional naming variants from multiple sources.

Changes

Cohort / File(s) Summary
Ion Mobility Detection Enhancement
src/openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h, src/tests/class_tests/openswathalgo/Datastructures_test.cpp
Broadened OSSpectrum::getDriftTimeArray() matching logic to recognize drift-time arrays by "Ion Mobility" prefix, "inverse reduced ion mobility" substring, or "ion mobility array" substring. Updated test to validate multiple real-world naming variants from Bruker, MSConvert, and ProteoWizard tools.
ProteomicsLFQ Bruker .d Support & Biosaur2 Seeding
src/topp/ProteomicsLFQ.cpp
Added Bruker .d input format support (guarded by WITH_OPENTIMS) with IM-aware preprocessing that skips centroiding and precursor correction. Introduced Seeding:algorithm parameter allowing multiplex or biosaur2, with forced biosaur2 selection for IM data. Added Seeding:Biosaur2:* parameters and IM-aware feature metadata retention (IM_median, IM_min, IM_max).
ProteomicsLFQ Integration Tests
src/tests/topp/CMakeLists.txt
Added three new test configurations: TOPP_IDPosteriorErrorProbability_SageDDA for post-ID processing, TOPP_ProteomicsLFQ_DDA_PASEF with targeted-only mode, and TOPP_ProteomicsLFQ_DDA_PASEF_biosaur2 testing Biosaur2 seeding on Bruker DDA-PASEF data with timsTOF tuning parameters. Added non-DDA smoke test TOPP_ProteomicsLFQ_biosaur2_seeds.

Sequence Diagram

sequenceDiagram
    participant User
    participant ProteomicsLFQ
    participant BrukerTimsFile as BrukerTimsFile<br/>(Loader)
    participant Biosaur2Algo as Biosaur2<br/>Algorithm
    participant Quantifier as Quantification<br/>Pipeline
    
    User->>ProteomicsLFQ: Input: Bruker .d file<br/>(is_im_peak_data detected)
    activate ProteomicsLFQ
    
    ProteomicsLFQ->>BrukerTimsFile: Load .d directory
    activate BrukerTimsFile
    BrukerTimsFile-->>ProteomicsLFQ: Raw spectra + IM data
    deactivate BrukerTimsFile
    
    ProteomicsLFQ->>ProteomicsLFQ: Remove MS2 spectra<br/>Filter MS1 lacking IM
    
    alt Untargeted + IM Data
        ProteomicsLFQ->>Biosaur2Algo: Generate seed features<br/>(forced algorithm for IM)
        activate Biosaur2Algo
        Biosaur2Algo-->>ProteomicsLFQ: Seed features +<br/>convex-hull RT extents
        deactivate Biosaur2Algo
        
        ProteomicsLFQ->>ProteomicsLFQ: Calculate median_fwhm<br/>from RT extents
    else Untargeted + Non-IM Data
        ProteomicsLFQ->>ProteomicsLFQ: Use multiplex algorithm<br/>via DDAWorkflowCommons
    end
    
    ProteomicsLFQ->>ProteomicsLFQ: Skip centroiding/precursor<br/>correction for IM data
    ProteomicsLFQ->>Quantifier: Quantify features with<br/>IM metadata retention
    activate Quantifier
    Quantifier-->>ProteomicsLFQ: Quantified results
    deactivate Quantifier
    
    ProteomicsLFQ-->>User: Output: mzTab + consensusXML
    deactivate ProteomicsLFQ
Loading

Possibly Related PRs

Suggested Labels

Performance

Suggested Reviewers

  • jcharkow
  • singjc
  • pjones
  • cbielow

Poem

🐰 Bruker's ion-ballet twirls through the mob,
Biosaur2 whispers seeds to each blob,
From .d files drift-times dance free,
FWHM medians bloom in harmony,
Ion mobility's promise hops with thee!

🚥 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 PR title accurately and concisely summarizes the main changes: adding Bruker .d (TimsTOF PASEF) support to ProteomicsLFQ with Biosaur2 seeding. It reflects the primary objective without being overly broad or vague.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/proteomicslfq-dot-d-support

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

🧹 Nitpick comments (4)
docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md (2)

148-159: Plan document differs from final implementation.

The plan shows spec.clear(false) for MS2 spectra, but the actual implementation (ProteomicsLFQ.cpp lines 362-368) uses an erase-remove pattern that completely removes MS2 spectra AND filters out MS1 spectra lacking IM data. The implementation is more robust (prevents crashes during IM-windowed extraction).

If this plan is intended to be kept as documentation, consider updating it to match the actual implementation. Otherwise, mark as historical/superseded.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md` around
lines 148 - 159, The plan's snippet showing spec.clear(false) for MS2 spectra is
out of sync with the actual implementation in ProteomicsLFQ.cpp which uses an
erase-remove to drop MS2 spectra and also filters MS1 spectra lacking ion
mobility (IM) data; update the plan document to reflect the real behavior
(describe that ProteomicsLFQ.cpp removes MS2 spectra and removes MS1 spectra
without IM to prevent IM-windowed extraction crashes) or mark the plan as
historical/superseded so readers aren't misled by spec.clear(false) versus the
erase-remove + MS1 IM filtering logic.

302-328: Biosaur2 API and FWHM estimation approach differ from implementation.

The plan shows:

  • bio.run(seeds, hills, peptide_features) — but implementation uses bio.run(seeds)
  • FWHM from pf.rt_end - pf.rt_start — but implementation uses convex hull bounding boxes with a 0.59 Gaussian correction factor

The design spec (line 205) correctly documents the convex hull approach used in the implementation. Consider updating this plan to match, or marking it as superseded by the implementation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md` around
lines 302 - 328, Update the plan to match the implementation: change the call
example from bio.run(seeds, hills, peptide_features) to the actual
bio.run(seeds) used in code (reference: bio.run), and replace the FWHM
estimation description that uses pf.rt_end - pf.rt_start with the convex-hull
bounding-box method plus the 0.59 Gaussian correction factor used in the
implementation (references: convex hull bounding boxes, 0.59 correction,
median_fwhm fallback/default and warning log path). If the plan is intentionally
different, mark it as superseded by the implementation and note where the
convex-hull approach is documented (design spec line ~205).
docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md (1)

127-128: Internal inconsistency: FWHM estimation description.

Line 127-128 states FWHM is computed from PeptideFeature::rt_end - rt_start, but line 205 (and the implementation) describes using "convex hull RT extent with Gaussian correction factor (0.59)". These should be consistent.

📝 Suggested fix for line 127-128
-2. FWHM estimation from Biosaur2 features: use the `run(fm, hills, peptide_features)` overload; for each `PeptideFeature`, compute `fwhm = rt_end - rt_start`; take the median across all features
+2. FWHM estimation from Biosaur2 features: for each seed feature's convex hull, compute `fwhm = (rt_max - rt_min) * 0.59` (Gaussian correction from base width to half-max width); take the median across all features
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md`
around lines 127 - 128, The spec has an internal inconsistency: update the FWHM
estimation text around run(fm, hills, peptide_features) and detect:peak_width to
match the implemented method: for each PeptideFeature compute FWHM as (convex
hull RT extent) * 0.59 (Gaussian correction factor), then take the median across
features, and use that median for FFId detect:peak_width; alternatively, if you
prefer the rt_end - rt_start formulation, change the implementation in the
run(fm, hills, peptide_features) overload and any code computing FWHM to use
PeptideFeature::rt_end - rt_start instead—ensure the spec and the implementation
both reference the same formula and the Gaussian correction factor only if
applied.
src/topp/ProteomicsLFQ.cpp (1)

362-368: Consider logging when MS1 spectra are filtered due to missing IM data.

The filtering correctly prevents crashes during IM-windowed extraction. However, if MS1 spectra are unexpectedly filtered out (e.g., due to data corruption or incomplete conversion), users won't know unless they enable verbose logging. A brief log message could help diagnose issues.

💡 Optional: Add a diagnostic log message
+      Size original_count = spectra.size();
       spectra.erase(
         std::remove_if(spectra.begin(), spectra.end(),
           [](const MSSpectrum& spec)
           {
             return spec.getMSLevel() != 1 || !spec.containsIMData();
           }),
         spectra.end());
+      Size filtered_count = original_count - spectra.size();
+      if (filtered_count > 0)
+      {
+        OPENMS_LOG_INFO << "Filtered " << filtered_count << " spectra (MS2 or MS1 without IM data).\n";
+      }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/ProteomicsLFQ.cpp` around lines 362 - 368, The MS1 filtering loop
that erases spectra using MSSpectrum::getMSLevel and MSSpectrum::containsIMData
should report when MS1 spectra are dropped; before calling std::remove_if on
spectra, compute how many MS1 spectra lack IM (e.g., count_if using
getMSLevel()==1 && !containsIMData), then after removal log a concise diagnostic
via the project's logger (use the same logging facility used elsewhere in
ProteomicsLFQ.cpp) indicating number of MS1 spectra removed and total MS1
spectra inspected so users can diagnose missing IM data without enabling verbose
mode.
🤖 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/tests/topp/CMakeLists.txt`:
- Line 3007: Change the output filenames using uppercase ".mzTab" to the
lowercase ".mztab" extension to follow repo naming rules: search for occurrences
of the string pattern ".mzTab" (e.g. the output token
"ProteomicsLFQ_DDA_PASEF.tmp.mzTab" and the other two similar outputs referenced
in the same CMakeLists) and replace them with ".mztab", keeping the rest of the
filename and surrounding CMake command unchanged so only the extension case is
fixed.

---

Nitpick comments:
In `@docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md`:
- Around line 148-159: The plan's snippet showing spec.clear(false) for MS2
spectra is out of sync with the actual implementation in ProteomicsLFQ.cpp which
uses an erase-remove to drop MS2 spectra and also filters MS1 spectra lacking
ion mobility (IM) data; update the plan document to reflect the real behavior
(describe that ProteomicsLFQ.cpp removes MS2 spectra and removes MS1 spectra
without IM to prevent IM-windowed extraction crashes) or mark the plan as
historical/superseded so readers aren't misled by spec.clear(false) versus the
erase-remove + MS1 IM filtering logic.
- Around line 302-328: Update the plan to match the implementation: change the
call example from bio.run(seeds, hills, peptide_features) to the actual
bio.run(seeds) used in code (reference: bio.run), and replace the FWHM
estimation description that uses pf.rt_end - pf.rt_start with the convex-hull
bounding-box method plus the 0.59 Gaussian correction factor used in the
implementation (references: convex hull bounding boxes, 0.59 correction,
median_fwhm fallback/default and warning log path). If the plan is intentionally
different, mark it as superseded by the implementation and note where the
convex-hull approach is documented (design spec line ~205).

In `@docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md`:
- Around line 127-128: The spec has an internal inconsistency: update the FWHM
estimation text around run(fm, hills, peptide_features) and detect:peak_width to
match the implemented method: for each PeptideFeature compute FWHM as (convex
hull RT extent) * 0.59 (Gaussian correction factor), then take the median across
features, and use that median for FFId detect:peak_width; alternatively, if you
prefer the rt_end - rt_start formulation, change the implementation in the
run(fm, hills, peptide_features) overload and any code computing FWHM to use
PeptideFeature::rt_end - rt_start instead—ensure the spec and the implementation
both reference the same formula and the Gaussian correction factor only if
applied.

In `@src/topp/ProteomicsLFQ.cpp`:
- Around line 362-368: The MS1 filtering loop that erases spectra using
MSSpectrum::getMSLevel and MSSpectrum::containsIMData should report when MS1
spectra are dropped; before calling std::remove_if on spectra, compute how many
MS1 spectra lack IM (e.g., count_if using getMSLevel()==1 && !containsIMData),
then after removal log a concise diagnostic via the project's logger (use the
same logging facility used elsewhere in ProteomicsLFQ.cpp) indicating number of
MS1 spectra removed and total MS1 spectra inspected so users can diagnose
missing IM data without enabling verbose mode.
🪄 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: 090f0d8b-40b4-483a-ac92-acbb4f50545f

📥 Commits

Reviewing files that changed from the base of the PR and between 22e9c8f and 08cb5e1.

📒 Files selected for processing (6)
  • docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md
  • docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md
  • src/openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h
  • src/tests/class_tests/openswathalgo/Datastructures_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProteomicsLFQ.cpp

-fasta ${TESTS_TEMP_DIR}/DecoyDatabase_DDA_out.tmp.fasta
-targeted_only true
-mass_recalibration false
-out ${TESTS_TEMP_DIR}/ProteomicsLFQ_DDA_PASEF.tmp.mzTab

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.

⚠️ Potential issue | 🟡 Minor

Use lowercase .mztab extension for new outputs.

Line 3007, Line 3024, and Line 3475 use .mzTab; please switch to .mztab to match repo naming rules.

🔧 Proposed fix
-      -out ${TESTS_TEMP_DIR}/ProteomicsLFQ_DDA_PASEF.tmp.mzTab
+      -out ${TESTS_TEMP_DIR}/ProteomicsLFQ_DDA_PASEF.tmp.mztab
@@
-      -out ${TESTS_TEMP_DIR}/ProteomicsLFQ_DDA_PASEF_bio.tmp.mzTab
+      -out ${TESTS_TEMP_DIR}/ProteomicsLFQ_DDA_PASEF_bio.tmp.mztab
@@
-         -out ${TESTS_TEMP_DIR}/BSA_biosaur2_seeds.tmp.mzTab
+         -out ${TESTS_TEMP_DIR}/BSA_biosaur2_seeds.tmp.mztab

As per coding guidelines, **/*: Use lowercase file extensions, except for ML/XML and mzData.

Also applies to: 3024-3024, 3475-3475

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tests/topp/CMakeLists.txt` at line 3007, Change the output filenames
using uppercase ".mzTab" to the lowercase ".mztab" extension to follow repo
naming rules: search for occurrences of the string pattern ".mzTab" (e.g. the
output token "ProteomicsLFQ_DDA_PASEF.tmp.mzTab" and the other two similar
outputs referenced in the same CMakeLists) and replace them with ".mztab",
keeping the rest of the filename and surrounding CMake command unchanged so only
the extension case is fixed.

@timosachsenberg
timosachsenberg force-pushed the feature/proteomicslfq-dot-d-support branch from 67bc9a4 to b209ec4 Compare March 28, 2026 20:57

@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

🧹 Nitpick comments (3)
docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md (1)

15-15: Minor: Document structure starts with h3 instead of h2.

The first heading after the title is ### Task 1 (h3). For proper document hierarchy, consider adding an h2 section header before task listings, or change task headers to h2.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md` at line 15,
The document's first subheading uses "### Task 1" (an h3) which breaks
hierarchy; update the heading structure by either changing "### Task 1: Add
Biosaur2Algorithm Include and Input Format Registration" to "## Task 1: Add
Biosaur2Algorithm Include and Input Format Registration" or insert a
higher-level h2 such as "## Tasks" immediately before the existing h3 headings
so all task entries (e.g., "Task 1") remain as h3s under that h2—ensure
consistent heading levels throughout the file.
docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md (1)

95-106: Minor: Fenced code block missing language specifier.

The pseudocode block should specify a language for proper syntax highlighting. Since this is pseudocode, you can use text or pseudocode as the identifier.

📝 Suggested fix
-```
+```text
 if is_im_peak_data:
   force seeding_algorithm = "biosaur2" (warn if user set "multiplex")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md`
around lines 95 - 106, The fenced pseudocode block lacks a language specifier;
update the code fence that surrounds the snippet using is_im_peak_data,
seeding_algorithm, Biosaur2Algorithm, bio.setParameters, bio.setMSData, and
bio.run to include a language tag (e.g., ```text or ```pseudocode) so syntax
highlighting/renderers treat it as pseudocode; leave the contents unchanged and
only modify the opening fence to add the language identifier.
src/topp/ProteomicsLFQ.cpp (1)

347-349: Consider exposing centroiding parameters for advanced users.

The MS1 centroiding parameters (ms1_centroid_mz_ppm = 5.0f, ms1_centroid_im_pct = 3.0f) are hardcoded to match Sage defaults. While this is sensible for most use cases, advanced users with different instrument configurations may need different values.

Consider adding these as advanced parameters under a Seeding:Biosaur2: or new BrukerLoading: subsection, or document this limitation in the tool help.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/ProteomicsLFQ.cpp` around lines 347 - 349, The code currently
hardcodes MS1 centroiding values via config.ms1_centroid_mz_ppm = 5.0f and
config.ms1_centroid_im_pct = 3.0f before calling tdf.load(mz_file, ms_out,
config); make these configurable: add new advanced parameters (e.g. under a
Seeding:Biosaur2: or new BrukerLoading: subsection) that populate these fields,
default to the current values when unspecified, and surface the new options in
the program's help/README; update the code that sets config.ms1_centroid_mz_ppm
and config.ms1_centroid_im_pct to read from the new config entries (falling back
to 5.0f and 3.0f) so tdf.load(...) uses user-provided values.
🤖 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/topp/ProteomicsLFQ.cpp`:
- Around line 370-376: After filtering the spectra vector (the remove_if call
that checks MSSpectrum::getMSLevel() and MSSpectrum::containsIMData()), add a
validation immediately after the erase to check if spectra.empty() and if so
throw a clear exception or return an error (e.g., via throw std::runtime_error
or appropriate error reporting used in the project) with a descriptive message
indicating there are no MS1 spectra with IM data; reference the spectra
container and the lambda that filters on getMSLevel() != 1 and !containsIMData()
so the check is placed directly after that block to fail fast when the input
yields no usable spectra.

---

Nitpick comments:
In `@docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md`:
- Line 15: The document's first subheading uses "### Task 1" (an h3) which
breaks hierarchy; update the heading structure by either changing "### Task 1:
Add Biosaur2Algorithm Include and Input Format Registration" to "## Task 1: Add
Biosaur2Algorithm Include and Input Format Registration" or insert a
higher-level h2 such as "## Tasks" immediately before the existing h3 headings
so all task entries (e.g., "Task 1") remain as h3s under that h2—ensure
consistent heading levels throughout the file.

In `@docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md`:
- Around line 95-106: The fenced pseudocode block lacks a language specifier;
update the code fence that surrounds the snippet using is_im_peak_data,
seeding_algorithm, Biosaur2Algorithm, bio.setParameters, bio.setMSData, and
bio.run to include a language tag (e.g., ```text or ```pseudocode) so syntax
highlighting/renderers treat it as pseudocode; leave the contents unchanged and
only modify the opening fence to add the language identifier.

In `@src/topp/ProteomicsLFQ.cpp`:
- Around line 347-349: The code currently hardcodes MS1 centroiding values via
config.ms1_centroid_mz_ppm = 5.0f and config.ms1_centroid_im_pct = 3.0f before
calling tdf.load(mz_file, ms_out, config); make these configurable: add new
advanced parameters (e.g. under a Seeding:Biosaur2: or new BrukerLoading:
subsection) that populate these fields, default to the current values when
unspecified, and surface the new options in the program's help/README; update
the code that sets config.ms1_centroid_mz_ppm and config.ms1_centroid_im_pct to
read from the new config entries (falling back to 5.0f and 3.0f) so
tdf.load(...) uses user-provided values.
🪄 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: 9c9e13d5-2fda-437e-85ed-baec00c4f4fc

📥 Commits

Reviewing files that changed from the base of the PR and between 67bc9a4 and b209ec4.

📒 Files selected for processing (6)
  • docs/superpowers/plans/2026-03-28-proteomicslfq-dot-d-support.md
  • docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md
  • src/openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h
  • src/tests/class_tests/openswathalgo/Datastructures_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProteomicsLFQ.cpp
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/tests/class_tests/openswathalgo/Datastructures_test.cpp
  • src/openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/DataStructures.h
  • src/tests/topp/CMakeLists.txt

Comment on lines +370 to +376
spectra.erase(
std::remove_if(spectra.begin(), spectra.end(),
[](const MSSpectrum& spec)
{
return spec.getMSLevel() != 1 || !spec.containsIMData();
}),
spectra.end());

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.

⚠️ Potential issue | 🟡 Minor

Add validation after filtering to catch empty result.

After removing MS2 spectra and MS1 spectra without IM data, the spectra vector could become empty (e.g., if the .d file contains only MS2 spectra or MS1 spectra that lack IM arrays). This would cause silent failures downstream rather than a clear error message.

🛡️ Proposed fix to add post-filter validation
       spectra.erase(
         std::remove_if(spectra.begin(), spectra.end(),
           [](const MSSpectrum& spec)
           {
             return spec.getMSLevel() != 1 || !spec.containsIMData();
           }),
         spectra.end());
+
+      if (spectra.empty())
+      {
+        OPENMS_LOG_ERROR << "Error: No MS1 spectra with ion mobility data found in .d file.\n";
+        return INCOMPATIBLE_INPUT_DATA;
+      }

       // No PeakPickerHiRes — Bruker TOF data is centroid-like; IM arrays must be preserved
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/ProteomicsLFQ.cpp` around lines 370 - 376, After filtering the
spectra vector (the remove_if call that checks MSSpectrum::getMSLevel() and
MSSpectrum::containsIMData()), add a validation immediately after the erase to
check if spectra.empty() and if so throw a clear exception or return an error
(e.g., via throw std::runtime_error or appropriate error reporting used in the
project) with a descriptive message indicating there are no MS1 spectra with IM
data; reference the spectra container and the lambda that filters on
getMSLevel() != 1 and !containsIMData() so the check is placed directly after
that block to fail fast when the input yields no usable spectra.

@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

🧹 Nitpick comments (2)
docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md (1)

95-106: Add language specifier to fenced code block.

The pseudocode block at lines 95-106 is missing a language specifier, which triggers the markdownlint MD040 warning. Adding a specifier improves syntax highlighting and linting compliance.

📝 Proposed fix
-```
+```text
 if is_im_peak_data:
   force seeding_algorithm = "biosaur2" (warn if user set "multiplex")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md`
around lines 95 - 106, The fenced pseudocode block containing is_im_peak_data /
seeding_algorithm / Biosaur2Algorithm (bio.setParameters, bio.setMSData, bio.run
and DDAWorkflowCommons::calculateSeeds) lacks a language specifier and triggers
MD040; update the opening triple-backticks to include a language tag (for
example ```text or ```pseudo) so the block is treated as plain/pseudocode and
linting/syntax highlighting pass.
src/topp/ProteomicsLFQ.cpp (1)

344-349: Consider exposing centroiding parameters as advanced options.

The MS1 centroiding parameters (ms1_centroid_mz_ppm=5.0, ms1_centroid_im_pct=3.0) are hardcoded to match Sage defaults. While these are reasonable values, some users may want to tune them for specific instrument configurations or sample types.

Consider adding these as advanced parameters under a Loading:Bruker: subsection in a future iteration if user requests arise.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/topp/ProteomicsLFQ.cpp` around lines 344 - 349, The code hardcodes MS1
centroiding defaults in ProteomicsLFQ by setting config.ms1_centroid_mz_ppm =
5.0f and config.ms1_centroid_im_pct = 3.0f before calling BrukerTimsFile::load;
make these values configurable instead by adding advanced configuration options
(e.g., Loading:Bruker:) that map to BrukerTimsFile::Config fields so the code
reads user-specified ms1_centroid_mz_ppm and ms1_centroid_im_pct (falling back
to 5.0 and 3.0 if unset) and then passes the populated config into
tdf.load(mz_file, ms_out, config).
🤖 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/topp/ProteomicsLFQ.cpp`:
- Around line 1168-1171: The comment in ProteomicsLFQ.cpp incorrectly states
"default IM_window=0.06"; update the comment to reflect that
FeatureFinderIdentificationAlgorithm sets IM_window default to 0.0 (see
FeatureFinderIdentificationAlgorithm) and that 0.06 is only used in
diaPASEF/OpenSwathWorkflow contexts — reference IM_window and
FeatureFinderIdentificationAlgorithm in the text and clarify that BrukerTimsFile
centroiding makes IM_window=0.06 appropriate only for
diaPASEF/OpenSwathWorkflow, not the general default.

---

Nitpick comments:
In `@docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md`:
- Around line 95-106: The fenced pseudocode block containing is_im_peak_data /
seeding_algorithm / Biosaur2Algorithm (bio.setParameters, bio.setMSData, bio.run
and DDAWorkflowCommons::calculateSeeds) lacks a language specifier and triggers
MD040; update the opening triple-backticks to include a language tag (for
example ```text or ```pseudo) so the block is treated as plain/pseudocode and
linting/syntax highlighting pass.

In `@src/topp/ProteomicsLFQ.cpp`:
- Around line 344-349: The code hardcodes MS1 centroiding defaults in
ProteomicsLFQ by setting config.ms1_centroid_mz_ppm = 5.0f and
config.ms1_centroid_im_pct = 3.0f before calling BrukerTimsFile::load; make
these values configurable instead by adding advanced configuration options
(e.g., Loading:Bruker:) that map to BrukerTimsFile::Config fields so the code
reads user-specified ms1_centroid_mz_ppm and ms1_centroid_im_pct (falling back
to 5.0 and 3.0 if unset) and then passes the populated config into
tdf.load(mz_file, ms_out, config).
🪄 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: a9aa13d7-b2a3-482b-836b-0206619e8fe6

📥 Commits

Reviewing files that changed from the base of the PR and between b209ec4 and 73edac9.

📒 Files selected for processing (2)
  • docs/superpowers/specs/2026-03-28-proteomicslfq-dot-d-support-design.md
  • src/topp/ProteomicsLFQ.cpp

Comment thread src/topp/ProteomicsLFQ.cpp Resolved
timosachsenberg and others added 21 commits March 29, 2026 12:46
Add IM_PEAK-aware code path with Biosaur2 seeding, FWHM estimation
from features, and skip of PeakPickerHiRes/PrecursorCorrection for
.d input. Includes design spec and implementation plan.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add Biosaur2Algorithm.h and IMTypes.h includes
- Register "d" as a valid input format alongside mzML
- Add Seeding:algorithm parameter (multiplex/biosaur2 choice)
- Insert Seeding:Biosaur2: subsection with Biosaur2Algorithm defaults (all tagged advanced)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Introduces loadAndPreprocess_() that branches on file type: for Bruker
.d (BRUKER_TDF) files it loads with IM float arrays preserved and skips
PeakPickerHiRes and PrecursorCorrection (both incompatible with IM_PEAK
data); for all other types it delegates to the existing
centroidAndCorrectPrecursors_(). Updates quantifyFraction_() to call
the new method instead of centroidAndCorrectPrecursors_() directly.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…unused include

When .d input is used with targeted_only=true, median_fwhm stayed at 0
because the Biosaur2 FWHM estimation block was guarded by
!targeted_only. Add a fallback to 30s for is_im_peak_data when
median_fwhm is still 0 after the requires_ms_data block, preventing
FFId from receiving a zero peak_width. Also remove the unused
IMTypes.h include.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…TimeArray

getDriftTimeArray() only matched arrays starting with "Ion Mobility" or
"mean inverse reduced ion mobility array". BrukerTimsFile (via IMDataConverter)
uses "raw inverse reduced ion mobility array" (CV MS:1003008) which was not
recognized, causing ChromatogramExtractorAlgorithm to throw during IM-windowed
extraction of .d data.

Extend matching to accept any description containing "inverse reduced ion
mobility" or "ion mobility array", covering all known naming conventions:
Bruker raw, MSConvert legacy, ProteoWizard diaPASEF, and IMDataConverter
millisecond IM.

Also fix the ProteomicsLFQ .d integration test to use IDPosteriorErrorProbability
for PEP score conversion (ProteomicsLFQ requires PEP, not q-value).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…iosaur2 test

Replace naive rt_end-rt_start FWHM with true half-max crossing
interpolation from Biosaur2 hill intensity profiles (same approach as
MassTrace::estimateFWHM). Hills are freed after FWHM computation to
avoid OOM on large datasets.

Add TOPP_ProteomicsLFQ_DDA_PASEF_biosaur2 test exercising the full .d
path with targeted_only=false and Biosaur2 seeding.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…vs ProteomicsLFQ

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
… data

Default Biosaur2 parameters are inherited from Orbitrap-oriented Python
biosaur2 and are very permissive for timsTOF IM_PEAK data, leading to
~10x more seed features than necessary. Document recommended settings
(mini=500, minlh=3, pasefminlh=2) in the tool help text.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Update .d+biosaur2 integration test to use recommended timsTOF parameters
(mini=500, minlh=3, pasefminlh=2). This reduces runtime from 57 min to
65s, memory from 29 GB to 11 GB, and improves model fit success from 35%
to 90% while quantifying more peptides (2,876 vs 2,820).

Update tool documentation and design spec with benchmark comparison.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ILE data

The default IM_window of 0.06 (±0.03 1/K0) was designed for IM-centroided
data. Raw Bruker TIMS profiles spread 0.05-0.15 1/K0, so the default
captures only 33-85% of peak intensity depending on the peptide.

Override to 0.20 (±0.10) when IM_PEAK data is detected, unless the user
explicitly set a wider value. This captures >90% of IM peak area and
improves Pearson correlation with Sage LFQ from 0.57 to 0.63.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…d input

Replace raw IM_PROFILE loading with IM-centroided loading using
BrukerTimsFile's built-in Sage algorithm (ms1_centroid_mz_ppm=5,
ms1_centroid_im_pct=3). This collapses ~245k raw peaks/frame into
~10k centroided peaks, each carrying summed intensity across the
IM profile.

Benefits vs raw IM_PROFILE with widened IM_window:
- 8.5x less memory (1.3 GB vs 11 GB)
- Best correlation with Sage LFQ (Spearman 0.62 vs 0.58)
- Default IM_window=0.06 now correct (no override needed)
- Same approach as Sage v0.15 internally

Removes the IM_window=0.20 override (no longer needed).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Reflect final pipeline using BrukerTimsFile built-in IM centroiding:
75s runtime, 1.3 GB memory, 2,809 peptides quantified, Spearman r=0.62
vs Sage LFQ. Remove stale numbers from raw IM_PROFILE approach.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Guard the #include, .d format registration, and BRUKER_TDF loading
branch with #ifdef WITH_OPENTIMS to prevent compilation failure on
builds without the opentims dependency. Follows the same pattern
used by PeakPickerIM.cpp and FileConverter.cpp.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…pasefminlh=2)

Override Biosaur2Algorithm defaults in ProteomicsLFQ parameter registration
so the tuned values apply to both mzML and .d input without explicit flags.
Default mini=1 is too permissive for any data type, producing excessive
noise seeds. The new defaults reduce seeds ~20x on BSA mzML data and ~300x
on timsTOF HeLa .d data while maintaining the same peptide quantification.

Remove now-redundant explicit params from .d integration test.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…unused variable warning

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…_ in-place

For non-FAIMS data (including Bruker TIMS), process ms_data_ directly
without moving it into a FAIMS group. This avoids the unnecessary
move in splitByFAIMSCV and keeps ms_data_ available after run().

ProteomicsLFQ leverages this: move ms_centroided into Biosaur2, then
retrieve it after run() via getMSData() — eliminating the MSExperiment
copy that was previously needed (~400MB for centroided .d data).

FAIMS data still uses the existing split-by-CV parallel processing path.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@timosachsenberg
timosachsenberg force-pushed the feature/proteomicslfq-dot-d-support branch from 19e44ee to 37d1ce8 Compare March 29, 2026 10:47
@timosachsenberg
timosachsenberg merged commit 2d22938 into develop Mar 29, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the feature/proteomicslfq-dot-d-support branch March 29, 2026 16:39
github-actions Bot pushed a commit that referenced this pull request Mar 30, 2026
Add ProteomicsLFQ entry for PR #9030:
- Bruker TimsTOF .d (BRUKER_TDF) input support with Biosaur2 seeding
- IM_PEAK data path with FWHM estimation and skip of incompatible steps
- New Seeding:algorithm parameter

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Mar 30, 2026
Add ProteomicsLFQ entry for PR #9030:
- Bruker TimsTOF .d (BRUKER_TDF) input support with Biosaur2 seeding
- IM_PEAK data path with FWHM estimation and skip of incompatible steps
- New Seeding:algorithm parameter

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Jun 12, 2026
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