libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptiderawfragmentmasses.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/peptide/peptiderawfragmentmasses.cpp
3 * \date 16/7/2016
4 * \author Olivier Langella
5 * \brief class dedicated to raw mass computations of peptide products
6 * (fragments)
7 */
8
9/*******************************************************************************
10 * Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
11 *
12 * This file is part of the PAPPSOms++ library.
13 *
14 * PAPPSOms++ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms++ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * Contributors:
28 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
29 *implementation
30 ******************************************************************************/
31
33namespace pappso
34{
35
36
39 [(std::int8_t)Enums::PeptideIon::b] = 0,
40 [(std::int8_t)Enums::PeptideIon::bstar] = -MASSNH3,
41 [(std::int8_t)Enums::PeptideIon::bo] = -MASSH2O,
42 [(std::int8_t)Enums::PeptideIon::a] = -MASSCO,
43 [(std::int8_t)Enums::PeptideIon::astar] = -MASSCO - MASSNH3,
44 [(std::int8_t)Enums::PeptideIon::ao] = -MASSCO - MASSH2O,
45 [(std::int8_t)Enums::PeptideIon::bp] = -1,
46 [(std::int8_t)Enums::PeptideIon::c] = MASSNH3,
47 [(std::int8_t)Enums::PeptideIon::y] = MASSH2O,
48 [(std::int8_t)Enums::PeptideIon::ystar] = MASSH2O - MASSNH3,
49 [(std::int8_t)Enums::PeptideIon::yo] = 0,
51 [(std::int8_t)Enums::PeptideIon::yp] = -1,
52 [(std::int8_t)Enums::PeptideIon::x] = MASSCO + MASSOXYGEN};
53
54
57{
58 return m_ionDeltaMz[(std::int8_t)ion_type];
59}
60
61
64{
65
66 qDebug() ;
67 std::vector<Aa>::const_iterator it(peptide.begin());
68 std::vector<Aa>::const_iterator end(peptide.end());
69 if(it == end)
70 return;
71
72 qDebug() ;
73 pappso_double cumulative_mass = it->getMass();
74 if (peptide.getNterModification() != nullptr) {
75 cumulative_mass += peptide.getNterModification()->getMass();
76 }
77 qDebug() ;
78 m_cumulativeNterMasses.push_back(cumulative_mass);
79 it++;
80
81 if(it != end)
82 {
83 end--;
84 qDebug() ;
85 while(it != end)
86 {
87
88 qDebug()
89 << " cumulative_mass=" << cumulative_mass;
90 cumulative_mass += it->getMass();
92 (it->getLetter() == 'P'))
93 {
94 }
95 else
96 {
97 m_cumulativeNterMasses.push_back(cumulative_mass);
98 }
99 it++;
100 }
101 }
102
103 qDebug() ;
104 std::vector<Aa>::const_reverse_iterator rit(peptide.rbegin());
105 std::vector<Aa>::const_reverse_iterator ritf(peptide.rbegin());
106 std::vector<Aa>::const_reverse_iterator rend(peptide.rend());
107 ritf++;
108 cumulative_mass = rit->getMass();
109 if (peptide.getCterModification() != nullptr) {
110 cumulative_mass += peptide.getCterModification()->getMass();
111 }
112 if((mode == RawFragmentationMode::proline_effect) && (ritf != rend) &&
113 (ritf->getLetter() == 'P'))
114 {
115 }
116 else
117 {
118 m_cumulativeCterMasses.push_back(cumulative_mass);
119 }
120 qDebug() ;
121
122 rit++;
123 ritf++;
124 if(rit != rend)
125 {
126 rend--;
127 while(rit != rend)
128 {
129 cumulative_mass += rit->getMass();
131 (ritf != peptide.rend()) && (ritf->getLetter() == 'P'))
132 {
133 }
134 else
135 {
136 m_cumulativeCterMasses.push_back(cumulative_mass);
137 }
138 rit++;
139 ritf++;
140 }
141 }
142
143 qDebug() ;
144}
145
146void
148 std::vector<pappso_double> &mass_list, Enums::PeptideIon ion_type) const
149{
150 const std::vector<pappso_double> *p_mass_list = &m_cumulativeCterMasses;
151
152 if(peptideIonIsNter(ion_type))
153 {
154 // nter
155 p_mass_list = &m_cumulativeNterMasses;
156 }
157
158 for(pappso_double mass : *p_mass_list)
159 {
160 mass_list.push_back(mass + m_ionDeltaMz[(std::int8_t)ion_type]);
161 }
162}
163
164void
165PeptideRawFragmentMasses::pushBackIonMz(std::vector<pappso_double> &mass_list,
166 Enums::PeptideIon ion_type,
167 unsigned int charge) const
168{
169 const std::vector<pappso_double> *p_mass_list = &m_cumulativeCterMasses;
170
171 if(peptideIonIsNter(ion_type))
172 {
173 // nter
174 p_mass_list = &m_cumulativeNterMasses;
175 }
176
177 for(pappso_double mass : *p_mass_list)
178 {
179 mass_list.push_back(
180 (mass + m_ionDeltaMz[(std::int8_t)ion_type] + (MHPLUS * charge)) /
181 charge);
182 }
183}
184
185void
187 std::vector<SimplePeakIonMatch> &peak_match_list,
188 const MassSpectrum &spectrum,
189 PrecisionPtr precision,
190 Enums::PeptideIon ion_type,
191 unsigned int charge) const
192{
193 std::vector<pappso_double> mass_list;
194 pushBackIonMz(mass_list, ion_type, charge);
195
196 // no need to sort
197 // std::sort(mass_list.begin(), mass_list.end());
198
199 std::vector<pappso_double>::iterator it_mz = mass_list.begin();
200 std::vector<pappso_double>::iterator it_mz_end = mass_list.end();
201
202 // scan products over each peak in spectrum :
203 std::vector<DataPoint>::const_iterator it_peak = spectrum.begin();
204 std::vector<DataPoint>::const_iterator it_peak_end = spectrum.end();
205 unsigned int ion_size = 1;
206 while((it_peak != it_peak_end) && (it_mz != it_mz_end))
207 {
208 MzRange massrange(it_peak->x, precision);
209 if((*it_mz) > massrange.upper())
210 {
211 it_peak++;
212 continue;
213 }
214 if((*it_mz) < massrange.lower())
215 {
216 it_mz++;
217 ion_size++;
218 continue;
219 }
220 peak_match_list.push_back(
221 {(*it_peak), ion_type, ion_size, charge, (*it_mz)});
222 it_mz++;
223 ion_size++;
224 }
225}
226
230} // namespace pappso
pappso_double getMass() const
Class to represent a mass spectrum.
pappso_double lower() const
Definition mzrange.h:71
pappso_double upper() const
Definition mzrange.h:77
void pushBackIonMasses(std::vector< pappso_double > &mass_list, Enums::PeptideIon ion_type) const
void pushBackMatchSpectrum(std::vector< SimplePeakIonMatch > &peak_match_list, const MassSpectrum &spectrum, PrecisionPtr precision, Enums::PeptideIon ion_type, unsigned int charge) const
PeptideRawFragmentMasses(const Peptide &peptide, RawFragmentationMode mode)
std::vector< pappso_double > m_cumulativeCterMasses
cumulative Cter masses (without internal Cter modification)
std::vector< pappso_double > m_cumulativeNterMasses
cumulative Nter masses (without internal Nter modification)
void pushBackIonMz(std::vector< pappso_double > &mass_list, Enums::PeptideIon ion_type, unsigned int charge) const
static pappso_double getDeltaMass(Enums::PeptideIon ion_type)
AaModificationP getCterModification() const
Definition peptide.cpp:628
std::vector< Aa >::const_reverse_iterator rend() const
Definition peptide.cpp:201
std::vector< Aa >::const_reverse_iterator rbegin() const
Definition peptide.cpp:195
AaModificationP getNterModification() const
Definition peptide.cpp:634
std::vector< Aa >::iterator begin()
Definition peptide.cpp:171
std::vector< Aa >::iterator end()
Definition peptide.cpp:177
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:287
@ a
Nter aldimine ions.
@ y
Cter amino ions.
@ c
Nter amino ions.
@ astar
Nter aldimine ions + NH3 loss.
@ ystar
Cter amino ions + NH3 loss.
@ yo
Cter amino ions + H2O loss.
@ bstar
Nter acylium ions + NH3 loss.
@ b
Nter acylium ions.
@ x
Cter acylium ions.
@ bo
Nter acylium ions + H2O loss.
@ ao
Nter aldimine ions + H2O loss.
@ z
Cter carbocations.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const pappso_double MASSCO(MASSCARBON+MASSOXYGEN)
const pappso_double MHPLUS(1.007276466879)
double pappso_double
A type definition for doubles.
Definition types.h:61
const pappso_double MPROTIUM(1.007825032241)
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:85
const pappso_double MASSNH3((MPROTIUM *3)+MASSNITROGEN)
const pappso_double MASSNITROGEN(14.0030740048)
const pappso_double MASSOXYGEN(15.99491461956)