OpenMS
Loading...
Searching...
No Matches
ThermoRawScanReader.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Julianus Pfeuffer $
6// $Authors: Julianus Pfeuffer $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
13#include <functional>
14#include <memory>
15#include <string>
16#include <vector>
17
18namespace OpenMS
19{
20 class DataProcessing;
21 class ExperimentalSettings;
22 class MSChromatogram;
23 class MSSpectrum;
24
25namespace Internal
26{
48 class OPENMS_DLLAPI ThermoRawScanReader
49 {
50 public:
51 using Options = ThermoRawFile::Options;
52
54 struct ScanInfo
55 {
56 int scan = 0;
57 int ms_level = 0;
58 double rt = 0.0;
59 double tic = 0.0;
60 double precursor_mz = 0.0;
61 };
62
64 using ParentLookup = std::function<const MSSpectrum*(int scan)>;
65
75 ThermoRawScanReader(const std::string& path, const Options& options);
79
81 bool hasMSData() const;
83 int firstScan() const;
85 int lastScan() const;
86
88 void fillSettings(ExperimentalSettings& settings) const;
89
97 const ScanInfo& header(int scan, bool with_peaks = false);
98
109 void readAhead(int last_scan, int peaks_from);
110
125 void scanHeaders(int first, int last, bool precursors, const std::function<bool(const ScanInfo&)>& visit);
126
135 void convert(MSSpectrum& spectrum, ExperimentalSettings& settings, const ParentLookup& parent, bool peaks);
136
145
147 std::shared_ptr<DataProcessing> dataProcessing() const;
148
151
153 void readDetectors(std::vector<MSChromatogram>& chromatograms, std::vector<MSSpectrum>& spectra);
154
155 private:
156 struct Impl;
157 std::unique_ptr<Impl> impl_;
158 };
159} // namespace Internal
160} // namespace OpenMS
Description of the experimental settings.
Definition ExperimentalSettings.h:37
Scan-by-scan conversion of a Thermo RAW file into OpenMS spectra (private).
Definition ThermoRawScanReader.h:49
std::shared_ptr< DataProcessing > dataProcessing() const
Data processing attached to every converted spectrum and chromatogram.
void convert(MSSpectrum &spectrum, ExperimentalSettings &settings, const ParentLookup &parent, bool peaks)
Convert the scan of the last header() call.
ThermoRawFile::Options Options
Definition ThermoRawScanReader.h:51
void readDetectors(std::vector< MSChromatogram > &chromatograms, std::vector< MSSpectrum > &spectra)
Detector (UV/PDA/analog) chromatograms and PDA spectra (Options::all_detectors); may be called at any...
void scanHeaders(int first, int last, bool precursors, const std::function< bool(const ScanInfo &)> &visit)
Visit the headers of scans first to last ahead of header(), without peaks.
std::unique_ptr< Impl > impl_
Definition ThermoRawScanReader.h:157
bool hasMSData() const
True if the file contains a mass spectrometer controller.
void fillSettings(ExperimentalSettings &settings) const
Write run-level settings into settings (instrument configurations are added by convert() and addInstr...
const ScanInfo & header(int scan, bool with_peaks=false)
Read the header of scan; must be called for every scan in increasing order.
int firstScan() const
First MS scan number (only valid if hasMSData()).
MSChromatogram ticChromatogram() const
TIC chromatogram as reported by the vendor library (reads every scan header).
ThermoRawScanReader(const std::string &path, const Options &options)
Open path.
ThermoRawScanReader(const ThermoRawScanReader &)=delete
void addInstrumentConfigurations(ExperimentalSettings &settings)
Add the instrument configurations of all scans read by header() so far to settings.
int lastScan() const
Last MS scan number (only valid if hasMSData()).
ThermoRawScanReader & operator=(const ThermoRawScanReader &)=delete
std::function< const MSSpectrum *(int scan)> ParentLookup
Returns the converted (peak-sorted) spectrum of a scan or nullptr if it is not available.
Definition ThermoRawScanReader.h:64
void readAhead(int last_scan, int peaks_from)
Read the following scans up to last_scan on worker threads ahead of header().
Scan header values needed to select scans before converting them.
Definition ThermoRawScanReader.h:55
The representation of a chromatogram.
Definition MSChromatogram.h:33
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
OpenMS looks in the< code > OPENMS_THERMO_MANAGED_DIR</code > environment variable first
Definition common-cmake-parameters.doxygen:197
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19