libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
qualifiedmassspectrum.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (c) 2015 Olivier Langella <olivier.langella@u-psud.fr>.
3 *
4 * This file is part of the PAPPSOms++ library.
5 *
6 * PAPPSOms++ is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * PAPPSOms++ is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
18 *
19 ******************************************************************************/
20
21#pragma once
22
23/////////////////////// StdLib includes
24#include <memory>
25
26
27/////////////////////// Qt includes
28
29
30/////////////////////// Local includes
31#include "../exportinmportconfig.h"
32#include "../types.h"
33#include "massspectrum.h"
34#include "massspectrumid.h"
35
36
37namespace pappso
38{
39
40// Forward declaration.
41class QualifiedMassSpectrum;
42
43typedef std::shared_ptr<QualifiedMassSpectrum> QualifiedMassSpectrumSPtr;
44typedef std::shared_ptr<const QualifiedMassSpectrum>
46
48{
49
50 TimsIonMobScanOneOverK0, ///< 1/kO of a simple scan
51 TimsFrameIonMobOneOverK0Begin, ///< Bruker's timsTOF frame's 1/K0 range's
52 ///< begin value
53 TimsFrameIonMobOneOverK0End, ///< Bruker's timsTOF frame's 1/K0 range's end
54 ///< value
55
59
60 IsolationMz, ///< isolation m/z value
61 IsolationMzWidth, ///< m/z isolation window width (left + right)
62
63 CollisionEnergy, ///< Bruker's timsTOF collision energy
64 BrukerPrecursorIndex, ///< Bruker's timsTOF precursor index
65 TimsFrameScansCount, ///< Bruker's timsTOF frame's total ion mobility slots
66
67 TimsFrameMzIndexBegin, ///< Bruker's timsTOF mz index frame start range
68 TimsFrameMzIndexEnd, ///< Bruker's timsTOF mz index frame end range
69
70 ScanNumber, ///< scan number: Ordinal number of the scan indicating its order
71 ///< of acquisition within a mass spectrometry acquisition run.
72 ///< MS_scan_number = 1003057,
73 last
74};
75
77{
78 double mz = 0;
79 int charge = 0;
80 double intensity = 0;
81
82 // Constructor
83 PrecursorIonData(double mz_value = 0,
84 int charge_value = 0,
85 double intensity_value = 0)
86 {
87 mz = mz_value;
88 charge = charge_value;
89 intensity = intensity_value;
90 };
91};
92
93
94//! Class representing a fully specified mass spectrum.
95/*!
96 * The member data that qualify the MassSpectrum \c msp_massSpectrum member
97 * allow to unambiguously characterize the mass spectrum.
98 * \sa MassSpectrum
99 */
101{
102 public:
105 QualifiedMassSpectrum(MassSpectrumSPtr mass_spectrum_SPtr);
108
109 QualifiedMassSpectrum &operator=(const QualifiedMassSpectrum &other);
110
111 /** @brief clone the mass spectrum contained in Qualified Mass Spectrum
112 */
113 const QualifiedMassSpectrum &cloneMassSpectrumSPtr();
114
115 QualifiedMassSpectrumSPtr makeQualifiedMassSpectrumSPtr() const;
116 QualifiedMassSpectrumCstSPtr makeQualifiedMassSpectrumCstSPtr() const;
117
118 void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum);
119 MassSpectrumSPtr getMassSpectrumSPtr() const;
120 MassSpectrumCstSPtr getMassSpectrumCstSPtr() const;
121
122 void setMassSpectrumId(const MassSpectrumId &iD);
123 const MassSpectrumId &getMassSpectrumId() const;
124 MassSpectrumId &getMassSpectrumId();
125
126 void setEmptyMassSpectrum(bool is_empty_mass_spectrum);
127 bool isEmptyMassSpectrum() const;
128
129 void setMsLevel(uint ms_level);
130 uint getMsLevel() const;
131
132 void setRtInSeconds(pappso_double rt);
133 pappso_double getRtInSeconds() const;
134 pappso_double getRtInMinutes() const;
135
136 void setDtInMilliSeconds(pappso_double rt);
137 pappso_double getDtInMilliSeconds() const;
138
139 /** @brief get precursor mz
140 * @param ok pointer on boolean, false if precursor mz is not defined
141 * @return precursor mz
142 */
143 pappso_double getPrecursorMz(bool *ok = nullptr) const;
144
145 /** @brief get precursor mass given the charge stats and precursor mz
146 * @param ok pointer on boolean, false if precursor mz is not defined
147 * @return precursor mass (neutral mass without H+)
148 */
149 double getPrecursorMass(bool *ok_p = nullptr) const;
150
151 QString getPrecursorDataMzValuesAsString(
152 const std::vector<PrecursorIonData> &precursor_ion_data_vector,
153 const QString &separator = "\n") const;
154 QString
155 getPrecursorDataMzValuesAsString(const QString &separator = "\n") const;
156 QString getMzSortedPrecursorDataMzValuesAsString(
157 const QString &separator = "\n") const;
158
159 /** @brief get precursor charge
160 * @param ok pointer on boolean, false if precursor charge is not defined
161 * @return precursor charge
162 */
163 uint getPrecursorCharge(bool *ok = nullptr) const;
164 QString getPrecursorDataChargeValuesAsString(
165 const std::vector<PrecursorIonData> &precursor_ion_data_vector,
166 const QString &separator = "\n") const;
167 QString
168 getPrecursorDataChargeValuesAsString(const QString &separator = "\n") const;
169 QString getMzSortedPrecursorDataChargeValuesAsString(
170 const QString &separator = "\n") const;
171
172
173 /** @brief get precursor intensity
174 * @param ok pointer on boolean, false if precursor intensity is not defined
175 * @return precursor intensity
176 */
177 pappso_double getPrecursorIntensity(bool *ok = nullptr) const;
178
179 void setPrecursorSpectrumIndex(std::size_t precursor_scan_num);
180 std::size_t getPrecursorSpectrumIndex() const;
181
182 void setPrecursorNativeId(const QString &native_id);
183 const QString &getPrecursorNativeId() const;
184
185 void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data);
186 const std::vector<PrecursorIonData> &getPrecursorIonData() const;
187 std::vector<PrecursorIonData> getPrecursorIonDataSortedWithMz() const;
188
189 void setParameterValue(QualifiedMassSpectrumParameter parameter,
190 const QVariant &value);
191 const QVariant
192 getParameterValue(QualifiedMassSpectrumParameter parameter) const;
193
194 std::size_t size() const;
195
196 QString toString(bool with_data = false) const;
197
198 protected:
199 //! Shared pointer to the mass spectrum.
200 MassSpectrumSPtr msp_massSpectrum = nullptr;
201
202 //! Id of the mass spectrum.
204
205 bool m_isEmptyMassSpectrum = false;
206
207 //! Mass spectrometry level of this mass spectrum.
208 unsigned int m_msLevel = 0;
209
210 //! Retention time (in seconds) at which this mass spectrum was acquired.
211 pappso_double m_rt = -1;
212
213 //! Drift time (in milliseconds) at which this mass spectrum was acquired.
214 pappso_double m_dt = -1;
215
216 //! Index of the spectrum of the precusor ion that was fragmented to yield
217 // this mass spectrum.
218 std::size_t m_precursorSpectrumIndex =
219 std::numeric_limits<std::size_t>::max();
220
221 //! Native XML id of the spectrum relative to the mz data native file
223
224 //! vector of precursor ion data of the precursors that were fragmented to
225 //! yield this mass spectrum.
226 std::vector<PrecursorIonData> m_precursorIonData;
227
228 //! map containing any parameter value for this spectrum
229 std::map<QualifiedMassSpectrumParameter, QVariant> m_paramsMap;
230};
231
232
233} // namespace pappso
Class representing a fully specified mass spectrum.
std::vector< PrecursorIonData > m_precursorIonData
std::map< QualifiedMassSpectrumParameter, QVariant > m_paramsMap
map containing any parameter value for this spectrum
QString m_precursorNativeId
Native XML id of the spectrum relative to the mz data native file.
MassSpectrumId m_massSpectrumId
Id of the mass spectrum.
#define PMSPP_LIB_DECL
basic mass spectrum
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
double pappso_double
A type definition for doubles.
Definition types.h:50
std::shared_ptr< const QualifiedMassSpectrum > QualifiedMassSpectrumCstSPtr
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
@ IsolationMzWidth
m/z isolation window width (left + right)
@ TimsIonMobScanOneOverK0
1/kO of a simple scan
@ TimsFrameMzIndexBegin
Bruker's timsTOF mz index frame start range.
@ CollisionEnergy
Bruker's timsTOF collision energy.
@ TimsFrameScansCount
Bruker's timsTOF frame's total ion mobility slots.
@ TimsFrameMzIndexEnd
Bruker's timsTOF mz index frame end range.
@ BrukerPrecursorIndex
Bruker's timsTOF precursor index.
@ rt
Retention time.
unsigned int uint
Definition types.h:57
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
PrecursorIonData(double mz_value=0, int charge_value=0, double intensity_value=0)