Repository navigation
[FEATURE] DIAuditor: DIA quality metrics per run and isolation window - #10271
Conversation
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
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RHVqy5Nqy6QYfGG8AoxnNj
This comment was marked as resolved.
This comment was marked as resolved.
|
@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.
All term texts quoted below were checked against the current Issue 1: MS:4000196 has the same name as MS:4000194 ("DIA isolation window count"). Template: blank issueMS:4000194 and MS:4000196 have the same name, "DIA isolation window count", but different meanings and value shapes:
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. 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 issueMS: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: Issue 3: New QC term: DIA isolation window metrics (table). Template: "New QC Term" formWhat is the QC term's name? DIA isolation window metrics Briefly describe the QC term. 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: Describe any additional information. Proposed columns:
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: 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:
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: 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
…nnon-b0v55v # Conflicts: # CHANGELOG
…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
…ly lack retention times Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RHVqy5Nqy6QYfGG8AoxnNj
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
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
Method
Results
What DIAuditor reports
Cost
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)
Tests
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,
Generated by Claude Code |
|
@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
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
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
A real file triggers this. The 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 (
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
DIAuditor on DIA runs from archive.openms.de (f728dea)I ran DIAuditor on three more DIA runs from
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
Paths are relative to What DIAuditor reports
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,
Findings
Not tested
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
|
All EPEL 9 aarch64 mirrors returned 404 for the repository metadata. So the build tools ( 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 |
…; 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]>
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:
Layout. The code follows the tool-local convention of #10239:
src/topp/DIAuditor/DIAuditor.cpp: the TOPP maininclude/DIAQCMetrics.handsource/DIAQCMetrics.cpp: the metricstest/DIAQCMetrics_test.cpp: the class testThe metrics class keeps only a small record per spectrum. The mzQC JSON is written in the tool-local source, with
nlohmann_jsonlinked the same way as in OpenNuXL.Inputs and outputs
-in: one or more files, one per run:MzMLFile::transform, so file size does not matter.WITH_THERMO_RAW) and Bruker timsTOF .d directories or.d.ziparchives (WITH_OPENTIMS) are read with the OpenMS vendor readers throughFileHandler::loadExperiment. These readers load a whole run into memory.-out: one row per run. The columns are DIAuditor'sbyRuntable, followed by run-level MS2 statistics.-out_windows: one row per isolation window. The columns are DIAuditor'sbyIsolationWindowtable, followed by the ion mobility range and the isolation target.-out_mzqc: mzQC 1.0 with one runQuality per run.-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:
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:
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:
The following differences are deliberate and documented on the tool page:
NAinstead of0.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.MzMLHandlernow ends that progress before it stops. A newMzMLFile_testsection checks that two consecutive transforms nest alike, for both first-pass variants. It fails on the unpatched reader.mzML writer fix (libOpenMS).
MzMLHandlerwrote a<precursor>and a<product>for every chromatogram: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.
MzMLFile_testsection 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_1andTOPP_DIAuditor_2: a new synthetic FAIMS DIA input of 88 KB, plus the existingOpenSwathWorkflow_1_input.mzML.TOPP_DIAuditor_rawandTOPP_DIAuditor_drun 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'sshare/directory. The reader and writer fixes were tested by preloading the patchedMzMLHandlerinto 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.
The changed sources compile warning-free with OpenMS's gcc (with
-Werror) and clang warning flags, with and without the vendor readers.Open points
PeakFileOptions::setSkipChromatograms(true)would avoid that, butMzMLHandlerthen 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.Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
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.rebuild jenkinswill retrigger Jenkins-based CI builds🤖 Generated with Claude Code
https://claude.ai/code/session_01RHVqy5Nqy6QYfGG8AoxnNj
Summary by CodeRabbit
New Features
Bug Fixes