Skip to content

[FEATURE] Add Thermo RAW file reading support via openms-thermo-bridge - #9389

Merged
poshul merged 34 commits into
developfrom
claude/debug-ci-pr-9235-bnkIo
May 23, 2026
Merged

poshul merged 34 commits into
developfrom
claude/debug-ci-pr-9235-bnkIo

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Integrates github.com/jpfeuffer/openms-thermo-bridge using CMake FetchContent
to enable native reading of Thermo RAW files into MSExperiment.

  • Add WITH_THERMO_RAW CMake option (OFF by default)
  • FetchContent openms-thermo-bridge from GitHub
  • Create ThermoRawFile class (header + implementation)
  • Register in FileHandler, FileTypes, and FORMAT sources
  • Handle runtime file deployment for managed .NET bridge DLLs
  • Add test data download option (ENABLE_THERMO_RAW_TESTS)

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/0baa4939-e841-4551-84a6-7d773b80aa2c

Co-authored-by: jpfeuffer [email protected]

Summary by CodeRabbit

  • New Features
    • Optional native Thermo Fisher RAW support with platform-aware defaults (disabled by default on Linux aarch64).
  • Tests
    • New Thermo RAW test executable and optional integration tests that can download pinned test data when enabled.
  • Documentation
    • Expanded guidance on enabling Thermo RAW support, tests, and platform/runtime requirements.
  • Chores
    • macOS build now installs the .NET SDK; CI jobs adjusted to disable Thermo RAW in certain builds.
  • Bug Fixes
    • Improved macOS diagnostic logging for a file-reader constructor.

Review Change Stack

Copilot AI and others added 22 commits April 28, 2026 18:43
Integrates github.com/jpfeuffer/openms-thermo-bridge using CMake FetchContent
to enable native reading of Thermo RAW files into MSExperiment.

- Add WITH_THERMO_RAW CMake option (OFF by default)
- FetchContent openms-thermo-bridge from GitHub
- Create ThermoRawFile class (header + implementation)
- Register in FileHandler, FileTypes, and FORMAT sources
- Handle runtime file deployment for managed .NET bridge DLLs
- Add test data download option (ENABLE_THERMO_RAW_TESTS)

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/0baa4939-e841-4551-84a6-7d773b80aa2c

Co-authored-by: jpfeuffer <[email protected]>
- Remove unnecessary DataProcessing clear for centroid scans
- Add comment explaining HCD -> BEAM mapping
- Add warning log for unknown activation types
- Fix FetchContent SOURCE_DIR variable name typo

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/0baa4939-e841-4551-84a6-7d773b80aa2c

Co-authored-by: jpfeuffer <[email protected]>
… resolve FileTypes_test.cpp conflict (READABLE count: 47+1=48)

Co-authored-by: jpfeuffer <[email protected]>
…ntime copy + macOS arm64 stub

- Test: gate the precursor round-trip assertion on the test data actually
  containing MSn spectra. The bundled ginkgotoxin RAW is MS1-only, so the
  unconditional TEST_EQUAL(found_msn_precursor, true) was failing on
  Linux/Windows. Emit STATUS log when no MSn present so the gap is visible.
- CMake: copy the managed bridge runtime files (ThermoWrapperManaged.dll +
  .runtimeconfig.json) next to ThermoRawFile_test.exe via a POST_BUILD
  step. The bridge searches exe_dir/managed first; on Windows the test
  binary lives in src/tests/class_tests/bin which is a different directory
  from libOpenMS.dll, so the OpenMS-target copy was not visible at runtime.
- Test: provide a placeholder main() when WITH_THERMO_RAW is OFF so the
  test target still links on platforms where the bridge is disabled (macOS
  arm64 default). The empty TU previously caused "Undefined symbols: _main".

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The cibuildwheel manylinux containers and Windows/macOS wheel builders do
not have the .NET SDK pre-installed, so the FetchContent step for
openms-thermo-bridge fails with:

  Could not find DOTNET_EXECUTABLE using the following names: dotnet

Pass -DWITH_THERMO_RAW=OFF in all four wheel cmake invocations (Linux x64,
Linux arm64, macOS arm64, Windows). The wheels stay portable; users who
need Thermo RAW support can build OpenMS from source with the bridge
enabled.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Thermo's RawFileReader does not ship native dependencies for arm64 on
either macOS or Linux. The bridge configures and builds (it is just
managed .NET), but at runtime the C# code throws a managed exception
when it tries to open a RAW file because the underlying native helpers
aren't present. CI confirmed: ubuntu-24.04-arm fails ThermoRawFile_test
with "Failed to open RAW file (code -2)" (managed exception).

Extend the existing macOS arm64 default-off to also cover Linux arm64
and update the warning/status message accordingly.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…NETALIGN blocks in src/openms/CMakeLists.txt

Co-authored-by: timosachsenberg <[email protected]>
…SOLVER, WITH_THERMO_RAW, ENABLE_THERMO_RAW_TESTS, WITH_WNETALIGN

Co-authored-by: timosachsenberg <[email protected]>
v0.2.0 ships native osx-arm64 managed runtime assets, so the
arm64/Apple workarounds added earlier in this branch are no longer
needed.

Changes:
- cmake/cmake_findExternalLibs.cmake: pin GIT_TAG to v0.2.0
- CMakeLists.txt: narrow the arm64 default-OFF guard to Linux aarch64
  only (macOS arm64 is now fully supported); update messages
- .github/workflows/pyopenms-wheels-cibuildwheel.yml: remove
  -DWITH_THERMO_RAW=OFF from the macOS arm64 wheel build job
- ThermoRawFile_test.cpp: update comment to reflect that only Linux
  aarch64 still defaults to OFF
…w, gate behind ENABLE_THERMO_RAW_TESTS (opt-in)

The previous ginkgotoxin sample was MS1-only, leaving the MS2 precursor
round-trip assertion silently skipped. Angiotensin_AllScans.raw (BSD-2-Clause,
Battelle 2018) has 87 MS1 (FTMS Full ms) plus hundreds of MS2 scans with HCD
and supplemental-activation (ETD+HCD, ETD+CID) filters at precursor m/z 432.9,
exercising the activation-method switch in ThermoRawFile.cpp.

- CMakeLists.txt: flip ENABLE_THERMO_RAW_TESTS default to OFF to match the
  ENABLE_OPENTIMS_TESTS pattern (opt-in for integration data downloads). Pin
  FetchContent URL to a specific PNNL commit and verify with URL_HASH SHA256.
- ThermoRawFile_test.cpp: replace the MS1-only-gated round-trip with concrete
  assertions on MS1+MSn presence, positive polarity, precursor m/z preservation
  through mzML, and at least one activation method seen on the MS2 spectra.
- doc/doxygen/install/common-cmake-parameters.doxygen: update ENABLE_THERMO_RAW_TESTS
  default note.

https://claude.ai/code/session_016q1fcq679fQJ2EMRSCxNQY
@github-actions

Copy link
Copy Markdown
Contributor

@timosachsenberg The following names might be missing from the AUTHORS file:

  • Claude

Please consider applying the following patch:

--- AUTHORS	2026-05-20 19:48:44.637812803 +0000
+++ AUTHORS.new	2026-05-20 19:48:49.918359571 +0000
@@ -23,6 +23,7 @@
  - Chris Bauer
  - Chris Bielow
  - Christian Ehrlich
+ - Claude
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@coderabbitai

coderabbitai Bot commented May 20, 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

Adds Thermo RAW reading via openms-thermo-bridge: CMake feature flags and platform defaults, bridge acquisition, OpenMS wiring and exported flag, ThermoRawFile public API and implementation, FileHandler integration, tests (including optional downloaded raw test data), docs, CI adjustments, and Bruker exception-diagnostic enhancement.

Changes

Thermo RAW Support

Layer / File(s) Summary
Build Configuration and Feature Defaults
CMakeLists.txt
Defines WITH_THERMO_RAW with platform-aware default (disabled on Linux aarch64), adds ENABLE_THERMO_RAW_TESTS, and FetchContent logic to download pinned raw test data into THERMO_RAW_TEST_DATA when enabled.
External Library Integration
cmake/cmake_findExternalLibs.cmake
Finds or fetches openms-thermo-bridge (v0.2.0) when enabled; forces static+PIC build for link compatibility, disables subproject tests, restores saved CMake flags, adjusts the fetched target's PIC property, and optionally downloads/installs the Thermo RawFileReader License.doc.
OpenMS Target Wiring
src/openms/CMakeLists.txt, cmake/OpenMSConfig.cmake.in
Links OpenMSThermoBridge::openms_thermo_bridge privately into OpenMS, adds public define WITH_THERMO_RAW=1, conditionally copies bridge runtime files to OpenMS output, and exports WITH_THERMO_RAW via OpenMSConfig.cmake.
Public API Declaration
src/openms/include/OpenMS/FORMAT/ThermoRawFile.h, src/openms/include/OpenMS/FORMAT/sources.cmake
Adds OpenMS::ThermoRawFile class with void load(const String& path, MSExperiment& exp) and conditionally includes the header in project header lists when the feature is enabled.
Core Loading Implementation
src/openms/source/FORMAT/ThermoRawFile.cpp, src/openms/source/FORMAT/sources.cmake
Implements ThermoRawFile::load() to validate file, construct bridge RawFile, set source/instrument metadata, iterate scans to set RT, MS level, centroid/profile, polarity, build precursors (activation mapping), read peaks, sort spectra, update ranges, and map bridge errors to Exception::ParseError.
File Format Handler Integration
src/openms/source/FORMAT/FileHandler.cpp, src/openms/source/FORMAT/FileTypes.cpp
Marks FileTypes::RAW as readable/provides-experiment, conditions FileHandler to recognize RAW only when WITH_THERMO_RAW is enabled, and routes RAW loads to ThermoRawFile with MS-level filtering and range updates.
Testing and Test Wiring
src/tests/class_tests/openms/source/ThermoRawFile_test.cpp, src/tests/class_tests/openms/CMakeLists.txt, src/tests/class_tests/openms/executables.cmake, src/tests/class_tests/openms/source/FileTypes_test.cpp
Adds tests: missing-file exception check and optional round-trip raw→mzML→reload using THERMO_RAW_TEST_DATA; test wiring sets compile definition, extended timeout (1200s), copies runtime files if helper exists, registers ThermoRawFile_test, and updates FileTypes test expectation and executable list.
Documentation and CI Updates
doc/doxygen/install/common-cmake-parameters.doxygen, .github/workflows/pyopenms-wheels-cibuildwheel.yml, .github/actions/dependencies/action.yml
Documents WITH_THERMO_RAW and ENABLE_THERMO_RAW_TESTS options and platform/.NET requirements; CI disables Thermo RAW in pyopenms wheel builds for Linux x64/arm64 and Windows x64 and adds a macOS .NET SDK install step in the dependency action.
Bruker Diagnostic Instrumentation
src/openms/source/FORMAT/BrukerTimsFile.cpp
Adds ABI demangling includes and expanded exception-type logging in openTimsDataHandle to print exception messages and (mangled/demangled) type names before rethrowing.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ThermoRawFile
  participant Bridge as openms_thermo_bridge::RawFile
  participant MSExperiment
  Client->>ThermoRawFile: load(path, exp)
  ThermoRawFile->>Bridge: construct RawFile(path)
  Bridge-->>ThermoRawFile: provide scan metadata + peaks
  ThermoRawFile->>MSExperiment: add spectra (RT, msLevel, peaks, precursors)
  ThermoRawFile->>MSExperiment: sort & updateRanges()
  ThermoRawFile-->>Client: return or throw ParseError
Loading

Possibly related issues

Possibly related PRs

  • OpenMS/OpenMS#8999: Overlaps edits to BrukerTimsFile.cpp and related exception/diagnostic logic.

Suggested labels

Review effort 2/5

"🐰
I nibbled code and stitched a little bridge,
RAW peaks hopped home across the data ridge.
Metadata snug, activations set right,
Tests queued, builds tuned for each flight,
OpenMS hums softly through day and night."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 accurately describes the primary feature being added: Thermo RAW file reading support via the openms-thermo-bridge integration. It is specific, concise, and clearly reflects the main objective of the PR.
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.

✏️ 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 claude/debug-ci-pr-9235-bnkIo

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pyopenms-wheels-cibuildwheel.yml (1)

264-291: ⚠️ Potential issue | 🟠 Major

Add -DWITH_THERMO_RAW=OFF to the macOS wheel build for consistency.

Linux (x64 and arm64) and Windows x64 builds explicitly disable Thermo RAW via -DWITH_THERMO_RAW=OFF to ensure portable binary distribution without .NET runtime dependencies. The macOS build (lines 264-291) does not include this flag, which means it uses the CMake default (enabled). To maintain consistency across all wheel distributions, macOS should also disable Thermo RAW.

🤖 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 @.github/workflows/pyopenms-wheels-cibuildwheel.yml around lines 264 - 291,
The macOS wheel build's CMake invocation (the cmake .. block that sets
-DCMAKE_BUILD_TYPE, -DOpenMP_ROOT, -DPYOPENMS, -DWITH_GUI, etc., used before
ninja OpenMS OpenSwathAlgo) is missing the -DWITH_THERMO_RAW=OFF flag; add
-DWITH_THERMO_RAW=OFF to that cmake .. command so the macOS build disables
Thermo RAW like the Linux and Windows jobs and avoids pulling .NET runtime
dependencies.
🧹 Nitpick comments (2)
src/tests/class_tests/openms/source/ThermoRawFile_test.cpp (1)

71-77: ⚡ Quick win

Use NEW_TMP_FILE for test output files.

This test manually builds/removes a temp path; please switch to NEW_TMP_FILE for consistent class-test temp file handling.

Proposed change
-  String tmp_mzml = File::getTempDirectory() + "/" + File::getUniqueName() + "_thermo_roundtrip.mzML";
+  String tmp_mzml;
+  NEW_TMP_FILE(tmp_mzml);
   MzMLFile().store(tmp_mzml, original);

   MSExperiment reloaded;
   MzMLFile().load(tmp_mzml, reloaded);
-  File::remove(tmp_mzml);

As per coding guidelines, unit tests must use NEW_TMP_FILE for each output file to avoid side effects in comparison macros.

🤖 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/ThermoRawFile_test.cpp` around lines 71 -
77, Replace the manual temp file creation/removal using tmp_mzml and
File::remove with the NEW_TMP_FILE mechanism: create a NEW_TMP_FILE entry for
the mzML output and use that filename when calling MzMLFile().store(tmp_file,
original) and MzMLFile().load(tmp_file, reloaded), removing any explicit
File::getTempDirectory(), File::getUniqueName(), and File::remove calls so the
test uses the standard NEW_TMP_FILE lifetime management.
src/openms/source/FORMAT/ThermoRawFile.cpp (1)

29-196: 🏗️ Heavy lift

Split load into focused helpers to reduce cognitive load.

This method now bundles path validation, source/instrument mapping, scan conversion, precursor mapping, and peak transfer. Extracting these into small private helpers would make failures easier to isolate and unit-test.

🤖 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/ThermoRawFile.cpp` around lines 29 - 196, The load
method in ThermoRawFile is too large; split it into small private helper methods
to isolate responsibilities: add helpers like parseSourceFile(const
std::filesystem::path& raw_path, openms::thermo_bridge::RawFile& raw) to build
and push SourceFile, fillInstrumentMetadata(openms::thermo_bridge::RawFile& raw,
Instrument& inst) to set instrument fields, convertScanToSpectrum(int scan,
openms::thermo_bridge::RawFile& raw) -> MSSpectrum to handle RT, ms level,
nativeID, polarity, scan comment and spectrum type, mapPrecursorForScan(int
scan, openms::thermo_bridge::RawFile& raw) -> optional<Precursor> to encapsulate
precursor mass/charge/activation/isolation mapping, and
transferPeaks(MSSpectrum&, decltype(raw.spectrum_data(0,true))& data) to fill
mz/intensity pairs; then have ThermoRawFile::load call these helpers in the loop
and on error still catch bridge_error as before.
🤖 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 `@doc/doxygen/install/common-cmake-parameters.doxygen`:
- Line 149: Update the platform support sentence that currently reads "Disabled
automatically on Linux/aarch64 and macOS/arm64 targets" to remove macOS/arm64 so
it only states "Disabled automatically on Linux/aarch64 targets" and, if
desired, append a short parenthetical noting that macOS/arm64 support was added
in bridge v0.2.0; edit the single-line text in the document block containing
that sentence to reflect this change.

In `@src/openms/source/FORMAT/ThermoRawFile.cpp`:
- Around line 170-178: The loop in ThermoRawFile::(use surrounding function)
uses size_t and assumes data.mz and data.intensities are same length; change the
loop counter to OpenMS::Size and guard against mismatched arrays from
raw.spectrum_data by computing a safe length (e.g. min(data.mz.size(),
data.intensities.size())), resize spectrum to that safe length, and iterate only
up to that length when calling spectrum[i].setMZ(...) and
spectrum[i].setIntensity(...); this ensures you use the project's Size type and
avoid out‑of‑bounds access for data.mz/data.intensities mismatches.
- Around line 131-159: The activation-type mapping is incorrectly inside the
collision-energy guard so activation methods are lost when ce <= 0.0; move the
block that reads raw.activation_type() and updates prec.getActivationMethods()
(the CID/HCD/ETD/ECD/unknown branch) outside the ce > 0.0 conditional so it
always runs, and keep only prec.setActivationEnergy(ce) (and its ce > 0.0 check
using raw.collision_energy(scan)) inside the energy guard; update code around
raw.collision_energy(scan), raw.activation_type(scan),
prec.getActivationMethods(), and prec.setActivationEnergy() accordingly.

---

Outside diff comments:
In @.github/workflows/pyopenms-wheels-cibuildwheel.yml:
- Around line 264-291: The macOS wheel build's CMake invocation (the cmake ..
block that sets -DCMAKE_BUILD_TYPE, -DOpenMP_ROOT, -DPYOPENMS, -DWITH_GUI, etc.,
used before ninja OpenMS OpenSwathAlgo) is missing the -DWITH_THERMO_RAW=OFF
flag; add -DWITH_THERMO_RAW=OFF to that cmake .. command so the macOS build
disables Thermo RAW like the Linux and Windows jobs and avoids pulling .NET
runtime dependencies.

---

Nitpick comments:
In `@src/openms/source/FORMAT/ThermoRawFile.cpp`:
- Around line 29-196: The load method in ThermoRawFile is too large; split it
into small private helper methods to isolate responsibilities: add helpers like
parseSourceFile(const std::filesystem::path& raw_path,
openms::thermo_bridge::RawFile& raw) to build and push SourceFile,
fillInstrumentMetadata(openms::thermo_bridge::RawFile& raw, Instrument& inst) to
set instrument fields, convertScanToSpectrum(int scan,
openms::thermo_bridge::RawFile& raw) -> MSSpectrum to handle RT, ms level,
nativeID, polarity, scan comment and spectrum type, mapPrecursorForScan(int
scan, openms::thermo_bridge::RawFile& raw) -> optional<Precursor> to encapsulate
precursor mass/charge/activation/isolation mapping, and
transferPeaks(MSSpectrum&, decltype(raw.spectrum_data(0,true))& data) to fill
mz/intensity pairs; then have ThermoRawFile::load call these helpers in the loop
and on error still catch bridge_error as before.

In `@src/tests/class_tests/openms/source/ThermoRawFile_test.cpp`:
- Around line 71-77: Replace the manual temp file creation/removal using
tmp_mzml and File::remove with the NEW_TMP_FILE mechanism: create a NEW_TMP_FILE
entry for the mzML output and use that filename when calling
MzMLFile().store(tmp_file, original) and MzMLFile().load(tmp_file, reloaded),
removing any explicit File::getTempDirectory(), File::getUniqueName(), and
File::remove calls so the test uses the standard NEW_TMP_FILE lifetime
management.
🪄 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: 7f1edb0f-bb04-43a3-aee5-69feb58ca8ae

📥 Commits

Reviewing files that changed from the base of the PR and between cf5bb9e and 7c02954.

📒 Files selected for processing (16)
  • .github/workflows/pyopenms-wheels-cibuildwheel.yml
  • CMakeLists.txt
  • cmake/OpenMSConfig.cmake.in
  • cmake/cmake_findExternalLibs.cmake
  • doc/doxygen/install/common-cmake-parameters.doxygen
  • src/openms/CMakeLists.txt
  • src/openms/include/OpenMS/FORMAT/ThermoRawFile.h
  • src/openms/include/OpenMS/FORMAT/sources.cmake
  • src/openms/source/FORMAT/FileHandler.cpp
  • src/openms/source/FORMAT/FileTypes.cpp
  • src/openms/source/FORMAT/ThermoRawFile.cpp
  • src/openms/source/FORMAT/sources.cmake
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
  • src/tests/class_tests/openms/source/FileTypes_test.cpp
  • src/tests/class_tests/openms/source/ThermoRawFile_test.cpp

@jpfeuffer

Copy link
Copy Markdown
Contributor

why did it remove the dotnet installation fix??

The bridge calls `dotnet publish` for ThermoWrapperManaged.csproj and
FindDotNetHost.cmake needs `nethost.h`/`libnethost` from the
Microsoft.NETCore.App.Host.osx-arm64 SDK pack. macOS runners do not
ship a .NET SDK by default, so configure fails with
`DotNetHost_INCLUDE_DIR/DotNetHost_LIBRARY` missing.

Add an `actions/setup-dotnet@v4` step pinned to 8.0.x (matching the
managed wrapper's net8.0 target) in:
- .github/actions/dependencies/action.yml (covers macOS xcode CI)
- .github/workflows/pyopenms-wheels-cibuildwheel.yml (covers wheel
  build-wheels-macos job)

setup-dotnet exports `DOTNET_ROOT`, which FindDotNetHost.cmake picks
up to locate the host pack.

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

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pyopenms-wheels-cibuildwheel.yml:
- Around line 267-270: Replace the mutable action reference used in the "Install
.NET SDK" step (uses: actions/setup-dotnet@v4) with the pinned commit SHA;
update the uses value to
actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 so the workflow
step "Install .NET SDK" deterministically uses that exact commit.
🪄 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: 7fbf123d-ba35-46bb-b1e6-f80af775e443

📥 Commits

Reviewing files that changed from the base of the PR and between 7c02954 and cff08a2.

📒 Files selected for processing (2)
  • .github/actions/dependencies/action.yml
  • .github/workflows/pyopenms-wheels-cibuildwheel.yml

timosachsenberg and others added 3 commits May 21, 2026 12:53
Previous diag showed std::system_error typeinfo address matches
between throw and catch sites, but catch(const std::exception&)
still fails. The next address we need is what  (the
typeinfo pointer for runtime_error stored inside system_error's
typeinfo) actually points at -- which copy of std::runtime_error
the throw was bound to.

If __base_type address != local typeid(std::runtime_error) address,
the typeinfo objects live in different dylibs (libc++abi vs.
libc++ or libnethost-shadowed) and that's the explicit divergence
that breaks the catch chain walk.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…tch probes

Apple libcxxabi <cxxabi.h> does not publicly expose __si_class_type_info /
__vmi_class_type_info, so 4f91e3c broke the macOS build. Replace the
chain walk with three rethrow-and-catch probes (system_error, runtime_error,
exception) that pin the break point in the typeinfo chain without needing
ABI internals.

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

On macOS xcode with WITH_THERMO_RAW=ON, BrukerTimsFile_test line 115
(TEST_EXCEPTION(Exception::FileNotReadable, f.load("/nonexistent/path.d",
exp))) reported "wrong exception thrown! No such file or directory":

  openTimsDataHandle's catch(const std::exception&) was failing to match
  the std::__1::system_error opentims actually throws.

Diagnosis (see #9392 for the full measurement log):
- typeid(std::system_error) / std::runtime_error addresses in
  BrukerTimsFile.cpp match the thrown exception's chain exactly.
- typeid(std::exception) address does NOT match the address that
  runtime_error's base_type field stores inside the thrown chain.
- catch(std::system_error)  matches the throw    -> chain OK there
  catch(std::runtime_error) matches the throw    -> chain OK there
  catch(std::exception)     does NOT match       -> chain breaks here.

Cause: linking openms-thermo-bridge into libOpenMS.dylib introduces a
second copy of typeinfo for std::exception inside libOpenMS.dylib that
doesn't coalesce with the one libc++abi.dylib exports. Without the
bridge (e.g., on develop, or with WITH_THERMO_RAW=OFF), only libc++abi's
copy is reachable and the catch works. A deeper linker-side fix
(un-exporting the embedded _ZTISt9exception so the references collapse)
is left for #9392.

Fix: catch the runtime_error layer of the chain explicitly, ahead of
the broader std::exception arm. That layer still has typeinfo identity
across the bridge boundary (proven by the catch probe). The
std::exception arm is kept for non-runtime_error subclasses on other
platforms; the catch(...) arm is the last-resort fallback.

This is type-safe defensive code, not a catch-all -- e.what() is
preserved in the messages on the typed arms.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jpfeuffer added 2 commits May 21, 2026 17:49
…ings for shared library compatibility

fix(BrukerTimsFile): remove redundant runtime_error catch to resolve typeinfo duplication issue on macOS

fix(ThermoRawFile): update polarity and activation type handling for improved compatibility with Thermo data
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Hi @poshul . can you take a look at #9389 if this is now fine from a license perspective.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @doc/doxygen/install/common-cmake-parameters.doxygen at line 149, Update the
platform support sentence that currently reads "Disabled automatically on
Linux/aarch64 and macOS/arm64 targets" to remove macOS/arm64 so it only states
"Disabled automatically on Linux/aarch64 targets" and, if desired, append a
short parenthetical noting that macOS/arm64 support was added in bridge v0.2.0;
edit the single-line text in the document block containing that sentence to
reflect this change.

Copilot AI commented May 22, 2026

Copy link
Copy Markdown
Contributor

@copilot Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

...

Updated as requested in commit 7e6d357: the sentence now states it is disabled automatically only on Linux/aarch64 targets. No other still-valid finding was present in that comment thread.

Comment on lines +639 to +672
# Download and install the Thermo Fisher RawFileReader license.
# OPENMS_THERMO_BRIDGE_THERMO_COMMIT is a CMake cache variable set inside
# the bridge's CMakeLists.txt and is visible here after FetchContent_MakeAvailable.
# We pin the download to that exact commit so we always get the license that
# corresponds to the vendored DLL packages being used.
if(OPENMS_THERMO_BRIDGE_THERMO_COMMIT)
set(_openms_thermo_license_url
"https://raw.githubusercontent.com/thermofisherlsms/RawFileReader/${OPENMS_THERMO_BRIDGE_THERMO_COMMIT}/License.doc")
set(_openms_thermo_license_file
"${CMAKE_CURRENT_BINARY_DIR}/ThermoRawFileReader-License.doc")
if(NOT EXISTS "${_openms_thermo_license_file}")
message(STATUS "openms-thermo-bridge: downloading Thermo RawFileReader license")
file(DOWNLOAD
"${_openms_thermo_license_url}"
"${_openms_thermo_license_file}"
STATUS _openms_thermo_license_status
TLS_VERIFY ON)
list(GET _openms_thermo_license_status 0 _openms_thermo_license_code)
list(GET _openms_thermo_license_status 1 _openms_thermo_license_message)
if(NOT _openms_thermo_license_code EQUAL 0)
file(REMOVE "${_openms_thermo_license_file}")
message(WARNING
"openms-thermo-bridge: failed to download Thermo RawFileReader license "
"(${_openms_thermo_license_message}). "
"The install will not include the license file.")
endif()
endif()
if(EXISTS "${_openms_thermo_license_file}")
install(FILES "${_openms_thermo_license_file}"
DESTINATION "${INSTALL_SHARE_DIR}/LICENSES"
RENAME "ThermoRawFileReader-License.doc")
endif()
endif()
endif()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@poshul thanks! I updated the doc.
Here is how we integrate / install the license doc

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.

We can also copy it into the repository if you want btw

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.

It is just that since it is an optional component for now, I thought download might be fine.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks good to me as long as it is an optional component.

@poshul
poshul merged commit df8d2be into develop May 23, 2026
13 of 15 checks passed
@poshul
poshul deleted the claude/debug-ci-pr-9235-bnkIo branch May 23, 2026 09:16
timosachsenberg pushed a commit that referenced this pull request May 24, 2026
timosachsenberg pushed a commit that referenced this pull request May 25, 2026
…try (#9403)

- Correct WITH_OPENTIMS default from 'off' to 'on' — CMakeLists.txt
  has always set this option to ON since the opentims integration was
  merged (commit 41ce6cf); the docs added in #9283 mistakenly wrote
  'default off'.

- Add WITH_THERMO_RAW / ENABLE_THERMO_RAW_TESTS to the Optional
  dependencies paragraph, mirroring the entry already present in
  doc/doxygen/install/common-cmake-parameters.doxygen.  The feature was
  introduced in #9389 and defaults ON on all supported platforms (Linux
  aarch64 is the only exception).

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request May 26, 2026
…inux/aarch64) (#9406)

CMakeLists.txt sets _openms_with_thermo_raw_default to ON and only
overrides it to OFF for Linux aarch64 (where Thermo's RawFileReader
lacks native dependencies). The CHANGELOG entry added in #9389
incorrectly stated 'OFF by default'. AGENTS.md already contains the
correct description ('default on except on Linux/aarch64') as fixed
in #9403.

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot mentioned this pull request May 28, 2026
timosachsenberg added a commit that referenced this pull request May 30, 2026
* [FEATURE] Add Thermo RAW input support to seven TOPP tools

Build on the in-process ThermoRawFile reader (PR #9389) to accept .raw
input directly in tools that previously gained Bruker .d support:

- SimpleSearchEngine, ProSE, ProteomicsLFQ: add FileTypes::RAW to the
  FileHandler::loadExperiment allowed_types — .raw routes through the
  existing mzML processing path (no IM-specific code needed).
- CometAdapter, SageAdapter: load .raw via FileHandler, write temp mzML
  for the external search engine. CometAdapter skips native-ID rewriting
  (Thermo scan=N is monotonic, unlike Bruker frame=F scan=S).
  SageAdapter preserves original .raw paths in PrimaryMSRunPath.
- FileConverter: add RawToMzML:reader=external|inprocess parameter.
  Inprocess path falls through to the generic output writer, allowing
  conversion to any supported format (not just mzML) and enabling
  side-by-side comparison with the external ThermoRawFileParser.
- OpenSwathWorkflow: new SwathFile::loadFromMSExperiment() builds
  SwathMaps directly from a pre-loaded MSExperiment, avoiding a temp
  mzML round-trip. Dispatched from OpenSwathBase for .raw input.

Format guards harmonised across tools: WITH_OPENTIMS around "d" and
WITH_THERMO_RAW around "raw" in setValidFormats_ everywhere
(previously inconsistent — only CometAdapter guarded "d").

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

* fix(SageAdapter): defer .raw path restoration until after post-processing

The early restoration of PrimaryMSRunPath (temp mzML → original .raw)
ran before the native-ID repair and FAIMS annotation blocks. Those
blocks compare File::basename(idxToFile[...]) against keys in
file2specnr2nativeid, which are temp mzML basenames built from
input_files. With the original .raw basenames in idxToFile, lookups
silently failed and neither repair nor FAIMS annotation ran for .raw
inputs.

Keep temp mzML paths in PrimaryMSRunPath throughout post-processing
so basename lookups succeed, then translate back to original .raw paths
just before storeIdentifications. Also change the filenames fallback
to use input_files instead of getStringList_("in") — equivalent for
mzML/.d inputs, correct for .raw.

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
timosachsenberg pushed a commit that referenced this pull request May 31, 2026
…tools (#9418) (#9421)

Add per-tool changelog entries for PR #9418 which extends direct .raw
file input (via the in-process ThermoRawFile reader introduced in #9389)
to seven TOPP tools:

- CometAdapter: in-process load + temp mzML; no native-ID rewriting needed
- ProSE: direct .raw accepted for all search modes
- SimpleSearchEngine: .raw via FileHandler::loadExperiment
- ProteomicsLFQ: .raw alongside .mzML and .d
- FileConverter: new RawToMzML:reader=external|inprocess parameter
- SageAdapter: in-process load + temp mzML; original paths in PrimaryMSRunPath
- OpenSwathWorkflow: new SwathFile::loadFromMSExperiment() avoids temp mzML round-trip

All entries note the WITH_THERMO_RAW=ON requirement.

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Jun 3, 2026
…r path works

PR #9389 added an early-return in FileHandler::getType() that mapped .raw to
FileTypes::UNKNOWN whenever WITH_THERMO_RAW was OFF (the default on Linux
aarch64). This was meant to disable only the in-process ThermoRawFile reader,
but it also broke file-type recognition that the *external* ThermoRawFileParser
(mono) conversion path in FileConverter depends on. As a result the nightly
arm64 container deploy failed:

  TOPP_THERMORAWFILEPARSER_1 / _1_out
  Warning: Could not determine format of input file '...ginkgotoxin-ms-switching.raw'!
  Error: Could not determine input file type!

FileConverter only enters its RAW branch when in_type == FileTypes::RAW, and the
external path (mono + ThermoRawFileParser, src/topp/FileConverter.cpp) is
available on all platforms regardless of WITH_THERMO_RAW. Forcing the type to
UNKNOWN made that branch unreachable.

Remove the guard so .raw is always recognized (restoring pre-#9389 behavior).
The in-process reader stays correctly #ifdef WITH_THERMO_RAW guarded in both
getType's loadExperiment switch and FileConverter; callers that try to load a
.raw in-process without WITH_THERMO_RAW still get a clear "type is not supported
for loading experiments" ParseError from loadExperiment's default case.

Co-Authored-By: Claude <[email protected]>

https://claude.ai/code/session_01CF34vdU7vbT8rHJ74XnN5z
timosachsenberg added a commit that referenced this pull request Jun 3, 2026
…ld/deploy works (#9441)

* fix(docker): install .NET 8 for openms-thermo-bridge so container build/deploy works

PR #9389 enabled WITH_THERMO_RAW=ON by default (amd64), which FetchContent-builds
openms-thermo-bridge. The bridge's CMake hard-requires the .NET SDK at configure
time (find_package(DotNetHost) needs nethost from the SDK host pack, plus
`dotnet publish` of the managed Thermo wrapper). The Docker base image had no .NET,
so cmake configure failed and the nightly container deploy (Docker + Singularity)
has been broken since 2026-05-24.

- base (build) stage: install the official .NET 8 SDK via Microsoft's
  dotnet-install.sh into /usr/share/dotnet (the layout FindDotNetHost.cmake
  expects; Ubuntu's dotnet-sdk-8.0 uses /usr/lib/dotnet and lacks the host pack).
- library (runtime) stage: install the .NET 8 runtime so the bridge can host the
  managed RawFileReader at runtime; managed assemblies are already shipped under
  ${INSTALL_DIR}/lib/openms_thermo_bridge/managed.
- add libicu74 (required by .NET) and set DOTNET_ROOT in both stages.
- guarded to amd64: WITH_THERMO_RAW defaults OFF on linux/aarch64, so the arm64
  image is unchanged.

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

* fix(thermo): recognize .raw without WITH_THERMO_RAW so external parser path works

PR #9389 added an early-return in FileHandler::getType() that mapped .raw to
FileTypes::UNKNOWN whenever WITH_THERMO_RAW was OFF (the default on Linux
aarch64). This was meant to disable only the in-process ThermoRawFile reader,
but it also broke file-type recognition that the *external* ThermoRawFileParser
(mono) conversion path in FileConverter depends on. As a result the nightly
arm64 container deploy failed:

  TOPP_THERMORAWFILEPARSER_1 / _1_out
  Warning: Could not determine format of input file '...ginkgotoxin-ms-switching.raw'!
  Error: Could not determine input file type!

FileConverter only enters its RAW branch when in_type == FileTypes::RAW, and the
external path (mono + ThermoRawFileParser, src/topp/FileConverter.cpp) is
available on all platforms regardless of WITH_THERMO_RAW. Forcing the type to
UNKNOWN made that branch unreachable.

Remove the guard so .raw is always recognized (restoring pre-#9389 behavior).
The in-process reader stays correctly #ifdef WITH_THERMO_RAW guarded in both
getType's loadExperiment switch and FileConverter; callers that try to load a
.raw in-process without WITH_THERMO_RAW still get a clear "type is not supported
for loading experiments" ParseError from loadExperiment's default case.

Co-Authored-By: Claude <[email protected]>

https://claude.ai/code/session_01CF34vdU7vbT8rHJ74XnN5z

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[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.

5 participants