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)PeptideIon::b] = 0,
40 [(std::int8_t)PeptideIon::bstar] = -MASSNH3,
41 [(std::int8_t)PeptideIon::bo] = -MASSH2O,
42 [(std::int8_t)PeptideIon::a] = -MASSCO,
43 [(std::int8_t)PeptideIon::astar] = -MASSCO - MASSNH3,
44 [(std::int8_t)PeptideIon::ao] = -MASSCO - MASSH2O,
45 [(std::int8_t)PeptideIon::bp] = -1,
46 [(std::int8_t)PeptideIon::c] = MASSNH3,
47 [(std::int8_t)PeptideIon::y] = MASSH2O,
48 [(std::int8_t)PeptideIon::ystar] = MASSH2O - MASSNH3,
49 [(std::int8_t)PeptideIon::yo] = 0,
50 [(std::int8_t)PeptideIon::z] = MASSOXYGEN - MASSNITROGEN - MPROTIUM,
51 [(std::int8_t)PeptideIon::yp] = -1,
52 [(std::int8_t)PeptideIon::x] = MASSCO + MASSOXYGEN};
53
54
57{
58 return m_ionDeltaMz[(std::int8_t)ion_type];
59}
60
61
64{
65
66 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
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 pappso_double nter_internal =
74 pappso_double cter_internal =
76 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
77 pappso_double cumulative_mass = it->getMass() - nter_internal;
78 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
79 m_cumulativeNterMasses.push_back(cumulative_mass);
80 it++;
81
82 if(it != end)
83 {
84 end--;
85 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
86 while(it != end)
87 {
88
89 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
90 << " cumulative_mass=" << cumulative_mass;
91 cumulative_mass += it->getMass();
93 (it->getLetter() == 'P'))
94 {
95 }
96 else
97 {
98 m_cumulativeNterMasses.push_back(cumulative_mass);
99 }
100 it++;
101 }
102 }
103
104 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
105 std::vector<Aa>::const_reverse_iterator rit(peptide.rbegin());
106 std::vector<Aa>::const_reverse_iterator ritf(peptide.rbegin());
107 std::vector<Aa>::const_reverse_iterator rend(peptide.rend());
108 ritf++;
109 cumulative_mass = rit->getMass() - cter_internal;
110 if((mode == RawFragmentationMode::proline_effect) && (ritf != rend) &&
111 (ritf->getLetter() == 'P'))
112 {
113 }
114 else
115 {
116 m_cumulativeCterMasses.push_back(cumulative_mass);
117 }
118 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
119
120 rit++;
121 ritf++;
122 if(rit != rend)
123 {
124 rend--;
125 while(rit != rend)
126 {
127 cumulative_mass += rit->getMass();
129 (ritf != peptide.rend()) && (ritf->getLetter() == 'P'))
130 {
131 }
132 else
133 {
134 m_cumulativeCterMasses.push_back(cumulative_mass);
135 }
136 rit++;
137 ritf++;
138 }
139 }
140
141 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
142}
143
144void
146 std::vector<pappso_double> &mass_list, PeptideIon ion_type) const
147{
148 const std::vector<pappso_double> *p_mass_list = &m_cumulativeCterMasses;
149
150 if(peptideIonIsNter(ion_type))
151 {
152 // nter
153 p_mass_list = &m_cumulativeNterMasses;
154 }
155
156 for(pappso_double mass : *p_mass_list)
157 {
158 mass_list.push_back(mass + m_ionDeltaMz[(std::int8_t)ion_type]);
159 }
160}
161
162void
163PeptideRawFragmentMasses::pushBackIonMz(std::vector<pappso_double> &mass_list,
164 PeptideIon ion_type,
165 unsigned int charge) const
166{
167 const std::vector<pappso_double> *p_mass_list = &m_cumulativeCterMasses;
168
169 if(peptideIonIsNter(ion_type))
170 {
171 // nter
172 p_mass_list = &m_cumulativeNterMasses;
173 }
174
175 for(pappso_double mass : *p_mass_list)
176 {
177 mass_list.push_back(
178 (mass + m_ionDeltaMz[(std::int8_t)ion_type] + (MHPLUS * charge)) /
179 charge);
180 }
181}
182
183void
185 std::vector<SimplePeakIonMatch> &peak_match_list,
186 const MassSpectrum &spectrum,
187 PrecisionPtr precision,
188 PeptideIon ion_type,
189 unsigned int charge) const
190{
191 std::vector<pappso_double> mass_list;
192 pushBackIonMz(mass_list, ion_type, charge);
193
194 // no need to sort
195 // std::sort(mass_list.begin(), mass_list.end());
196
197 std::vector<pappso_double>::iterator it_mz = mass_list.begin();
198 std::vector<pappso_double>::iterator it_mz_end = mass_list.end();
199
200 // scan products over each peak in spectrum :
201 std::vector<DataPoint>::const_iterator it_peak = spectrum.begin();
202 std::vector<DataPoint>::const_iterator it_peak_end = spectrum.end();
203 unsigned int ion_size = 1;
204 while((it_peak != it_peak_end) && (it_mz != it_mz_end))
205 {
206 MzRange massrange(it_peak->x, precision);
207 if((*it_mz) > massrange.upper())
208 {
209 it_peak++;
210 continue;
211 }
212 if((*it_mz) < massrange.lower())
213 {
214 it_mz++;
215 ion_size++;
216 continue;
217 }
218 peak_match_list.push_back(
219 {(*it_peak), ion_type, ion_size, charge, (*it_mz)});
220 it_mz++;
221 ion_size++;
222 }
223}
224
228} // 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
static pappso_double getDeltaMass(PeptideIon ion_type)
void pushBackMatchSpectrum(std::vector< SimplePeakIonMatch > &peak_match_list, const MassSpectrum &spectrum, PrecisionPtr precision, 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, PeptideIon ion_type, unsigned int charge) const
void pushBackIonMasses(std::vector< pappso_double > &mass_list, PeptideIon ion_type) const
AaModificationP getInternalNterModification() const
Definition peptide.cpp:467
std::vector< Aa >::const_reverse_iterator rend() const
Definition peptide.cpp:168
std::vector< Aa >::const_reverse_iterator rbegin() const
Definition peptide.cpp:162
AaModificationP getInternalCterModification() const
Definition peptide.cpp:478
std::vector< Aa >::iterator begin()
Definition peptide.cpp:138
std::vector< Aa >::iterator end()
Definition peptide.cpp:144
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:425
@ 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.
const pappso_double MASSCO(MASSCARBON+MASSOXYGEN)
const pappso_double MHPLUS(1.007276466879)
double pappso_double
A type definition for doubles.
Definition types.h:50
const pappso_double MPROTIUM(1.007825032241)
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)
const pappso_double MASSNH3((MPROTIUM *3)+MASSNITROGEN)
const pappso_double MASSNITROGEN(14.0030740048)
const pappso_double MASSOXYGEN(15.99491461956)
bool peptideIonIsNter(PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:60
class dedicated to raw mass computations of peptide products (fragments)