Skip to content

Add Thermo RAW input support to seven TOPP tools - #9418

Merged
timosachsenberg merged 2 commits into
developfrom
feature/thermo-raw-tool-support
May 30, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
feature/thermo-raw-tool-support

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Builds on #9389 (in-process ThermoRawFile reader) to accept .raw input directly in seven TOPP tools. Each tool is wired in the way that fits its existing .d path — no temp-mzML round-trip where it can be avoided.

Tool Approach
SimpleSearchEngine, ProSE, ProteomicsLFQ Add FileTypes::RAW to FileHandler::loadExperiment allowed_types — .raw routes through the existing mzML path; no IM-specific code needed
CometAdapter Load via FileHandler → temp mzML → Comet. No native-ID rewriting needed (Thermo scan=N is monotonic, unlike Bruker frame=F scan=S)
SageAdapter Pre-convert .raw → temp mzML → external Sage; restore original .raw paths in PrimaryMSRunPath
FileConverter New RawToMzML:reader=external|inprocess parameter. inprocess falls through to the generic output writer (any output format, not just mzML), enabling side-by-side comparison with the external ThermoRawFileParser
OpenSwathWorkflow New SwathFile::loadFromMSExperiment() builds SwathMaps directly from a pre-loaded MSExperiment — avoids the disk round-trip the temp-mzML approach would impose. Dispatched from OpenSwathBase for .raw input

Notes

  • Format guards harmonised across tools: #ifdef WITH_OPENTIMS around "d", #ifdef WITH_THERMO_RAW around "raw" in every setValidFormats_. Previously only CometAdapter guarded "d".
  • FileTypes::RAW is always defined as an enum, so allowed_types vectors don't need ifdefs — FileHandler::loadExperiment gates dispatch internally.
  • PeakPickerIM was deliberately not modified — it requires ion-mobility data, which Thermo .raw does not carry.

Test plan

  • Build with WITH_THERMO_RAW=ON and run each tool against a Thermo .raw test file (e.g. Angiotensin_AllScans.raw)
  • Build with WITH_THERMO_RAW=OFF and verify clean compilation + that --help does not list raw as a valid input format
  • CometAdapter: verify PSM spectrum_reference values in output use the original scan=N form (no rewriting corruption)
  • SageAdapter: verify PrimaryMSRunPath in the output references the original .raw path, not the temp mzML
  • FileConverter: compare RawToMzML:reader=external vs RawToMzML:reader=inprocess mzML outputs for feature parity
  • OpenSwathWorkflow: run on a Thermo DIA .raw and verify SWATH window discovery matches a mzML-converted control

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added Thermo RAW support across multiple tools and adapters (ProSE, SimpleSearchEngine, OpenSwathWorkflow, ProteomicsLFQ, Comet, Sage)
    • FileConverter: choose RAW→mzML conversion mode (external or in-process)
    • SWATH workflows can ingest already-loaded in-memory experiments for direct processing
    • Adapters preserve original RAW file identities when converting to temporary mzML for downstream steps

Review Change Stack

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]>
@coderabbitai

coderabbitai Bot commented May 30, 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: 1493940c-2a3f-4f8e-81e1-45703f10d38f

📥 Commits

Reviewing files that changed from the base of the PR and between 8ee1313 and 16735b3.

📒 Files selected for processing (1)
  • src/topp/SageAdapter.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/topp/SageAdapter.cpp

📝 Walkthrough

Walkthrough

Adds SwathFile::loadFromMSExperiment to build SWATH maps from an in-memory PeakMap and wires conditional Thermo RAW support into SWATH loading, search algorithms, and TOPP tools with per-tool RAW→mzML preprocessing and format-registration fixes.

Changes

Thermo RAW Loading and Format Support

Layer / File(s) Summary
SWATH core: load from in-memory PeakMap
src/openms/include/OpenMS/FORMAT/SwathFile.h, src/openms/source/FORMAT/SwathFile.cpp, src/openms/source/APPLICATIONS/OpenSwathBase.cpp
New SwathFile::loadFromMSExperiment builds SWATH maps from a pre-loaded PeakMap (selects consumer by readoptions, streams spectra) and is integrated into OpenSwathBase RAW loading paths.
ID/search algorithms enable RAW input
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp, src/openms/source/ANALYSIS/ID/SimpleSearchEngineAlgorithm.cpp
ProSEAlgorithm (three load sites) and SimpleSearchEngineAlgorithm now pass FileTypes::RAW to loadExperiment() so RAW spectra are loaded.
TOPP tools: conditional format registration
src/topp/CometAdapter.cpp, src/topp/ProSE.cpp, src/topp/ProteomicsLFQ.cpp, src/topp/OpenSwathWorkflow.cpp, src/topp/SimpleSearchEngine.cpp, src/topp/SageAdapter.cpp
Replace hardcoded in format strings with conditional initializer lists and fix preprocessor guards to advertise d and raw only when respective feature flags are enabled.
FileConverter: RawToMzML reader selection
src/topp/FileConverter.cpp
Add -RawToMzML:reader option (external default, inprocess when built with Thermo support) and branch conversion to either external parser or in-process FileHandler loading (with warnings).
CometAdapter RAW preprocessing
src/topp/CometAdapter.cpp
Detect RAW inputs, load requested MS level in-process, write temporary indexed mzML (clearing peaks but preserving metadata), then continue existing mzML/OpenTIMS flow.
ProteomicsLFQ preprocessing RAW support
src/topp/ProteomicsLFQ.cpp
Fix format registration guards and allow centroid/precursor-correction preprocessing to load RAW alongside mzML (FileHandler().loadExperiment({MZML, RAW})).
SageAdapter RAW conversion and metadata restore
src/topp/SageAdapter.cpp
Convert RAW inputs to temp mzMLs (record mapping), run Sage, then restore ProteinIdentification primary run paths to original RAW filenames via reverse-mapping.

Possibly Related PRs

  • OpenMS/OpenMS#9389: Core Thermo RAW reader and FileHandler/FileTypes RAW support used by this PR.

Suggested Reviewers

  • jpfeuffer
  • cbielow

"🐰
I hop through peaks and spectra bright,
From RAW to maps in clear moonlight.
Temp mzMLs and guarded flags in play,
I stitch formats so workflows may.
Hooray for pipelines running right!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% 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 clearly and accurately summarizes the main change: adding Thermo RAW input support to seven TOPP tools, which aligns with the extensive modifications across multiple tool files.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/thermo-raw-tool-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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/topp/SageAdapter.cpp`:
- Around line 582-595: The code currently replaces Thermo RAW inputs with temp
mzML files and stores a map sage_tmp_basename_to_original, but later code (the
block that sets PrimaryMSRunPath back to the original .raw paths) runs before
the mzML-based post-search native-ID/FAIMS metadata repair and breaks lookups
that expect temp mzML basenames; fix by deferring restoration of
PrimaryMSRunPath until after all mzML post-processing finishes
(post-search/repair stage), or alternatively keep the temp-mzML→original mapping
and update the lookup logic used in the native-ID/FAIMS repair to consult
sage_tmp_basename_to_original (or use input_files’ temp basenames) so the repair
routines use the temp mzML basenames for lookups while still allowing final
output paths to be set back to the original raw names.
🪄 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: ee29a626-7164-419a-b92f-afb09e55c73f

📥 Commits

Reviewing files that changed from the base of the PR and between 9bd73fd and 8ee1313.

📒 Files selected for processing (12)
  • src/openms/include/OpenMS/FORMAT/SwathFile.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/openms/source/ANALYSIS/ID/SimpleSearchEngineAlgorithm.cpp
  • src/openms/source/APPLICATIONS/OpenSwathBase.cpp
  • src/openms/source/FORMAT/SwathFile.cpp
  • src/topp/CometAdapter.cpp
  • src/topp/FileConverter.cpp
  • src/topp/OpenSwathWorkflow.cpp
  • src/topp/ProSE.cpp
  • src/topp/ProteomicsLFQ.cpp
  • src/topp/SageAdapter.cpp
  • src/topp/SimpleSearchEngine.cpp

Comment thread src/topp/SageAdapter.cpp Resolved
@timosachsenberg
timosachsenberg requested a review from jpfeuffer May 30, 2026 10:23
…sing

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]>
@timosachsenberg
timosachsenberg enabled auto-merge (squash) May 30, 2026 10:38
@timosachsenberg
timosachsenberg disabled auto-merge May 30, 2026 12:30
@timosachsenberg
timosachsenberg merged commit d8f993d into develop May 30, 2026
40 checks passed
@timosachsenberg
timosachsenberg deleted the feature/thermo-raw-tool-support branch May 30, 2026 12:30
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 added a commit that referenced this pull request Sep 27, 2026
…and macOS (#10274)

* [FIX] FileConverter: read Thermo .raw in-process by default

'FileConverter -in x.raw -out x.mzML' failed with exit code 14 in the
3.6.0 packages. RawToMzML:reader defaulted to 'external', which needs
ThermoRawFileParser.exe on the PATH and, on Linux and macOS, mono. The
packages provide neither: the DEB installs the .exe under
share/OpenMS/THIRDPARTY and does not depend on mono. Yet every
WITH_THERMO_RAW build contains the in-process reader, and that is now
the default on all platforms. The 'external' default dates from #9418,
when WITH_THERMO_RAW was still OFF by default, and nobody revisited it
when #10206 switched it on everywhere.

Builds with the in-process reader now default to it. 'external' stays
available, and stays the default without WITH_THERMO_RAW.

ThermoRawFile keeps profile scans by default, while ThermoRawFileParser
applies vendor peak picking unless --noPeakPicking is given. Switching
only the default would silently turn FileConverter's centroided output
into profile data (ginkgotoxin-ms-switching.raw: 174162 instead of
11813 peaks). So the in-process path now honours
-RawToMzML:no_peak_picking and -RawToMzML:include_noise through
ThermoRawFile::Options, which #10077 added after the reader option.
Only -RawToMzML:no_zlib_compression still warns that it is ignored.
FileHandler cannot pass these options, so FileConverter calls
ThermoRawFile directly, as it already does for BrukerTimsFile, and
records the source directory as the file URI that FileHandler wrote.
With -RawToMzML:no_peak_picking the output equals the previous
'-RawToMzML:reader inprocess' output apart from the recorded
parameters.

The in-process reader needs a .NET 8 runtime, which the Windows
installer does not bundle. There, the old default ran the bundled
ThermoRawFileParser on the built-in .NET Framework. Windows users now
need .NET 8 or '-RawToMzML:reader external'. So do pipelines that set
-RawToMzML:ThermoRaw_executable. The CHANGELOG entry says so.

Tests: TOPP_FileConverter_RAW_default_reader pins the default in the
written INI. TOPP_FileConverter_RAW_1 converts the Thermo fixture with
the default reader and checks that every spectrum is centroided; it
runs where THERMO_RAW_TEST_DATA is available.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

* FileConverter: say how to get the external Thermo reader back

CodeRabbit's review of this PR notes that a machine without .NET 8 now
fails with the default reader and gets no hint about the fix. Without
the runtime, the in-process reader reports only "get_hostfxr_path
failed: .NET runtime not found in standard locations. Set DOTNET_ROOT
...". It mentions neither .NET 8 nor -RawToMzML:reader external.

When the in-process reader fails to read a file, FileConverter now
first logs that the reader needs the .NET 8 runtime, and that if the
runtime is missing, the user can install it or pass
'-RawToMzML:reader external'. The error and exit code are unchanged. It
does not fall back on its own, because the two readers do not write
identical mzML.

Checked with a FileConverter built from this branch against the nightly
libraries. ginkgotoxin-ms-switching.raw still converts with .NET 8 (32
spectra). With /usr/lib/dotnet hidden, the hint is printed before the
error and the exit code stays 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

* FileConverter: warn when an external-reader executable is set in-process

With the in-process default, a pipeline that still sets
-RawToMzML:ThermoRaw_executable or -RawToMzML:NET_executable switches
readers without a word, and the two readers write different mzML.
FileConverter now warns for either option when it differs from its
default, as it already does for -RawToMzML:no_zlib_compression.

The check reads the raw parameter values: getStringOption_() looks
executables up on the PATH and throws when they are missing, which would
break the in-process conversion that needs neither. The
ThermoRawFileParser default is named once, for the option and the check.

The TOPP CMakeLists now says that the Thermo fixture tests only run with
-DENABLE_THERMO_RAW_TESTS=ON, which is off by default and in the CI
presets. Both come from the review of #10274.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

* FileConverter: keep the external Thermo reader as the Windows default

The in-process reader needs a .NET 8 runtime, which the Windows
installer does not bundle. The external reader works there as
installed: the installer puts THIRDPARTY\ThermoRawFileParser on the
PATH, and ThermoRawFileParser.exe runs on the .NET Framework that
Windows includes. On Linux and macOS the packages provide neither mono
nor ThermoRawFileParser on the PATH, so the in-process reader stays the
default there.

TOPP_FileConverter_RAW_default_reader expects 'external' on Windows.
TOPP_FileConverter_RAW_1 selects the in-process reader explicitly,
since it checks that reader's vendor peak picking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

* [DOC] CHANGELOG: the in-process Thermo reader needs DOTNET_ROOT for a non-standard .NET

nethost looks for the runtime only through DOTNET_ROOT and the global
install location. On a hosted macOS runner, whose .NET is in ~/.dotnet,
the in-process reader of the 2026-09-24 package failed with
"get_hostfxr_path failed: .NET runtime not found in standard locations"
although .NET 8, 9 and 10 were installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

---------

Co-authored-by: Claude <[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