Skip to content

[FEATURE] DIAuditor: DIA quality metrics per run and isolation window - #10271

Merged
timosachsenberg merged 11 commits into
developfrom
claude/charming-cannon-b0v55v
Sep 28, 2026
Merged

timosachsenberg merged 11 commits into
developfrom
claude/charming-cannon-b0v55v

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds a new TOPP tool, DIAuditor. It re-implements DIAuditor by David L. Tabb on top of the OpenMS readers, and credits him as co-author in the file headers. The tool reports how a DIA run was acquired:

  • the MS1 sampling
  • the isolation-window layout, including FAIMS voltages and diaPASEF ion mobility ranges
  • how often each window was measured, and its cycle time
  • how the total ion current (TIC) and peak counts are distributed over the run and over the windows

Layout. The code follows the tool-local convention of #10239:

  • src/topp/DIAuditor/DIAuditor.cpp: the TOPP main
  • include/DIAQCMetrics.h and source/DIAQCMetrics.cpp: the metrics
  • test/DIAQCMetrics_test.cpp: the class test

The metrics class keeps only a small record per spectrum. The mzQC JSON is written in the tool-local source, with nlohmann_json linked the same way as in OpenNuXL.

Inputs and outputs

  • -in: one or more files, one per run:
    • mzML is streamed with MzMLFile::transform, so file size does not matter.
    • Thermo .raw (WITH_THERMO_RAW) and Bruker timsTOF .d directories or .d.zip archives (WITH_OPENTIMS) are read with the OpenMS vendor readers through FileHandler::loadExperiment. These readers load a whole run into memory.
    • For diaPASEF, the timsTOF reader splits each MS2 frame into its isolation windows and annotates their ion mobility ranges.
    • For Thermo, the FAIMS voltage, TIC, isolation windows, instrument, serial number and start time come from the reader.
    • Values a reader does not provide are NA: the mass resolving power for .raw and .d, and the instrument and start time for .d.
  • -out: one row per run. The columns are DIAuditor's byRun table, followed by run-level MS2 statistics.
  • -out_windows: one row per isolation window. The columns are DIAuditor's byIsolationWindow table, followed by the ion mobility range and the isolation target.
  • -out_mzqc: mzQC 1.0 with one runQuality per run.
    • It uses only PSI-MS QC terms with their units: MS:4000059–62, 4000067, 4000069/70 and 4000190–4000199. The DIA terms 4000190–4000199 are available since Update psi-ms.obo to version 4.2.2 #8691.
    • MS:4000069 'm/z acquisition range' is the range of the recorded precursor m/z values, as the CV defines it. The run table's MZRangeMin/MZRangeMax keeps DIAuditor's meaning: the m/z range the windows cover.
    • The DIA window metrics (MS:4000193–4000199) are written only for runs that have isolation windows.
    • The input file's format is mzML, Thermo RAW (MS:1000563) or Bruker TDF (MS:1002817). A .d directory gets no SHA-1.
    • Per-window values are not in the mzQC, because PSI-MS has no table term for DIA isolation windows.
    • The output passes the pymzqc syntax check (schema, date-time and uri formats) and its semantic check.
  • -tic, -peak_count, -ion_mobility: each has a setting that reproduces how the original reads the data.

Windows. A window is keyed on the following values, matched within 1e-6 as in OpenSWATH:

  • the isolation window of the first precursor (target and offsets)
  • the FAIMS compensation voltage
  • the ion mobility range of diaPASEF frames (ion mobility lower/upper limit)

MS2 spectra without an isolation window are not a DIA window. They form one extra row in the window table, without m/z values, and are left out of the window count and the window metrics.

The tool warns when:

  • MS2 spectra are single ion mobility scans (an ion mobility of their own, but no frame range and no ion mobility array)
  • MS2 spectra are multiplexed (more than one precursor)
  • spectra have no retention time
  • no MS2 spectrum has an isolation window, or some MS2 spectra of a DIA run have none
  • most windows are measured only once, i.e. the run may not be DIA

Differences to the original DIAuditor. Where the original reads the data correctly, the numbers match. This was checked on synthetic mzML inputs: on a 170 MB file modelled on msconvert output all 32 run columns agree, and on a staggered-window file all 40 windows agree. It was also checked on the two real vendor runs below, converted to mzML: all windows and all numbers agree once the original's time-unit bug is corrected. See the validation comment.

The port fixes these bugs of the original:

  • Scan times written in seconds are treated as minutes, so time metrics are 60× too large.
  • An MS1 scan's FAIMS voltage overwrites the previous MS2 scan's, which moves scans between windows.
  • It crashes on runs or windows with two or fewer scans.
  • It does not separate diaPASEF windows by ion mobility.

The following differences are deliberate and documented on the tool page:

  • Medians of times are true medians. MS1Resolution and a window's resolving power are medians over its spectra.
  • Window values are matched within 1e-6, not exactly.
  • Only MS2 spectra with an isolation window form windows. The original also puts MS3 and higher spectra into windows, and puts spectra without an isolation window into a window at m/z 0.
  • Undefined values are written as NA instead of 0.
  • Vendor files can be read directly. The original reads only mzML.

Peak-count quartiles are taken as in DIAuditor, at positions n/4, n/2 and n/4 + n/2, so they stay observed integers as the CV requires.

mzML reader fix (libOpenMS). A read that stops early ended parsing without ending the progress it had started. This covers metadata-only reads and spectrum counting, as in the first pass of MzMLFile::transform(). ProgressLogger's nesting depth is static, so the progress output of every later file was indented one level deeper. MzMLHandler now ends that progress before it stops. A new MzMLFile_test section checks that two consecutive transforms nest alike, for both first-pass variants. It fails on the unpatched reader.

mzML writer fix (libOpenMS). MzMLHandler wrote a <precursor> and a <product> for every chromatogram:

  • A TIC got an empty precursor (only the 'dissociation method' parent term) and a product isolation window at m/z 0.
  • OpenSWATH's MS1 chromatograms got such a product.

Both elements are optional in mzML. The original DIAuditor read that product's target m/z 0 as the last MS2 spectrum's, and so crashed on mzML written by OpenMS. The elements are now written only when set. Reading is unchanged, because a missing element loads as an empty one.

  • Reference files: those of the 33 affected TOPP tests lose only these empty elements. Their index offsets are shifted by the bytes removed.
  • Other mzML tests: the other 99 TOPP tests that compare mzML give the same results and outputs with and without the change.
  • New test: a new MzMLFile_test section checks which chromatograms get the elements and validates the stored file against the schema. It fails on the old writer.

Tests

  • DIAQCMetrics_test: 250 checks.
  • MzMLFile_test: the new progress-nesting and chromatogram precursor/product sections.
  • TOPP_DIAuditor_1 and TOPP_DIAuditor_2: a new synthetic FAIMS DIA input of 88 KB, plus the existing OpenSwathWorkflow_1_input.mzML.
  • TOPP_DIAuditor_raw and TOPP_DIAuditor_d run on real vendor files when their optional fixtures are configured (THERMO_FAIMS_DIA_TEST_DATA, OPENTIMS_DIA_TEST_DATA). These are the public FAIMS-DIA run of PXD029902 and the diaPASEF HeLa run that OpenMS already uses as optional test data.

All of these pass locally. They were built against the 2026-09-24 nightly SDK, whose headers match develop except for config.h.in, and run with develop's share/ directory. The reader and writer fixes were tested by preloading the patched MzMLHandler into that SDK.

On both vendor files, DIAuditor's results are identical to those for the same data converted to mzML with FileConverter: all 41 run columns and all windows match (75 FAIMS-DIA windows at −5 V; 24 diaPASEF windows). The mzQC files pass pymzqc. Details are in the validation comment.

input time peak memory
308 MB FAIMS-DIA .raw 27 s 0.8 GB
same run as mzML 11 s 77 MB
345 MB diaPASEF .d.zip 38 s 3.3 GB
same run as mzML 8 s 0.2 GB

The changed sources compile warning-free with OpenMS's gcc (with -Werror) and clang warning flags, with and without the vendor readers.

Open points

  • Tool name: "DIAuditor" should be confirmed with David Tabb. Renaming is a small change.
  • Original DIAuditor behaviour: whether the seconds-as-minutes unit check and the stop on windows measured once or twice are intentional was asked here.
  • CV issues to report upstream (drafts are in the comments below for review):
    • MS:4000189 is still named "DIAMetric".
    • MS:4000194 and MS:4000196 share the same name.
    • There is no DIA isolation window table term.
  • Chromatograms are still decoded. PeakFileOptions::setSkipChromatograms(true) would avoid that, but MzMLHandler then also skips the spectra's metadata: every spectrum reads as MS1 without RT. That is a separate reader bug and is not part of this PR.
  • Vendor reader gaps: the Thermo reader keeps the scan trailers, including "FT Resolution", but does not set a mass resolving power as msconvert does. The timsTOF reader does not read the instrument, serial number or acquisition time from the .d metadata. Both would be small reader changes, separate from this PR.
  • Untested inputs: SCIEX (mzML via MS Data Converter), Waters MSE/SONAR, TIMSCONVERT output.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes (tested against the nightly SDK; see above)
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.) (none needed: the class is tool-local)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

🤖 Generated with Claude Code

https://claude.ai/code/session_01RHVqy5Nqy6QYfGG8AoxnNj

Summary by CodeRabbit

  • New Features

    • Added DIAuditor to assess data-independent acquisition (DIA) quality per run and isolation window.
    • Export quality metrics as run-level and isolation-window tables or as an mzQC report with standardized DIA metrics.
    • Choose how total ion current is sourced, how peaks are counted, and how ion mobility is used to group isolation windows.
    • Isolation-window tables include a separate summary for spectra without isolation windows, and mzQC reports include precursor m/z acquisition ranges.
    • DIAuditor is now listed among the available quality control tools.
  • Bug Fixes

    • Partial mzML reads now finish their progress output.

New TOPP tool re-implementing DIAuditor by David L. Tabb
(https://github.com/dtabb73/DIAuditor) on top of the OpenMS mzML reader.
The metrics live next to the tool (src/topp/DIAuditor, DIAQCMetrics) and
each input is streamed: only a small record per spectrum is kept.

Outputs: DIAuditor's per-run and per-window tables (same columns, plus
run-level MS2 statistics and the ion mobility range of each window) and an
mzQC file with one runQuality per run. The mzQC uses only PSI-MS QC terms
(MS:4000190-4000199 and others) with their units; per-window values stay in
the table, as the vocabulary has no term for them. It passes the pymzqc
syntax check (mzQC 1.0 schema incl. date-time/uri formats) and semantic
check.

Windows are keyed by the isolation window of the first precursor, the FAIMS
compensation voltage and the ion mobility range of diaPASEF frames; the ion
mobility of a single TIMS scan is not a window setting. The tool warns about
single ion mobility scans, multiplexed precursors, spectra without retention
time and runs that do not look like DIA.

Differences to the original: scan times in seconds are converted, a FAIMS
voltage is attributed to its own spectrum, only MS2 spectra form windows,
missing TIC values fall back to the sum of intensities (option -tic), runs
and windows with few spectra report NA instead of crashing, medians of
times are true medians. Options -tic file, -peak_count all and
-ion_mobility faims reproduce DIAuditor's data access.

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

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@dtabb73: while porting DIAuditor to OpenMS we found four issues with the PSI-MS terms for DIA QC. Below are drafts for HUPO-PSI/psi-ms-CV issues. Could you review them before we file them? Corrections to names, definitions or proposed columns are welcome.

  • Issue 2 renames MS:4000189 to DIAuditor. It is best filed or endorsed by you.
  • Issue 4 supplies terms that the table in issue 3 needs.

All term texts quoted below were checked against the current psi-ms-core.obo (data-version 4.2.2).

Issue 1: MS:4000196 has the same name as MS:4000194 ("DIA isolation window count"). Template: blank issue

MS:4000194 and MS:4000196 have the same name, "DIA isolation window count", but different meanings and value shapes:

MS:4000194 MS:4000196
name DIA isolation window count DIA isolation window count
meaning number of distinct DIA isolation windows minimum and maximum number of times any window is measured via MS/MS
value type single value (xsd:int) n-tuple (xsd:int)

mzQC files that report both terms contain two metrics with the same name in one runQuality. DIAuditor (https://github.com/dtabb73/DIAuditor) and the OpenMS TOPP tool DIAuditor (#10271) both write such files. Anything that labels metrics by name, such as tables, plots or dashboards, cannot tell them apart. A writer cannot choose a clearer name either, because validators (e.g. pymzqc) check names against the CV.

Proposed change: rename MS:4000196 only, keeping its definition and relationships.

[Term]
id: MS:4000196
name: DIA isolation window measurement count range
def: "The minimum and maximum number of times any specific DIA isolation window is measured via MS/MS. In case all isolation windows are sampled the same number of times, this value is reported twice." [PSI:MS]

Alternative names: "DIA isolation window MS2 count range", "DIA isolation window sampling count".

Issue 2: Update MS:4000189 "DIAMetric": the software is now called DIAuditor. Template: blank issue

MS:4000189 names the software "DIAMetric" and points to https://github.com/dtabb73/DIAMetric. The author has since renamed it to DIAuditor (commits "Revised name from DIAMetric", 2026-04-17, and "Rename to DIAuditor", 2026-06-12). The repository is now https://github.com/dtabb73/DIAuditor.

DIAuditor's own mzQC output lists the analysis software as accession MS:4000189 with name "DIAuditor". That does not match the CV name, so mzQC validators report a name mismatch. An OpenMS re-implementation (TOPP tool DIAuditor, #10271) also refers to the tool by its new name.

Proposed change, keeping the old name as a synonym so existing files still resolve:

[Term]
id: MS:4000189
name: DIAuditor
def: "DIAuditor (formerly DIAMetric) is a Data-Independent Acquisition quality metric generator." [PSI:MS, https://github.com/dtabb73/DIAuditor]
synonym: "DIAMetric" EXACT []
subset: mzQC
is_a: MS:1001456 ! analysis software
Issue 3: New QC term: DIA isolation window metrics (table). Template: "New QC Term" form

What is the QC term's name? DIA isolation window metrics

Briefly describe the QC term.
A table with one row per DIA isolation window of a run.

MS:4000193 to MS:4000199 summarise the windows of a run as run-level values: window count, minimum/maximum widths, minimum/maximum number of measurements, minimum/maximum half-TIC retention time, minimum/maximum TIC, and minimum/maximum median peak count. The per-window values behind these summaries have no term.

Tools therefore either:

A per-window table would let QC tools compare windows within and across runs, e.g. to find windows with low signal, unevenly sampled windows, or differences between FAIMS voltages.

What is the QC term's unit? Leave empty; each column has its own unit (see below).

Value type: MS:4000005 ! table

Describe any additional information.
One row per distinct isolation window, as defined for MS:4000194: windows sharing the same low m/z boundary, high m/z boundary and ion mobility parameters.

Proposed columns:

column term unit
isolation window target m/z MS:1000827 MS:1000040 m/z
isolation window lower offset MS:1000828 MS:1000040 m/z
isolation window upper offset MS:1000829 MS:1000040 m/z
FAIMS compensation voltage (if used) MS:1001581 UO:0000218 volt
ion mobility lower / upper limit of the window (if used, e.g. diaPASEF) new terms, see issue 4 MS:1002814
number of MS2 spectra of the window MS:4000060, used per window, or a new column term UO:0000189 count unit
median time between consecutive measurements of the window MS:4000193 UO:0000010 second
summed TIC of the window's MS2 spectra MS:1000285 MS:1000043 intensity unit

Optional further columns would need per-window counterparts of existing run-level terms, e.g. the retention time at which half of the window's TIC is reached (cf. MS:4000197) and the median peak count (cf. MS:4000199).

Sketch:

[Term]
id: MS:40002xx
name: DIA isolation window metrics
def: "Metrics of each DIA isolation window of a run, one row per distinct isolation window (i.e. sharing the same low m/z boundary, high m/z boundary, and ion mobility parameters): isolation window target m/z and offsets, FAIMS compensation voltage, number of MS2 spectra, median time between consecutive measurements, and summed total ion current." [PSI:MS]
subset: mzQC
is_a: MS:4000005 ! table
relationship: has_column MS:1000827 ! isolation window target m/z
relationship: has_column MS:1000828 ! isolation window lower offset
relationship: has_column MS:1000829 ! isolation window upper offset
relationship: has_column MS:1001581 ! FAIMS compensation voltage
relationship: has_column MS:4000060 ! number of MS2 spectra
relationship: has_column MS:4000193 ! DIA isolation window median cycle time
relationship: has_column MS:1000285 ! total ion current
relationship: has_metric_category MS:4000009 ! ID free metric
relationship: has_metric_category MS:4000012 ! single run based metric
relationship: has_metric_category MS:4000022 ! MS2 metric
relationship: has_metric_category MS:1000792 ! isolation window attribute

Categories: ID-free, single run, MS2, isolation window attribute.

Reference implementations: DIAuditor (per-window output), and the OpenMS TOPP tool DIAuditor (#10271, per-window TSV).

Issue 4 (companion to 3): New terms: ion mobility range of an isolation window (e.g. diaPASEF). Template: "New Term Request"

In diaPASEF, an isolation window is defined by an m/z range and an ion mobility (1/K0) range. Several windows can share the same m/z range and differ only in their ion mobility range. PSI-MS has no term for the ion mobility range of an isolation window.

Existing practice uses userParams instead:

  • ProteoWizard writes spectrum-level userParams when it combines ion mobility scans into frames (SpectrumList_Bruker.cpp: "ion mobility lower limit" / "ion mobility upper limit", xsd:double, unit MS:1002814).
  • OpenMS's timsTOF reader stores the same names as meta values.

MS:4000194 defines distinct DIA windows by "the same low m/z boundary, high m/z boundary, and ion mobility parameters", but those ion mobility parameters have no terms. Tools therefore match userParam names, and a per-window table (issue 3) cannot name the columns.

Proposed terms, matching the names already in use:

[Term]
id: MS:100xxxx
name: isolation window ion mobility lower limit
def: "The lowest ion mobility value of the ions isolated in an isolation window, e.g. the lower inverse reduced ion mobility limit of a diaPASEF window." [PSI:MS]
is_a: MS:1000792 ! isolation window attribute
is_a: MS:1002892 ! ion mobility attribute
relationship: has_units MS:1002814 ! volt-second per square centimeter
relationship: has_units UO:0000028 ! millisecond
relationship: has_value_type xsd:double

[Term]
id: MS:100yyyy
name: isolation window ion mobility upper limit
def: "The highest ion mobility value of the ions isolated in an isolation window, e.g. the upper inverse reduced ion mobility limit of a diaPASEF window." [PSI:MS]
is_a: MS:1000792 ! isolation window attribute
is_a: MS:1002892 ! ion mobility attribute
relationship: has_units MS:1002814 ! volt-second per square centimeter
relationship: has_units UO:0000028 ! millisecond
relationship: has_value_type xsd:double

Alternatively, to mirror the m/z scheme (MS:1000827–1000829, which replaced the obsolete m/z limit terms MS:1000793/1000794), these could be defined as an ion mobility target plus lower and upper offsets. The limits above match what writers already produce.


Generated by Claude Code

…rtial reads

DIAuditor:
- A spectrum counts as a single ion mobility scan only if it has an ion mobility of
  its own but neither a frame ion mobility range nor an ion mobility array, so
  combined diaPASEF frames no longer trigger that warning.
- Values that define an isolation window are matched within 1e-6 (as in OpenSWATH)
  instead of by exact equality.
- mzQC file URIs are built from the UTF-8 form of the path (to_path(),
  generic_u8string()); a backslash is no longer turned into '/' on POSIX.
- The "measured only once" warning counts windows with a single MS2 spectrum.
- Peak count quartiles are taken as in DIAuditor (positions n/4, n/2, n/4 + n/2).
- The computed TIC is summed in double precision (MSSpectrum::calculateTIC() sums
  in float); this changes the computed TICs of the OpenSwath test input.
- The multiplexing and ion mobility scan counters include MS2 spectra without RT.
- Progress is reported while reading (MzMLFile::setLogType).
- The creation date uses DateTime's "Z" format, the class test passes an RFC 3339
  date, and the mzQC diff whitelists term names.
- GroupStatistics is no longer a template; comments explain why the PSI-MS terms
  come from getPSIMSCV() and its version from the header of psi-ms.obo.

MzMLHandler: a read that stops early (metadata only, or counting spectra, as the
first pass of MzMLFile::transform() does) ended parsing without ending the progress
it had started. ProgressLogger's nesting depth is static, so the progress output of
every later file was nested one level deeper. The handler now ends that progress
before it stops; MzMLFile_test checks that two consecutive transforms nest alike.

Chromatograms are still decoded: PeakFileOptions::setSkipChromatograms(true) makes
MzMLHandler skip the spectra's metadata too, so it is not used.

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

This comment was marked as resolved.

…dow; MS:4000069 from precursor m/z

MS2 spectra without an isolation window (no precursor, or no isolation window
offsets) formed windows of their own, so a run without any isolation
information reported MS:4000194 'DIA isolation window count' = 1 and the other
DIA window metrics. They are now collected in RunMetrics::without_isolation_window:
listed as one row without m/z values in the window table, but left out of the
window count and all window statistics, so the mzQC has no DIA window metrics
for such a run. The tool warns when no MS2 spectrum has an isolation window,
and when some MS2 spectra of a DIA run have none.

MS:4000069 'm/z acquisition range' is defined as the range of the precursor m/z
values at which MSn spectra are recorded; it was written from the outer
isolation window bounds. It now comes from the recorded precursor m/z (the
selected ion, else the isolation target) of the MSn spectra, and is written
also for runs without isolation windows. The run table's MZRangeMin/Max keeps
DIAuditor's meaning (the m/z range the windows cover). In the test reference
this changes MS:4000069 from 400-950 to 425-900 (FAIMS input) and from
400-525 to 412.5-512.5 (OpenSwath input).

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

This comment was marked as duplicate.

DIAuditor accepts Thermo .raw files (WITH_THERMO_RAW) and Bruker timsTOF .d
directories or .d.zip archives (WITH_OPENTIMS) next to mzML. mzML is still
streamed; the vendor files are loaded with FileHandler::loadExperiment() (the
readers load a whole run) and their spectra are passed to DIAQCMetrics.

- diaPASEF: the timsTOF reader splits each MS2 frame into its isolation windows
  and annotates their ion mobility ranges, which DIAuditor already keys on.
- Thermo: the FAIMS compensation voltage, TIC, isolation windows, instrument,
  serial number and start time come from the reader.
- mzQC: the inputFile's fileFormat is Thermo RAW (MS:1000563) or Bruker TDF
  (MS:1002817) accordingly; a .d directory gets no SHA-1.
- Trailing directory separators ('run.d/') are removed, as in
  FileHandler::getType(), so that the run label is the file name.
- Documented: memory use of the vendor readers, and the values they do not
  provide (mass resolving power; instrument and start time for .d).

Checked on the public FAIMS-DIA run of PXD029902 and the diaPASEF HeLa run
that OpenMS uses as optional test data: the direct results equal those of the
same data converted to mzML with FileConverter, in all 41 run columns and all
windows (75 and 24), and the mzQC output passes pymzqc's checks. TOPP tests on
these two files run when their optional fixtures are configured
(THERMO_FAIMS_DIA_TEST_DATA, OPENTIMS_DIA_TEST_DATA).

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

timosachsenberg commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Validation of Thermo .raw and Bruker .d input (4f2627e)

I checked the new vendor-file input on two real, public DIA runs. They are the same files OpenMS already uses as optional test data. For each file, DIAuditor gives the same results read directly as it does after converting to mzML.

Data

Thermo FAIMS-DIA Bruker diaPASEF
file 20210213_WTC11_DIA_5CV.raw (PXD029902) DIA_HeLa_50ng_5_6min.d.zip (OpenMS test-file mirror)
size 308,209,820 bytes 344,806,819 bytes
SHA-256 e98b2cc9…bf236b1, the hash pinned in CMakeLists.txt bacf98b4…932b6f5d, the hash pinned in CMakeLists.txt

Method

  1. I ran DIAuditor, built from this branch against the 2026-09-24 nightly SDK, directly on each vendor file.
  2. I converted each file to mzML with that nightly's FileConverter, using the OpenMS in-process readers for both formats: -RawToMzML:reader inprocess for the .raw, and the timsTOF reader on the unzipped .d. Then I ran DIAuditor on the mzML.
  3. I compared the run and window tables of both routes. I also gave the timsTOF run three ways: as .d.zip, as a .d directory, and as .d/ with a trailing slash.

Results

  • Same tables both ways: all 41 run-table columns and every window row match between the direct and the mzML route, for both files (75 and 24 windows).
  • Same timsTOF result three ways: .d.zip, .d and .d/ give identical tables. The run label is the file name in each case.
  • mzQC: the output passes pymzqc 1.0.3's syntax check (mzQC 1.0.0 schema) and semantic check with 0 issues. The input file format is Thermo RAW (MS:1000563) or Bruker TDF (MS:1002817), as expected.

What DIAuditor reports

Thermo FAIMS-DIA Bruker diaPASEF
instrument Orbitrap Eclipse, serial FSN40137, started 2021-03-01 NA (the reader does not provide it)
run length 120.0 min 5.62 min
MS1 spectra 1,974 353
MS2 spectra 90,804 8,469 (one per frame and window)
isolation windows 75, each 8 m/z wide, 400.4–1000.7 m/z 24, each 25 m/z wide, 400–1000 m/z
ion mobility FAIMS compensation voltage −5 V a separate 1/K0 range per window, within 0.60–1.60 V·s/cm²
measurements per window 1,210–1,211 352–353
MS1 cycle time 3.65 s 0.95 s
median window cycle time 6.12 s 0.95 s

Cost

input time peak memory
.raw directly 27 s 0.8 GB
same run as mzML 11 s 77 MB
.d.zip directly 38 s 3.3 GB
same run as mzML 8 s 0.2 GB

mzML is read spectrum by spectrum. The vendor readers load the whole run into memory, which the tool page states.

Gaps (reader side, not DIAuditor)

  • Mass resolving power is NA for both formats. The Thermo reader keeps the scan trailers but does not set a resolving power, and the timsTOF reader has none.
  • For .d input, instrument, serial number and start time are NA, because the timsTOF reader does not read them.

Tests

  • TOPP_DIAuditor_raw and TOPP_DIAuditor_d run exactly these comparisons against committed reference tables.
  • They run when the optional fixtures are configured: ENABLE_THERMO_FAIMS_DIA_TESTS or THERMO_FAIMS_DIA_TEST_DATA, and ENABLE_OPENTIMS_TESTS.
  • No CI job enables these fixtures at the moment.

Comparison with the original DIAuditor on these two runs (added later)

The original (.NET, c969fe3) reads only mzML. I ran it on the mzML files from step 2. I ran the port on the same files with its compatibility settings, -tic file -peak_count all -ion_mobility faims.

Thermo FAIMS-DIA Bruker diaPASEF
original on the mzML crashes (IndexOutOfRangeException); runs once the TIC chromatogram is removed runs
windows, original / port 75 / 75, all matched 24 / 24, all matched
cells that differ, with the original's times divided by 60 0 0
largest relative difference 3.1e-5 (median cycle time) 1.1e-5 (median cycle time)
port writes NA where the original writes 0 or leaves the cell empty resolving power resolving power, TIC percentile times (the mzML has no TIC values), IonMobility (no FAIMS), instrument, serial number, start time
  • Times: the original reads the seconds that OpenMS writes as minutes, so its times and cycle times are 60× too large. It also warns once per spectrum. The cause is that it takes UO:0000028 (millisecond) to mean seconds.
  • Crash: the product isolation window of the TIC chromatogram (target 0) overwrites the isolation target of the last MS2 scan. The resulting one-scan window then crashes the cycle-time median.
  • The port is affected by neither. I asked @dtabb73 whether both are intentional.
  • Medians: the small differences come from how medians are taken. The port uses the usual median; the original takes the value at position n/2. This is documented on the tool page.
  • Default settings change results only for the timsTOF run. There, the TIC is computed from the peaks (total 8.2e9 instead of 0), and each window gets its 1/K0 range.
  • Earlier checks used synthetic mzML only. On a 170 MB file modelled on msconvert output, all 32 run columns agree; on a staggered-window file, all 40 windows agree.

Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

@dtabb73: I compared the OpenMS port with DIAuditor (c969fe3) on two real, public DIA runs: a Thermo FAIMS-DIA run and a Bruker diaPASEF run, both converted to mzML by OpenMS. Two behaviours of DIAuditor look unintended to us. Were they intentional?

1. Scan start times in seconds are read as minutes

DIAuditor.cs converts scan start times like this:

else if (Xread.GetAttribute("unitAccession")== "UO:0000028")
{
    // We are in seconds; divide by 60.

UO:0000028 is millisecond; second is UO:0000010. So an mzML with times in seconds, as OpenMS writes it, takes the else branch:

  • DIAuditor prints "scan start times are written in something other than minutes or seconds!" once per spectrum: 92,778 times for the Thermo run and 8,822 times for the timsTOF run.
  • It keeps the values as they are, so all times and cycle times come out 60× too large. For example, the 5.6-minute timsTOF run gets RTDuration 337.17, and its MS1 cycle time is 57.25 s instead of 0.95 s.
  • An mzML in milliseconds would be divided by 60 instead of 60,000.

Was UO:0000028 meant to be UO:0000010? Or does a converter you use write UO:0000028 for seconds?

2. A window measured once or twice stops the run

ComputeMetricsForSwaths allocates new float[MSMSCount - 1] for the cycle times and then reads CycleTimes[MSMSCount / 2]. A window with one or two MS2 scans therefore throws IndexOutOfRangeException, and the run gets no results. The MS1 cycle time follows the same pattern for runs with one or two MS1 spectra.

A real file triggers this. The MS:1000827 (isolation window target m/z) case also fires outside <spectrum>, so the isolation window of a chromatogram's <product> overwrites the target of the last MS2 scan. OpenMS writes such a product, with target 0, for its TIC chromatogram, and SRM/PRM chromatograms have one too. On the Thermo run, the last MS2 scan became a one-scan window at target 0, and DIAuditor crashed. After I removed the chromatogram from the file, it ran.

Is stopping on very short windows meant as a guard, e.g. against DDA data? The port reports NA for such windows and warns when most windows are measured once.

Everything else agrees. I corrected for both effects: I divided DIAuditor's times by 60 and removed the chromatogram. With that, DIAuditor and the port with its compatibility settings (-tic file -peak_count all -ion_mobility faims) agree on all 75 and 24 windows:

  • Every number of both runs agrees within a relative difference of 3.1e-5. The small differences come from how the median cycle time is taken.
  • Otherwise the port only writes NA where DIAuditor writes 0 or leaves the cell empty.

The data and method are in the validation comment.

If neither was intentional, should we open issues in dtabb73/DIAuditor?


Generated by Claude Code

…as one

MzMLHandler wrote a <precursor> and a <product> for every chromatogram. A TIC
got an empty precursor (only the 'dissociation method' parent term) and a
product isolation window at m/z 0, and an MS1 chromatogram (e.g. from
OpenSWATH) got such a product. Both elements are optional in mzML. A reader
that does not tell chromatogram and spectrum isolation windows apart can
fail on them: the original DIAuditor read the TIC product's target m/z 0 as
the last MS2 spectrum's and crashed.

Reading is unchanged: a missing precursor or product loads as an empty one,
as the written empty elements did.

The TOPP reference files of the 33 affected tests lose only these empty
elements; their index offsets are shifted by the bytes removed. A new
MzMLFile_test section checks which chromatograms get the elements and
validates the stored file against the schema.

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

The two warnings were "No mapping rule found for element
'/mzML/run/chromatogramList/chromatogram/precursor/activation'", from the empty
precursors the writer gave the file's two chromatograms. It no longer writes
them, so the count is 0.

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

Copy link
Copy Markdown
Contributor Author

DIAuditor on DIA runs from archive.openms.de (f728dea)

I ran DIAuditor on three more DIA runs from archive.openms.de, chosen to cover inputs not tested so far:

  • an Orbitrap Astral run, as .raw and as ThermoRawFileParser mzML.gz;
  • a diaPASEF run converted by TIMSCONVERT;
  • a small Orbitrap Ascend run.

DIAuditor read all of them. It agrees with the original DIAuditor on every window, and all four mzQC files pass pymzqc 1.0.3's syntax and semantic checks with 0 issues. One finding concerns how .raw files are read (see Findings, item 1).

Data

run file bytes SHA-256
Orbitrap Astral FAIMS-DIA (ProteoBench Module 9, r2) benchmarks/pride-benchmarks/dia/OrbitrapAstral/ProteoBench_Module_9/20231123_DIA_240k_20Th_40ms_FAIMSCV-48_gas3p8_200pg_50pg_H_Y_r2.raw 1,195,106,851 010a08bc…674c82d5
same run, converted by ThermoRawFileParser 2.0 …_r2.mzML.gz 497,456,888 7316b245…ee518ce6a
timsTOF HF diaPASEF (PXD059079), converted by TIMSCONVERT testfiles/raw-file-museum/Bruker-timsTOF-HF-PXD059079/20230919_100SPD_NCI7_400ng_01_S1-B10_1_2727.mzML 6,025,702,284 5b42d298…0c0dc1e7
Orbitrap Ascend FAIMS-DIA (PXD059079) testfiles/raw-file-museum/Thermo-Ascend-PXD059079/20240514_FAIMS_60SPD_PC3_PACC_SC_K24.raw 66,106,192 bf9c0014…af4aca31

Paths are relative to https://archive.openms.de/openms/. DIAuditor was built from this branch against the 2026-09-24 nightly SDK.

What DIAuditor reports

Astral timsTOF HF Ascend
MS1 / MS2 spectra 1,859 / 28,183 753 / 30,120 394 / 6,304
isolation windows 20 × 20 m/z, 400.4–800.6 40 × 25 m/z, 338.6–1338.6 16 × 25.5 m/z, 379.7–780.3
ion mobility FAIMS −48 V none written by TIMSCONVERT (see below) FAIMS −55 V
measurements per window 1,409–1,410 753 394
median window cycle time 1.005 s 0.915 s 3.365 s
time, peak memory .raw 58 s, 3.0 GB; mzML.gz 18 s, 81 MB 1 min 48 s, 216 MB .raw 4.6 s, 0.4 GB

The mzML.gz is read directly, spectrum by spectrum, without unpacking it first.

Comparison with the original DIAuditor (c969fe3)

The original ran on the mzML files: the ThermoRawFileParser mzML of the Astral run, the TIMSCONVERT mzML, and an mzML of the Ascend run written by this branch's FileConverter. The port ran on the same files with its compatibility settings, -tic file -peak_count all -ion_mobility faims.

Astral timsTOF HF Ascend
windows, original / port 20 / 20, all matched 40 / 40, all matched 16 / 16, all matched
numbers that differ, other than median cycle times 0 0 0
largest difference of median cycle times 1.4e-4 relative 1.6e-5 relative 8.7e-4 relative
scan time unit in the mzML minutes minutes seconds, so the original's times are 60× too large and it warns 6,698 times
  • Median cycle times: the remaining differences come from how the median is taken. I recomputed the first Ascend window from its scan times:

    • The port's 3.359853 s is the usual median of the 393 differences.
    • The original's 3.36279 s is the difference at position n/2.

    This difference is documented on the tool page.

  • NA vs 0: apart from that, the port only writes NA where the original writes 0: mass resolving power in all three runs, and IonMobility for the timsTOF run.

  • Writer fix: the Ascend mzML was written with the chromatogram fix of this PR. Its TIC chromatogram has no precursor or product, and the original read it without crashing.

Findings

  1. Thermo .raw peak picking. Read directly on the 09-24 nightly, the Astral's profile MS1 scans are counted point by point: a median of 24,149 peaks, against 1,728 in the ThermoRawFileParser mzML. Develop now reads .raw with Thermo's peak picking, like FileConverter (4c386d4, [FIX] FileHandler: read Thermo .raw with the vendor peak picking, like FileConverter #10303). I rebuilt the nightly's FileHandler with that change and ran the files again:

    • Astral: the .raw and mzML routes agree on all 20 windows and on every run column except the MS1 peak counts. Those are about 1% lower from the .raw (median 1,707 vs 1,728), because the two converters' peak picking differs.
    • WTC11 (the TOPP_DIAuditor_raw fixture): the committed reference tables still match exactly.

    Once develop is merged into this branch, the tool page's sentence that spectra "are used as they are stored, profile or centroided" is no longer true for .raw input.

  2. TIMSCONVERT output:

    • It writes no ion mobility range per window, only an ion mobility array per spectrum. Here that loses nothing, because all 40 windows have distinct m/z ranges. A method with several windows on the same m/z range would have them merged.
    • Its MS1 spectra keep every ion mobility point, so MS1 peak counts are very large (median 373,829).

Not tested

  • the timsTOF SCP diaPASEF runs in testfiles/dia/PXD076608 (5 GB analysis.tdf_bin each), which need more memory than the 15 GB available here
  • SCIEX SWATH / Zeno SWATH in the museum, which are only available as .wiff
  • Waters MSE, whose converted mzML has only MS1-level spectra
  • the other pride-benchmarks/dia folders (Fusion, Lumos, ZenoTOF 8600, timsTOF SCP), which are empty

Generated by Claude Code

Since #10303, FileHandler reads Thermo .raw files centroided, as FileConverter
does by default, so the tool page's "spectra are used as they are stored" now
holds for mzML input only.

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

Copy link
Copy Markdown
Contributor Author

build-wheels-linux-arm failed on 9aa5d6f during setup, before anything was built (job log):

Error: Failed to download metadata for repo 'epel': ... Cannot download, all mirrors were already tried without success
bash: line 38: ninja: command not found

All EPEL 9 aarch64 mirrors returned 404 for the repository metadata. So the build tools (ninja, the compiler toolchain) were never installed, and CMake could not configure.

This is not caused by this PR, which changes no packaging or CI files. The same job passed on the previous head, f728dea. No code fix is needed. GitHub does not allow a re-run while the other wheel jobs of the run are still going, so I will re-run the failed job once when the run has finished.


Generated by Claude Code

@timosachsenberg
timosachsenberg merged commit 5fd4850 into develop Sep 28, 2026
17 of 18 checks passed
@timosachsenberg
timosachsenberg deleted the claude/charming-cannon-b0v55v branch September 28, 2026 12:24
timosachsenberg added a commit that referenced this pull request Sep 28, 2026
…; read timsTOF acquisition metadata (#10313)

* [FIX] mzML, Thermo and timsTOF readers: keep the mass resolving power; read timsTOF acquisition metadata

Three gaps behind DIAuditor's NA values (follow-up to #10271).

mzML writer: MS:1000800 'mass resolving power' is a scan attribute, allowed only
in <scan>, but the mzML reader keeps it with the spectrum. The writer therefore
wrote it as a userParam of the spectrum, and other readers, such as the original
DIAuditor, lost it once a file had been written by OpenMS. It is now written as
the CV term in the first scan; a value of the scan itself takes precedence. It is
written whatever the type of its value: the vocabulary declares a string, so an
integer failed the mapping check and became a userParam even inside the scan.

Thermo reader: spectra get the mass resolving power from the scan trailer,
'Orbitrap Resolution:', else 'FT Resolution:', as msconvert does. On the Orbitrap
Ascend FAIMS run of PXD059079 all 6,698 scans match msconvert's MS:1000800
(MS1 60,000, MS2 30,000).

timsTOF reader: loadExperimentalSettings_() reads the GlobalMetadata table of
analysis.tdf (of the unpacked directory for a .d.zip):
- AcquisitionDateTime: the DateTime, and verbatim, with its time zone, the mzML
  startTimeStamp;
- InstrumentSerialNumber: the instrument serial number;
- InstrumentName: the instrument model if it is a PSI-MS model name (e.g.
  'timsTOF HT', 'timsTOF Pro 2'); otherwise, for the timsTOF family, 'Bruker
  Daltonics timsTOF series', as msconvert reports every timsTOF. The HeLa
  fixtures call their instrument 'impacTEM-pt'.

Tests:
- MzMLFile_test: new section for a value of the spectrum, of the scan and of a
  spectrum without acquisition info; schema and semantic validation; read back.
- ThermoRawFile_test (optional data): resolving power of the Angiotensin FTMS
  scans, also after the mzML round trip; counts per MS level of the WTC11
  FAIMS-DIA run.
- BrukerTimsFile_test (optional data): start time, instrument and serial number
  of the HeLa DDA run, also after the mzML round trip.
- TOPP references: the outputs of FileConverter_23 and FileFilter_12 have the
  resolving power in the scan (index offsets +16 bytes). DIAuditor_raw gets
  MS1Resolution 120000 and MassResolvingPower 30000, DIAuditor_d the instrument,
  serial number and start time; all other cells are unchanged.

The DIAuditor tool page no longer lists these values as NA.

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

* [DOC] CHANGELOG: add PR number of the reader fixes

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

* [FIX] BrukerTimsFile: reset the acquisition metadata a run does not provide

loadExperimentalSettings_() left the start of the acquisition (DateTime and
mzml_start_time_stamp) and the instrument serial number unchanged when the
GlobalMetadata table of the run lacks them. readDIAMetadata() fills settings
the caller passes, so settings used for an earlier run kept that run's
values. They are now reset. An unreadable GlobalMetadata table no longer
skips the instrument either, so it is reset as well. Addresses the
CodeRabbit review of #10313.

Checked by reading the HeLa DIA run, then a copy of it without
AcquisitionDateTime and InstrumentSerialNumber, into the same settings:
before, the copy kept the date, start time stamp and serial number of the
first run; now it has none, as when read into new settings.

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

---------

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.

2 participants