libpappsomspp
Library for mass spectrometry
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 last
59};
60
62{
63 double mz = 0;
64 int charge = 0;
65 double intensity = 0;
66
67 PrecursorIonData(double mz_value = 0,
68 int charge_value = 0,
69 double intensity_value = 0)
70 {
71 mz = mz_value;
72 charge = charge_value;
73 intensity = intensity_value;
74 };
75};
76
77
78//! Class representing a fully specified mass spectrum.
79/*!
80 * The member data that qualify the MassSpectrum \c msp_massSpectrum member
81 * allow to unambiguously characterize the mass spectrum.
82 * \sa MassSpectrum
83 */
85{
86 public:
89 QualifiedMassSpectrum(MassSpectrumSPtr mass_spectrum_SPtr);
92
93 QualifiedMassSpectrum &operator=(const QualifiedMassSpectrum &other);
94
95 /** @brief clone the mass spectrum contained in Qualified Mass Spectrum
96 */
97 const QualifiedMassSpectrum &cloneMassSpectrumSPtr();
98
99 QualifiedMassSpectrumSPtr makeQualifiedMassSpectrumSPtr() const;
100 QualifiedMassSpectrumCstSPtr makeQualifiedMassSpectrumCstSPtr() const;
101
102 void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum);
103 MassSpectrumSPtr getMassSpectrumSPtr() const;
104 MassSpectrumCstSPtr getMassSpectrumCstSPtr() const;
105
106 void setMassSpectrumId(const MassSpectrumId &iD);
107 const MassSpectrumId &getMassSpectrumId() const;
108
109 void setEmptyMassSpectrum(bool is_empty_mass_spectrum);
110 bool isEmptyMassSpectrum() const;
111
112 void setMsLevel(uint ms_level);
113 uint getMsLevel() const;
114
115 void setRtInSeconds(pappso_double rt);
116 pappso_double getRtInSeconds() const;
117 pappso_double getRtInMinutes() const;
118
119 void setDtInMilliSeconds(pappso_double rt);
120 pappso_double getDtInMilliSeconds() const;
121
122 pappso_double getPrecursorMz(bool *ok = nullptr) const;
123 QString getPrecursorDataMzValuesAsString(
124 const std::vector<PrecursorIonData> &precursor_ion_data_vector,
125 const QString &separator = "\n") const;
126 QString
127 getPrecursorDataMzValuesAsString(const QString &separator = "\n") const;
128 QString getMzSortedPrecursorDataMzValuesAsString(
129 const QString &separator = "\n") const;
130
131 uint getPrecursorCharge(bool *ok = nullptr) const;
132 QString getPrecursorDataChargeValuesAsString(
133 const std::vector<PrecursorIonData> &precursor_ion_data_vector,
134 const QString &separator = "\n") const;
135 QString
136 getPrecursorDataChargeValuesAsString(const QString &separator = "\n") const;
137 QString getMzSortedPrecursorDataChargeValuesAsString(
138 const QString &separator = "\n") const;
139
140 pappso_double getPrecursorIntensity(bool *ok = nullptr) const;
141
142 void setPrecursorSpectrumIndex(std::size_t precursor_scan_num);
143 std::size_t getPrecursorSpectrumIndex() const;
144
145 void setPrecursorNativeId(const QString &native_id);
146 const QString &getPrecursorNativeId() const;
147
148 void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data);
149 const std::vector<PrecursorIonData> &getPrecursorIonData() const;
150 std::vector<PrecursorIonData> getPrecursorIonDataSortedWithMz() const;
151
152 void setParameterValue(QualifiedMassSpectrumParameter parameter,
153 const QVariant &value);
154 const QVariant
155 getParameterValue(QualifiedMassSpectrumParameter parameter) const;
156
157 std::size_t size() const;
158
159 QString toString() const;
160
161 protected:
162 //! Shared pointer to the mass spectrum.
163 MassSpectrumSPtr msp_massSpectrum = nullptr;
164
165 //! Id of the mass spectrum.
167
168 bool m_isEmptyMassSpectrum = false;
169
170 //! Mass spectrometry level of this mass spectrum.
171 unsigned int m_msLevel = 0;
172
173 //! Retention time (in seconds) at which this mass spectrum was acquired.
174 pappso_double m_rt = -1;
175
176 //! Drift time (in milliseconds) at which this mass spectrum was acquired.
177 pappso_double m_dt = -1;
178
179 //! Index of the spectrum of the precusor ion that was fragmented to yield
180 // this mass spectrum.
181 std::size_t m_precursorSpectrumIndex =
182 std::numeric_limits<std::size_t>::max();
183
184 //! Native XML id of the spectrum relative to the mz data native file
186
187 //! vector of precursor ion data of the precursors that were fragmented to
188 //! yield this mass spectrum.
189
190 std::vector<PrecursorIonData> m_precursorIonData;
191
192 //! map containing any parameter value for this spectrum
193 std::map<QualifiedMassSpectrumParameter, QVariant> m_paramsMap;
194};
195
196
197} // 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:48
std::shared_ptr< const QualifiedMassSpectrum > QualifiedMassSpectrumCstSPtr
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
Definition: massspectrum.h:55
@ CollisionEnergy
Bruker's Tims tof collision energy.
@ OneOverK0end
1/k0 of last acquisition for composite pasef MS/MS spectrum
@ IsolationWidth
isolation window width
@ BrukerPrecursorIndex
Bruker's Tims tof precursor index.
@ rt
Retention time.
unsigned int uint
Definition: types.h:55
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition: massspectrum.h:54
PrecursorIonData(double mz_value=0, int charge_value=0, double intensity_value=0)