Repository navigation
Description
Found while reviewing #10545 (tested on its head, dbd60d9).
Problem
FileConverter reads Bruker .d input with BrukerTimsFile directly. It never checks whether the run is MALDI imaging (MaldiApplicationType = Imaging). FileHandler::loadExperiment refuses such data with InvalidFileType ("load it via FileHandler::loadImagingExperiment"), but FileConverter does not go through it:
- normal path:
tims_file.load(in, exp, bruker_config)(src/topp/FileConverter.cpp~889) -process_lowmemorypath, new in [FEATURE] Bruker .d reader: faster loads, PeakFileOptions pushdown, streaming transform(), format detection (#10522) #10545:tims_file.transform(in, &consumer, getBrukerConfig_())(~856)
An imaging .d is therefore either converted into a flat mzML with all pixel positions lost, without any warning, or the tool aborts.
Observed (two small subsets of real timsTOF fleX imaging runs)
| Imaging data | Mode | Result |
|---|---|---|
MS1 only (all MsMsType 0) |
default, -process_lowmemory |
abort, exit 134: terminate called after throwing SQLite::Exception: no such table: Precursors (AUTO → DDA path, see #10597). With -process_lowmemory a 0-byte mzML is left behind. |
| MS1 only | -bruker:export_mode frame (± lowmemory) |
exit 0, one MS1 spectrum per pixel frame (frame=N), RT = acquisition time, no XY |
all MsMsType 9, DiaFrameMsMsWindows populated |
default (± lowmemory) | exit 0, AUTO picks DIA: 7 "window" spectra per pixel frame (14,000 spectra from 2,000 pixels), unrelated to pixels |
| same | -bruker:export_mode frame |
exit 0, MS level 2 spectra without precursor, no XY |
For comparison, FileHandler::loadImagingExperiment loads both subsets correctly (48×21 and 138×29 pixels).
The gap on the normal path predates #10545. The PR adds the second, low-memory entry point.
Proposed fix
Check this once, right after in_type is known, so both branches are covered:
#ifdef WITH_OPENTIMS
#include <OpenMS/FORMAT/BrukerTimsFile.h>
+#include <OpenMS/FORMAT/BrukerTimsImagingFile.h>
#endif
@@
+#ifdef WITH_OPENTIMS
+ // MALDI imaging .d is not a flat run: BrukerTimsFile would read it as DDA/DIA and drop the pixel positions
+ // (FileHandler::loadExperiment refuses it for the same reason)
+ if (in_type == FileTypes::BRUKER_TDF && BrukerTimsImagingFile::isImagingDataset(in))
+ {
+ writeLogError_("Error: '" + in + "' is a Bruker MALDI imaging .d, which cannot be converted to a flat spectra file (the pixel positions would be lost).");
+ return ILLEGAL_PARAMETERS;
+ }
+#endif(git apply --check passes on dbd60d9. Not compiled or run.)
Open points
BrukerTimsImagingFile::isImagingDataset()returnsfalsefor a.d.zip, because it looks for<zip>/analysis.tdfand swallows the exception. So imaging archives would still get past this guard, andFileHandler::loadExperiment's guard as well.BrukerTimsImagingFilehas no archive support at all:loadImagingExperimenton an imaging.d.zipthrowsFileNotReadable: '<x>.d.zip/analysis.tdf'.- Should frame-wise export of imaging data stay possible on purpose (e.g.
-bruker:export_mode framewith a warning)? Some users may want per-pixel spectra keyed byframe=Nand join the coordinates themselves. - The real fix would be imaging
.d→ imzML (loadImagingExperiment+ImzMLFile::store).FileConverterhas no imzML input or output yet.
Activity
[FIX] BrukerTimsFile: reject MALDI imaging runs outside export mode F…
[FIX] Bruker .d: read TDF data without PASEF precursors; reject MALDI…