libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptidefragmentionlistbase.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/peptide/peptidefragmentionlistbase.cpp
3 * \date 10/3/2015
4 * \author Olivier Langella
5 * \brief fragmentation base object
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Contributors:
27 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
32
33#include <QDebug>
34#include <memory>
36
37namespace pappso
38{
39
40std::list<Enums::PeptideIon>
42{
43 IonList ret;
44 // populate ret
45
46 ret.push_back(Enums::PeptideIon::y);
47 ret.push_back(Enums::PeptideIon::yp);
48 ret.push_back(Enums::PeptideIon::ystar);
49 ret.push_back(Enums::PeptideIon::yo);
50 ret.push_back(Enums::PeptideIon::b);
51 ret.push_back(Enums::PeptideIon::bp);
52 ret.push_back(Enums::PeptideIon::a);
53 ret.push_back(Enums::PeptideIon::bstar);
54 ret.push_back(Enums::PeptideIon::bo);
55 return ret;
56}
57
58std::list<Enums::PeptideIon>
60{
61 IonList ret;
62 // populate ret
63
64 ret.push_back(Enums::PeptideIon::y);
65 ret.push_back(Enums::PeptideIon::c);
66 ret.push_back(Enums::PeptideIon::z);
67 ret.push_back(Enums::PeptideIon::ystar);
68 ret.push_back(Enums::PeptideIon::yo);
69 return ret;
70}
71
72const std::list<Enums::PeptideIon> &
77
79 const IonList &ions)
80 : msp_peptide(peptide), m_ionList(ions)
81{
82 try
83 {
84 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase begin " << ions.size();
85 std::list<PeptideFragmentSp> fragment_list =
87
89 AaModificationP phosphorylation_mod = nullptr;
90
91
92 qDebug();
93 for(auto &&fragment_sp : fragment_list)
94 {
95 // qDebug()<< "PeptideFragmentIonListBase::PeptideFragmentIonListBase
96 // ition";
97 if(fragment_sp.get()->getPeptideIonDirection() == PeptideDirection::Cter)
98 {
99 for(auto &&ion_type : m_ionList)
100 {
101 // qDebug()<<
102 // "PeptideFragmentIonListBase::PeptideFragmentIonListBase
103 // ition";
104 if((ion_type == Enums::PeptideIon::y) || (ion_type == Enums::PeptideIon::ystar) ||
105 (ion_type == Enums::PeptideIon::yo) || (ion_type == Enums::PeptideIon::z))
106 {
108 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type));
109 }
110 else if(ion_type == Enums::PeptideIon::yp)
111 {
112 if(phosphorylation_mod == nullptr)
113 {
114 phosphorylation_mod = AaModification::getInstance("MOD:00696");
116 peptide.get()->getNumberOfModification(phosphorylation_mod);
117 }
118 for(unsigned int i = 0; i < m_phosphorylationNumber; i++)
119 {
121 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type, i + 1));
122 }
123 }
124 }
125 }
126 else
127 {
128 for(auto &&ion_type : m_ionList)
129 {
130 // b, bstar, bo, a
131 if((ion_type == Enums::PeptideIon::b) || (ion_type == Enums::PeptideIon::bstar) ||
132 (ion_type == Enums::PeptideIon::bo) || (ion_type == Enums::PeptideIon::a) ||
133 (ion_type == Enums::PeptideIon::c))
134 {
136 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type));
137 }
138 else if(ion_type == Enums::PeptideIon::bp)
139 {
140 if(phosphorylation_mod == nullptr)
141 {
142 phosphorylation_mod = AaModification::getInstance("MOD:00696");
144 peptide.get()->getNumberOfModification(phosphorylation_mod);
145 }
146 for(unsigned int i = 0; i < m_phosphorylationNumber; i++)
147 {
149 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type, i + 1));
150 }
151 }
152 }
153 }
154 }
155 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase end " << ions.size();
156 }
157 catch(PappsoException &exception_pappso)
158 {
159 QString errorStr =
160 QObject::tr("ERROR building PeptideFragmentIonListBase, PAPPSO exception:\n%1")
161 .arg(exception_pappso.qwhat());
162 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase "
163 "PappsoException :\n"
164 << errorStr;
165 throw PappsoException(errorStr);
166 }
167 catch(std::exception &exception_std)
168 {
169 QString errorStr =
170 QObject::tr("ERROR building PeptideFragmentIonListBase, std exception:\n%1")
171 .arg(exception_std.what());
172 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase "
173 "std::exception :\n"
174 << errorStr;
175 throw PappsoException(errorStr);
176 }
177}
178
186
187
190{
191 return std::make_shared<const PeptideFragmentIonListBase>(*this);
192}
193
194
198
199const std::list<PeptideFragmentSp>
201{
202
203 qDebug();
204 std::list<PeptideFragmentSp> peptide_fragment_list;
205
206 if(peptide.get()->size() < 1)
207 {
208 return peptide_fragment_list;
209 }
210
211 unsigned int max = peptide.get()->size() - 1;
212
213 for(unsigned int i = 0; i < max; i++)
214 {
215
216 peptide_fragment_list.push_back(
217 std::make_shared<PeptideFragment>(peptide, PeptideDirection::Nter, i + 1));
218 peptide_fragment_list.push_back(
219 std::make_shared<PeptideFragment>(peptide, PeptideDirection::Cter, i + 1));
220 }
221 qDebug();
222 return peptide_fragment_list;
223}
224
225const std::list<PeptideFragmentIonSp>
227{
228 std::list<PeptideFragmentIonSp> ion_list;
229 for(auto &&peptide_fragment_ion_sp : msp_peptide_fragment_ion_list)
230 {
231 if(peptide_fragment_ion_sp.get()->getPeptideIonType() == ion_type)
232 {
233 ion_list.push_back(peptide_fragment_ion_sp);
234 }
235 }
236 return (ion_list);
237}
238
241 unsigned int size) const
242{
243
244 return getPeptideFragmentIonSp(ion_type, size, 0);
245}
246
249 Enums::PeptideIon ion_type, unsigned int size, unsigned int number_of_neutral_phospho_loss) const
250{
251 for(auto &&peptide_fragment_ion_sp : msp_peptide_fragment_ion_list)
252 {
253 if(peptide_fragment_ion_sp.get()->getPeptideIonType() == ion_type)
254 {
255 if(peptide_fragment_ion_sp.get()->size() == size)
256 {
257 if(peptide_fragment_ion_sp.get()->getNumberOfNeutralPhosphoLoss() ==
258 number_of_neutral_phospho_loss)
259 {
260 return (peptide_fragment_ion_sp);
261 }
262 }
263 }
264 }
265
266 throw PappsoException(QString("PeptideFragmentIon %1 of size %2 not found")
268 .arg(size));
269}
270
271} // namespace pappso
272
273std::size_t
278
279const std::list<pappso::PeptideFragmentIonSp> &
284
285const pappso::PeptideSp &
290
291unsigned int
296
297std::list<pappso::PeptideFragmentIonSp>::const_iterator
302
303std::list<pappso::PeptideFragmentIonSp>::const_iterator
static AaModificationP getInstance(const QString &accession)
virtual const QString & qwhat() const
std::list< PeptideFragmentIonSp > msp_peptide_fragment_ion_list
const std::list< PeptideFragmentIonSp > getPeptideFragmentIonSp(Enums::PeptideIon ion_type) const
PeptideFragmentIonListBaseSp makePeptideFragmentIonListBaseSp() const
static std::list< Enums::PeptideIon > getETDionList()
const std::list< Enums::PeptideIon > & getIonList() const
virtual const PeptideSp & getPeptideSp() const
PeptideFragmentIonListBase(const PeptideSp &peptide, const IonList &ions)
std::list< PeptideFragmentIonSp >::const_iterator end() const
static const std::list< PeptideFragmentSp > getPeptideFragmentList(const PeptideSp &peptide)
static std::list< Enums::PeptideIon > getCIDionList()
std::list< PeptideFragmentIonSp >::const_iterator begin() const
const std::list< PeptideFragmentIonSp > & getPeptideFragmentIonList() const
const QString getPeptideIonName() const
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
@ a
Nter aldimine ions.
Definition types.h:290
@ y
Cter amino ions.
Definition types.h:295
@ c
Nter amino ions.
Definition types.h:294
@ ystar
Cter amino ions + NH3 loss.
Definition types.h:296
@ yo
Cter amino ions + H2O loss.
Definition types.h:297
@ bstar
Nter acylium ions + NH3 loss.
Definition types.h:288
@ b
Nter acylium ions.
Definition types.h:287
@ bo
Nter acylium ions + H2O loss.
Definition types.h:289
@ z
Cter carbocations.
Definition types.h:298
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const PeptideFragmentIon > PeptideFragmentIonSp
std::shared_ptr< const Peptide > PeptideSp
const AaModification * AaModificationP
std::shared_ptr< const PeptideFragmentIonListBase > PeptideFragmentIonListBaseSp