![]() |
OpenMS
|
Scan-by-scan conversion of a Thermo RAW file into OpenMS spectra (private). More...
#include <OpenMS/FORMAT/HANDLERS/ThermoRawScanReader.h>
Classes | |
| struct | ScanInfo |
| Scan header values needed to select scans before converting them. More... | |
Public Types | |
| using | Options = ThermoRawFile::Options |
| using | ParentLookup = std::function< const MSSpectrum *(int scan)> |
| Returns the converted (peak-sorted) spectrum of a scan or nullptr if it is not available. | |
Public Member Functions | |
| ThermoRawScanReader (const std::string &path, const Options &options) | |
Open path. | |
| ~ThermoRawScanReader () | |
| ThermoRawScanReader (const ThermoRawScanReader &)=delete | |
| ThermoRawScanReader & | operator= (const ThermoRawScanReader &)=delete |
| bool | hasMSData () const |
| True if the file contains a mass spectrometer controller. | |
| int | firstScan () const |
| First MS scan number (only valid if hasMSData()). | |
| int | lastScan () const |
| Last MS scan number (only valid if hasMSData()). | |
| void | fillSettings (ExperimentalSettings &settings) const |
Write run-level settings into settings (instrument configurations are added by convert() and addInstrumentConfigurations()). | |
| const ScanInfo & | header (int scan, bool with_peaks=false) |
Read the header of scan; must be called for every scan in increasing order. | |
| void | readAhead (int last_scan, int peaks_from) |
Read the following scans up to last_scan on worker threads ahead of header(). | |
| 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. | |
| void | convert (MSSpectrum &spectrum, ExperimentalSettings &settings, const ParentLookup &parent, bool peaks) |
| Convert the scan of the last header() call. | |
| void | addInstrumentConfigurations (ExperimentalSettings &settings) |
Add the instrument configurations of all scans read by header() so far to settings. | |
| std::shared_ptr< DataProcessing > | dataProcessing () const |
| Data processing attached to every converted spectrum and chromatogram. | |
| MSChromatogram | ticChromatogram () const |
| TIC chromatogram as reported by the vendor library (reads every scan header). | |
| 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 time. | |
Private Attributes | |
| std::unique_ptr< Impl > | impl_ |
Scan-by-scan conversion of a Thermo RAW file into OpenMS spectra (private).
Shared by ThermoRawFile::load() and by later streaming and random access readers. A reader opens the RAW file once; all calls must come from one thread.
Usage:
The precursor intensity estimate of an MSn scan sums peaks of its parent scan. convert() asks the ParentLookup for the parent spectrum first (e.g. the already loaded experiment); if it returns nullptr, the reader decodes the parent peaks itself, so filtered loads give the same precursors as a full load.
| struct OpenMS::Internal::ThermoRawScanReader::ScanInfo |
Scan header values needed to select scans before converting them.
| using Options = ThermoRawFile::Options |
| using ParentLookup = std::function<const MSSpectrum*(int scan)> |
Returns the converted (peak-sorted) spectrum of a scan or nullptr if it is not available.
| ThermoRawScanReader | ( | const std::string & | path, |
| const Options & | options | ||
| ) |
Open path.
| [in] | path | Thermo RAW file (symbolic links are resolved for the vendor library) |
| [in] | options | Conversion options; ms_levels / rt / scan ranges are not applied here |
| Exception::FileNotFound | if path does not exist |
| std::exception | if the bridge cannot open the file |
| ~ThermoRawScanReader | ( | ) |
|
delete |
| void addInstrumentConfigurations | ( | ExperimentalSettings & | settings | ) |
Add the instrument configurations of all scans read by header() so far to settings.
Configuration ids are assigned in the order of all scans read, independent of which scans are converted. Call this after the last header() so that configurations of scans that were not converted are also listed, as in a load without scan selection.
| void convert | ( | MSSpectrum & | spectrum, |
| ExperimentalSettings & | settings, | ||
| const ParentLookup & | parent, | ||
| bool | peaks | ||
| ) |
Convert the scan of the last header() call.
| [out] | spectrum | The converted spectrum (peaks sorted by m/z) |
| [in,out] | settings | Receives instrument configurations as they appear |
| [in] | parent | Lookup of already converted parent spectra (may be empty) |
| [in] | peaks | If false, no peaks or auxiliary arrays are read (metadata only) |
| std::shared_ptr< DataProcessing > dataProcessing | ( | ) | const |
Data processing attached to every converted spectrum and chromatogram.
| void fillSettings | ( | ExperimentalSettings & | settings | ) | const |
Write run-level settings into settings (instrument configurations are added by convert() and addInstrumentConfigurations()).
| int firstScan | ( | ) | const |
First MS scan number (only valid if hasMSData()).
| bool hasMSData | ( | ) | const |
True if the file contains a mass spectrometer controller.
| const ScanInfo & header | ( | int | scan, |
| bool | with_peaks = false |
||
| ) |
Read the header of scan; must be called for every scan in increasing order.
| [in] | scan | Scan number, the successor of the previous call's scan |
| [in] | with_peaks | Also read the peaks for a following convert() call. Saves a second vendor read of the scan when the caller already knows it will convert it. |
| int lastScan | ( | ) | const |
Last MS scan number (only valid if hasMSData()).
|
delete |
| void readAhead | ( | int | last_scan, |
| int | peaks_from | ||
| ) |
Read the following scans up to last_scan on worker threads ahead of header().
Uses up to three threads besides the calling one, limited by the OpenMP thread count (none if it is 1). Output is unchanged; header() takes the scans from the read-ahead buffer, which holds a bounded number of scans.
| [in] | last_scan | Last scan to read ahead |
| [in] | peaks_from | Scans from this number on are read with peaks (as header(scan, true)) |
| 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 time.
| 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.
A cheap pass, e.g. to count the scans a filtered conversion selects before streaming them or to index a file for random access. Instrument configurations are registered in the same order as header() would register them (so ids match a single pass), and the state of header() and convert() is not changed otherwise.
| [in] | first | First scan number; use firstScan() if precursors are resolved |
| [in] | last | Last scan number |
| [in] | precursors | Also set ScanInfo::precursor_mz. Reads the trailers and resolves the precursors from first on (slower); otherwise precursor_mz is NaN. |
| [in] | visit | Called for every scan in order; returning false stops the pass |
| MSChromatogram ticChromatogram | ( | ) | const |
TIC chromatogram as reported by the vendor library (reads every scan header).
|
private |