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 for(auto &&fragment_sp : fragment_list)
93 {
94 // qDebug()<< "PeptideFragmentIonListBase::PeptideFragmentIonListBase
95 // ition";
96 if(fragment_sp.get()->getPeptideIonDirection() == PeptideDirection::Cter)
97 {
98 for(auto &&ion_type : m_ionList)
99 {
100 // qDebug()<<
101 // "PeptideFragmentIonListBase::PeptideFragmentIonListBase
102 // ition";
103 if((ion_type == Enums::PeptideIon::y) || (ion_type == Enums::PeptideIon::ystar) ||
104 (ion_type == Enums::PeptideIon::yo) || (ion_type == Enums::PeptideIon::z))
105 {
107 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type));
108 }
109 else if(ion_type == Enums::PeptideIon::yp)
110 {
111 if(phosphorylation_mod == nullptr)
112 {
113 phosphorylation_mod = AaModification::getInstance("MOD:00696");
115 peptide.get()->getNumberOfModification(phosphorylation_mod);
116 }
117 for(unsigned int i = 0; i < m_phosphorylationNumber; i++)
118 {
120 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type, i + 1));
121 }
122 }
123 }
124 }
125 else
126 {
127 for(auto &&ion_type : m_ionList)
128 {
129 // b, bstar, bo, a
130 if((ion_type == Enums::PeptideIon::b) || (ion_type == Enums::PeptideIon::bstar) ||
131 (ion_type == Enums::PeptideIon::bo) || (ion_type == Enums::PeptideIon::a) ||
132 (ion_type == Enums::PeptideIon::c))
133 {
135 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type));
136 }
137 else if(ion_type == Enums::PeptideIon::bp)
138 {
139 if(phosphorylation_mod == nullptr)
140 {
141 phosphorylation_mod = AaModification::getInstance("MOD:00696");
143 peptide.get()->getNumberOfModification(phosphorylation_mod);
144 }
145 for(unsigned int i = 0; i < m_phosphorylationNumber; i++)
146 {
148 std::make_shared<PeptideFragmentIon>(fragment_sp, ion_type, i + 1));
149 }
150 }
151 }
152 }
153 }
154 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase end " << ions.size();
155 }
156 catch(PappsoException &exception_pappso)
157 {
158 QString errorStr =
159 QObject::tr("ERROR building PeptideFragmentIonListBase, PAPPSO exception:\n%1")
160 .arg(exception_pappso.qwhat());
161 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase "
162 "PappsoException :\n"
163 << errorStr;
164 throw PappsoException(errorStr);
165 }
166 catch(std::exception &exception_std)
167 {
168 QString errorStr =
169 QObject::tr("ERROR building PeptideFragmentIonListBase, std exception:\n%1")
170 .arg(exception_std.what());
171 qDebug() << "PeptideFragmentIonListBase::PeptideFragmentIonListBase "
172 "std::exception :\n"
173 << errorStr;
174 throw PappsoException(errorStr);
175 }
176}
177
185
186
189{
190 return std::make_shared<const PeptideFragmentIonListBase>(*this);
191}
192
193
197
198const std::list<PeptideFragmentSp>
200{
201 std::list<PeptideFragmentSp> peptide_fragment_list;
202
203 unsigned int max = peptide.get()->size() - 1;
204 for(unsigned int i = 0; i < max; i++)
205 {
206
207 peptide_fragment_list.push_back(
208 std::make_shared<PeptideFragment>(peptide, PeptideDirection::Nter, i + 1));
209 peptide_fragment_list.push_back(
210 std::make_shared<PeptideFragment>(peptide, PeptideDirection::Cter, i + 1));
211 }
212 return peptide_fragment_list;
213}
214
215const std::list<PeptideFragmentIonSp>
217{
218 std::list<PeptideFragmentIonSp> ion_list;
219 for(auto &&peptide_fragment_ion_sp : msp_peptide_fragment_ion_list)
220 {
221 if(peptide_fragment_ion_sp.get()->getPeptideIonType() == ion_type)
222 {
223 ion_list.push_back(peptide_fragment_ion_sp);
224 }
225 }
226 return (ion_list);
227}
228
231{
232
233 return getPeptideFragmentIonSp(ion_type, size, 0);
234}
235
238 Enums::PeptideIon ion_type, unsigned int size, unsigned int number_of_neutral_phospho_loss) const
239{
240 for(auto &&peptide_fragment_ion_sp : msp_peptide_fragment_ion_list)
241 {
242 if(peptide_fragment_ion_sp.get()->getPeptideIonType() == ion_type)
243 {
244 if(peptide_fragment_ion_sp.get()->size() == size)
245 {
246 if(peptide_fragment_ion_sp.get()->getNumberOfNeutralPhosphoLoss() ==
247 number_of_neutral_phospho_loss)
248 {
249 return (peptide_fragment_ion_sp);
250 }
251 }
252 }
253 }
254
255 throw PappsoException(QString("PeptideFragmentIon %1 of size %2 not found")
257 .arg(size));
258}
259
260} // namespace pappso
261
262std::size_t
267
268const std::list<pappso::PeptideFragmentIonSp> &
273
274const pappso::PeptideSp &
279
280unsigned int
285
286std::list<pappso::PeptideFragmentIonSp>::const_iterator
291
292std::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