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