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