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 IonMobOneOverK0, ///< 1/kO value
51 IonMobOneOverK0Begin, ///< 1/K0 range's begin value
52 IonMobOneOverK0End, ///< 1/K0 range's end value
53
57
58 IsolationMz, ///< Isolation m/z value
59 IsolationMzWidth, ///< m/z isolation window width (left + right)
60
61 CollisionEnergy, ///< Bruker's timsTOF collision energy
62 BrukerPrecursorIndex, ///< Bruker's timsTOF precursor index
63 TimsFrameScansCount, ///< Bruker's timsTOF frame's total ion mobility slots
64
65 TimsFrameMzIndexBegin, ///< Bruker's timsTOF mz index frame start range
66 TimsFrameMzIndexEnd, ///< Bruker's timsTOF mz index frame end range
67
68 ScanNumber, ///< Scan number: Ordinal number of the scan indicating its order
69 ///< of acquisition within a mass spectrometry acquisition run.
70 ///< MS_scan_number = 1003057,
71 last
72};
73
75{
76 double mz = 0;
77 int charge = 0;
78 double intensity = 0;
79
80 // Constructor
81 PrecursorIonData(double mz_value = 0,
82 int charge_value = 0,
83 double intensity_value = 0)
84 {
85 mz = mz_value;
86 charge = charge_value;
87 intensity = intensity_value;
88 };
89};
90
91
92//! Class representing a fully specified mass spectrum.
93/*!
94 * The member data that qualify the MassSpectrum \c msp_massSpectrum member
95 * allow to unambiguously characterize the mass spectrum.
96 * \sa MassSpectrum
97 */
99{
100 public:
103 QualifiedMassSpectrum(MassSpectrumSPtr mass_spectrum_SPtr);
106
107 QualifiedMassSpectrum &operator=(const QualifiedMassSpectrum &other);
108
109 /** @brief clone the mass spectrum contained in Qualified Mass Spectrum
110 */
111 const QualifiedMassSpectrum &cloneMassSpectrumSPtr();
112
113 QualifiedMassSpectrumSPtr makeQualifiedMassSpectrumSPtr() const;
114 QualifiedMassSpectrumCstSPtr makeQualifiedMassSpectrumCstSPtr() const;
115
116 void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum);
117 MassSpectrumSPtr getMassSpectrumSPtr() const;
118 MassSpectrumCstSPtr getMassSpectrumCstSPtr() const;
119
120 void setMassSpectrumId(const MassSpectrumId &iD);
121 const MassSpectrumId &getMassSpectrumId() const;
122 MassSpectrumId &getMassSpectrumId();
123
124 void setEmptyMassSpectrum(bool is_empty_mass_spectrum);
125 bool isEmptyMassSpectrum() const;
126
127 void setMsLevel(uint ms_level);
128 uint getMsLevel() const;
129
130 void setRtInSeconds(pappso_double rt);
131 pappso_double getRtInSeconds() const;
132 pappso_double getRtInMinutes() const;
133
134 void setDtInMilliSeconds(pappso_double rt);
135 pappso_double getDtInMilliSeconds() const;
136
137 /** @brief get precursor mz
138 * @param ok pointer on boolean, false if precursor mz is not defined
139 * @return precursor mz
140 */
141 pappso_double getPrecursorMz(bool *ok = nullptr) const;
142
143 /** @brief get precursor mass given the charge stats and precursor mz
144 * @param ok pointer on boolean, false if precursor mz is not defined
145 * @return precursor mass (neutral mass without H+)
146 */
147 double getPrecursorMass(bool *ok_p = nullptr) const;
148
149 QString getPrecursorDataMzValuesAsString(
150 const std::vector<PrecursorIonData> &precursor_ion_data_vector,
151 const QString &separator = "\n") const;
152 QString
153 getPrecursorDataMzValuesAsString(const QString &separator = "\n") const;
154 QString getMzSortedPrecursorDataMzValuesAsString(
155 const QString &separator = "\n") const;
156
157 /** @brief get precursor charge
158 * @param ok pointer on boolean, false if precursor charge is not defined
159 * @return precursor charge
160 */
161 uint getPrecursorCharge(bool *ok = nullptr) const;
162 QString getPrecursorDataChargeValuesAsString(
163 const std::vector<PrecursorIonData> &precursor_ion_data_vector,
164 const QString &separator = "\n") const;
165 QString
166 getPrecursorDataChargeValuesAsString(const QString &separator = "\n") const;
167 QString getMzSortedPrecursorDataChargeValuesAsString(
168 const QString &separator = "\n") const;
169
170
171 /** @brief get precursor intensity
172 * @param ok pointer on boolean, false if precursor intensity is not defined
173 * @return precursor intensity
174 */
175 pappso_double getPrecursorIntensity(bool *ok = nullptr) const;
176
177 void setPrecursorSpectrumIndex(std::size_t precursor_scan_num);
178 std::size_t getPrecursorSpectrumIndex() const;
179
180 void setPrecursorNativeId(const QString &native_id);
181 const QString &getPrecursorNativeId() const;
182
183 void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data);
184 const std::vector<PrecursorIonData> &getPrecursorIonData() const;
185 std::vector<PrecursorIonData> getPrecursorIonDataSortedWithMz() const;
186
187 void setParameterValue(QualifiedMassSpectrumParameter parameter,
188 const QVariant &value);
189 const QVariant
190 getParameterValue(QualifiedMassSpectrumParameter parameter) const;
191
192 std::size_t size() const;
193
194 QString toString(bool with_data = false) const;
195
196 protected:
197 //! Shared pointer to the mass spectrum.
198 MassSpectrumSPtr msp_massSpectrum = nullptr;
199
200 //! Id of the mass spectrum.
202
203 bool m_isEmptyMassSpectrum = false;
204
205 //! Mass spectrometry level of this mass spectrum.
206 unsigned int m_msLevel = 0;
207
208 //! Retention time (in seconds) at which this mass spectrum was acquired.
209 pappso_double m_rt = -1;
210
211 //! Drift time (in milliseconds) at which this mass spectrum was acquired.
212 pappso_double m_dt = -1;
213
214 //! Index of the spectrum of the precusor ion that was fragmented to yield
215 // this mass spectrum.
216 std::size_t m_precursorSpectrumIndex =
217 std::numeric_limits<std::size_t>::max();
218
219 //! Native XML id of the spectrum relative to the mz data native file
221
222 //! vector of precursor ion data of the precursors that were fragmented to
223 //! yield this mass spectrum.
224 std::vector<PrecursorIonData> m_precursorIonData;
225
226 //! map containing any parameter value for this spectrum
227 std::map<QualifiedMassSpectrumParameter, QVariant> m_paramsMap;
228};
229
230
231} // 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)
@ TimsFrameMzIndexBegin
Bruker's timsTOF mz index frame start range.
@ CollisionEnergy
Bruker's timsTOF collision energy.
@ IonMobOneOverK0Begin
1/K0 range's begin value
@ IonMobOneOverK0End
1/K0 range's end value
@ 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)