OpenMS
Loading...
Searching...
No Matches
ThermoRawFileMetadata.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8#pragma once
9
10#include <OpenMS/OpenMSConfig.h>
11
12#include <cstddef>
13#include <map>
14#include <optional>
15#include <string>
16#include <vector>
17
18namespace OpenMS::Internal
19{
21struct OPENMS_DLLAPI ThermoTrailerEntry
22{
23 std::string label;
24 std::string value;
25};
26
28struct OPENMS_DLLAPI ThermoReaction
29{
30 std::optional<double> precursor_mass;
31 std::optional<double> isolation_width;
32 std::optional<double> isolation_offset;
33 std::string activation;
34 std::optional<double> collision_energy;
35 bool collision_energy_valid = false;
36};
37
39struct OPENMS_DLLAPI ThermoScan
40{
41 int scan_number = 0;
42 int ms_level = 0;
43 std::string filter;
44 std::string native_id;
45 std::vector<ThermoTrailerEntry> trailer;
46 std::vector<ThermoReaction> reactions;
47};
48
50struct OPENMS_DLLAPI ThermoPrecursor
51{
52 double target_mz = 0.0;
53 double selected_mz = 0.0;
54 std::optional<int> charge;
55 std::optional<double> width;
56 double lower_offset = 0.0;
57 double upper_offset = 0.0;
58 int parent_scan = 0;
59 bool estimate_intensity = true;
60 std::string spectrum_ref;
62 std::optional<ThermoReaction> supplemental;
63};
64
69class OPENMS_DLLAPI ThermoRawFileMetadata
70{
71public:
73 static std::string trailer(const ThermoScan& scan, const std::string& label);
74
80 static std::optional<double> number(const std::string& value);
81
90 static double selectedIon(double target, std::optional<double> mono, double width);
91
102 std::vector<ThermoPrecursor> precursors(const ThermoScan& scan);
103
104private:
106 struct State
107 {
108 int level = 1;
109 int parent = 0;
110 std::size_t reactions = 0;
111 std::string native_id;
112 std::vector<ThermoPrecursor> own;
113 };
114 std::map<int, State> scans_;
115 std::map<std::string, int> filters_;
116
118 static bool supplemental_(const ThermoReaction& first, const ThermoReaction& second);
120 static std::size_t lastReaction_(const std::vector<ThermoReaction>& reactions);
122 int parentFromFilter_(const std::string& key) const;
124 static std::vector<double> spsMasses_(const ThermoScan& scan);
125};
126} // namespace OpenMS::Internal
Resolve the precursor hierarchy from bridge metadata without fetching peaks. Keeps isolation targets ...
Definition ThermoRawFileMetadata.h:70
std::vector< ThermoPrecursor > precursors(const ThermoScan &scan)
Precursor descriptors of one scan; scans must be passed in acquisition order.
std::map< int, State > scans_
seen scans by scan number
Definition ThermoRawFileMetadata.h:114
static std::vector< double > spsMasses_(const ThermoScan &scan)
SPS target masses from the legacy ("SPS Mass N:") or modern ("SPS Masses:") trailer labels.
int parentFromFilter_(const std::string &key) const
Most recent scan whose filter key is the parent of key (0 if none).
static std::size_t lastReaction_(const std::vector< ThermoReaction > &reactions)
Index of the reaction that isolated this scan's precursor when no parent is known.
static std::optional< double > number(const std::string &value)
Parse a trailer value as a number.
static bool supplemental_(const ThermoReaction &first, const ThermoReaction &second)
True if second is the supplemental (HCD / CID) step of an ETD / ECD reaction first on the same target...
std::map< std::string, int > filters_
most recent scan per filter key ("" for MS1)
Definition ThermoRawFileMetadata.h:115
static std::string trailer(const ThermoScan &scan, const std::string &label)
Value of the trailer-extra entry with exactly this label, or "" if absent.
std::string native_id
spectrum reference for descendants
Definition ThermoRawFileMetadata.h:111
static double selectedIon(double target, std::optional< double > mono, double width)
Selected ion m/z of a precursor (ThermoRawFileParser rule).
std::vector< ThermoPrecursor > own
this scan's own precursor descriptors
Definition ThermoRawFileMetadata.h:112
What is retained per seen scan to resolve later scans' parents.
Definition ThermoRawFileMetadata.h:107
OpenMS looks in the< code > OPENMS_THERMO_MANAGED_DIR</code > environment variable first
Definition common-cmake-parameters.doxygen:179
Namespace used to hide implementation details from users.
Definition BayesianProteinInferenceAlgorithm.h:26
std::optional< double > width
isolation width; unset if unknown or negative
Definition ThermoRawFileMetadata.h:55
std::optional< double > isolation_width
isolation window width (Th)
Definition ThermoRawFileMetadata.h:31
std::string label
e.g. "Monoisotopic M/Z:"
Definition ThermoRawFileMetadata.h:23
std::optional< double > precursor_mass
isolation target m/z
Definition ThermoRawFileMetadata.h:30
std::string spectrum_ref
native ID of the parent scan ("" if unknown)
Definition ThermoRawFileMetadata.h:60
std::string value
as reported by the instrument, numbers included
Definition ThermoRawFileMetadata.h:24
std::string filter
scan filter string, e.g. "FTMS + c NSI Full ms2 500.00@hcd30.00 [100-1000]"
Definition ThermoRawFileMetadata.h:43
std::optional< int > charge
unset if unknown or not positive
Definition ThermoRawFileMetadata.h:54
std::vector< ThermoTrailerEntry > trailer
trailer-extra entries in file order
Definition ThermoRawFileMetadata.h:45
std::optional< double > isolation_offset
isolation window offset from the target (Th)
Definition ThermoRawFileMetadata.h:32
std::string native_id
e.g. "controllerType=0 controllerNumber=1 scan=12"
Definition ThermoRawFileMetadata.h:44
std::vector< ThermoReaction > reactions
reactions in acquisition order (MS2 first)
Definition ThermoRawFileMetadata.h:46
std::optional< double > collision_energy
vendor value; meaningful only if collision_energy_valid
Definition ThermoRawFileMetadata.h:34
ThermoReaction activation
primary reaction
Definition ThermoRawFileMetadata.h:61
std::optional< ThermoReaction > supplemental
supplemental activation (e.g. the HCD step of EThcD)
Definition ThermoRawFileMetadata.h:62
std::string activation
vendor activation type name, e.g. "HigherEnergyCollisionalDissociation"
Definition ThermoRawFileMetadata.h:33
One precursor of an MSn scan as reconstructed by ThermoRawFileMetadata::precursors().
Definition ThermoRawFileMetadata.h:51
One reaction (isolation plus activation step) of a Thermo MSn scan event.
Definition ThermoRawFileMetadata.h:29
The per-scan metadata needed to reconstruct the precursor hierarchy.
Definition ThermoRawFileMetadata.h:40
One "trailer extra" label/value pair of a Thermo scan.
Definition ThermoRawFileMetadata.h:22