libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::PeptideNaturalIsotopeList Class Reference

#include <peptidenaturalisotopelist.h>

Public Types

typedef std::list< PeptideNaturalIsotopeSp >::const_iterator const_iterator

Public Member Functions

 PeptideNaturalIsotopeList (const PeptideInterfaceSp &peptide, pappso_double minimum_ratio_to_compute=0.001)
 compute the list of possible isotopes for a peptide
 PeptideNaturalIsotopeList (const PeptideNaturalIsotopeList &other)
 ~PeptideNaturalIsotopeList ()
PeptideNaturalIsotopeListSp makePeptideNaturalIsotopeListSp () const
const_iterator begin () const
const_iterator end () const
const std::map< unsigned int, pappso_doublegetIntensityRatioPerIsotopeNumber () const
std::vector< PeptideNaturalIsotopeSpgetByIsotopeNumber (unsigned int isotopeLevel, unsigned int charge) const
std::vector< PeptideNaturalIsotopeAverageSpgetByIntensityRatio (unsigned int charge, PrecisionPtr precision, pappso_double minimum_isotope_pattern_ratio) const
 get the list of natural isotopes representing at least a minimum ratio of the whole isotope pattern
unsigned int size () const
const PeptideInterfaceSpgetPeptideInterfaceSp () const

Private Attributes

const PeptideInterfaceSp msp_peptide
std::list< PeptideNaturalIsotopeSpmsp_peptide_natural_isotope_list

Detailed Description

Definition at line 48 of file peptidenaturalisotopelist.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 67 of file peptidenaturalisotopelist.h.

Constructor & Destructor Documentation

◆ PeptideNaturalIsotopeList() [1/2]

pappso::PeptideNaturalIsotopeList::PeptideNaturalIsotopeList ( const PeptideInterfaceSp & peptide,
pappso_double minimum_ratio_to_compute = 0.001 )

compute the list of possible isotopes for a peptide

Parameters
peptidethe peptide
minimu_ratio_to_computethe limit under which we stop to compute because the ratio is too thin and not informative (default is 0.001). This limit is the same for each atom to survey : CHNOS

Definition at line 38 of file peptidenaturalisotopelist.cpp.

40 : msp_peptide(peptide)
41{
42 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
43 // << minimum_ratio_to_compute;
44 int number_of_fixed_oxygen = msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::O18) +
45 msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::O17);
46 int number_of_fixed_sulfur = msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::S33) +
47 msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::S34) +
48 msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::S36);
49 int number_of_fixed_nitrogen = msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::N15);
50 int number_of_fixed_hydrogen = msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::H2);
51
52 int total_carbon(msp_peptide.get()->getNumberOfAtom(Enums::AtomIsotopeSurvey::C) -
53 msp_peptide.get()->getNumberOfIsotope(Enums::Isotope::C13));
54
55 // qDebug() << "total_carbon " << total_carbon;
56 // qDebug() << "total_sulfur " << total_sulfur;
57 std::map<Enums::Isotope, int> map_isotope;
58 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::C13, 0));
59 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::H2, 0));
60 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::N15, 0));
61 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::O17, 0));
62 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::O18, 0));
63 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::S33, 0));
64 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::S34, 0));
65 map_isotope.insert(std::pair<Enums::Isotope, int>(Enums::Isotope::S36, 0));
66
67 for(int nbc13 = 0; nbc13 <= total_carbon; nbc13++)
68 {
69 map_isotope[Enums::Isotope::C13] = nbc13;
70 PeptideNaturalIsotopeSp pepIsotope =
71 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
72 this->msp_peptide_natural_isotope_list.push_back(pepIsotope);
73 if(pepIsotope.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
74 {
75 break;
76 }
77 }
78 std::list<PeptideNaturalIsotopeSp> temp_list;
79
80 // ******************************************************************
81 // Sulfur isotope list
82 int total_sulfur(msp_peptide.get()->getNumberOfAtom(Enums::AtomIsotopeSurvey::S) -
83 number_of_fixed_sulfur);
84 std::list<PeptideNaturalIsotopeSp>::iterator it = msp_peptide_natural_isotope_list.begin();
85 while(it != msp_peptide_natural_isotope_list.end())
86 {
87 map_isotope = it->get()->getIsotopeMap();
88 for(int nbS34 = 1; nbS34 <= total_sulfur; nbS34++)
89 {
90 map_isotope[Enums::Isotope::S34] = nbS34;
91 PeptideNaturalIsotopeSp pepIsotope =
92 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
93 temp_list.push_back(pepIsotope);
94 if(pepIsotope.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
95 {
96 // qDebug() << "peptide " << pepIsotope.get()->getFormula(1) << "
97 // " << pepIsotope.get()->getIntensityRatio(1); it++;
98 break;
99 }
100 }
101 it++;
102 }
103 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
104
105 // compute S33 abundance
106 temp_list.resize(0);
108 while(it != msp_peptide_natural_isotope_list.end())
109 {
110 // qDebug() << "peptide S33 " << it->get()->getFormula(1) << " "
111 // <<it->get()->getIntensityRatio(1);
112 map_isotope = it->get()->getIsotopeMap();
113 for(int nbS33 = 1; nbS33 <= (total_sulfur - map_isotope[Enums::Isotope::S34]); nbS33++)
114 {
115 map_isotope[Enums::Isotope::S33] = nbS33;
116 PeptideNaturalIsotopeSp pepIsotopeS33 =
117 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
118 temp_list.push_back(pepIsotopeS33);
119 if(pepIsotopeS33.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
120 {
121 // it++;
122 break;
123 }
124 }
125 it++;
126 }
127 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
128
129 // compute S36 abundance
130 temp_list.resize(0);
132 while(it != msp_peptide_natural_isotope_list.end())
133 {
134 map_isotope = it->get()->getIsotopeMap();
135 for(int nbS36 = 1; nbS36 <= (total_sulfur - map_isotope[Enums::Isotope::S34] -
136 map_isotope[Enums::Isotope::S33]);
137 nbS36++)
138 {
139 map_isotope[Enums::Isotope::S36] = nbS36;
140 PeptideNaturalIsotopeSp pepIsotopeS36 =
141 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
142 temp_list.push_back(pepIsotopeS36);
143 if(pepIsotopeS36.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
144 {
145 // it++;
146 break;
147 }
148 }
149 it++;
150 }
151 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
152
153 // ******************************************************************
154
155
156 // ******************************************************************
157 // Hydrogen isotope list
158 temp_list.resize(0);
159 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
160 // total_hydrogen";
161 int total_hydrogen(msp_peptide.get()->getNumberOfAtom(Enums::AtomIsotopeSurvey::H) -
162 number_of_fixed_hydrogen);
164 while(it != msp_peptide_natural_isotope_list.end())
165 {
166 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
167 // getIsotopeMap " << it->getFormula(1) << " " <<
168 // msp_peptide_natural_isotope_list.size();
169 map_isotope = it->get()->getIsotopeMap();
170 for(int nbH2 = 1; nbH2 <= total_hydrogen; nbH2++)
171 {
172 map_isotope[Enums::Isotope::H2] = nbH2;
173 PeptideNaturalIsotopeSp pepIsotope =
174 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
175 temp_list.push_back(pepIsotope);
176 if(pepIsotope.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
177 {
178 // it++;
179 break;
180 }
181 }
182 it++;
183 }
184 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
185 // ******************************************************************
186
187
188 // ******************************************************************
189 // Oxygen isotope list
190 temp_list.resize(0);
191 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
192 // total_oxygen";
193 unsigned int total_oxygen(msp_peptide.get()->getNumberOfAtom(Enums::AtomIsotopeSurvey::O) -
194 number_of_fixed_oxygen);
196 while(it != msp_peptide_natural_isotope_list.end())
197 {
198 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
199 // getIsotopeMap " << it->getFormula(1) << " " <<
200 // msp_peptide_natural_isotope_list.size();
201 map_isotope = it->get()->getIsotopeMap();
202 for(unsigned int nbO18 = 1; nbO18 <= total_oxygen; nbO18++)
203 {
204 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
205 // nbO18 " << nbO18;
206 map_isotope[Enums::Isotope::O18] = nbO18;
207 PeptideNaturalIsotopeSp pepIsotope =
208 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
209 temp_list.push_back(pepIsotope);
210 if(pepIsotope.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
211 {
212 // it++;
213 break;
214 }
215 }
216 it++;
217 }
218 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
219 // ******************************************************************
220
221
222 // ******************************************************************
223 // Nitrogen isotope list
224 temp_list.resize(0);
225 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
226 // total_nitrogen";
227 unsigned int total_nitrogen(msp_peptide.get()->getNumberOfAtom(Enums::AtomIsotopeSurvey::N) -
228 number_of_fixed_nitrogen);
230 while(it != msp_peptide_natural_isotope_list.end())
231 {
232 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
233 // getIsotopeMap " << it->getFormula(1) << " " <<
234 // msp_peptide_natural_isotope_list.size();
235 map_isotope = it->get()->getIsotopeMap();
236 for(unsigned int nbN15 = 1; nbN15 <= total_nitrogen; nbN15++)
237 {
238 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
239 // nbN15 " << nbN15;
240 map_isotope[Enums::Isotope::N15] = nbN15;
241 PeptideNaturalIsotopeSp pepIsotope =
242 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
243 temp_list.push_back(pepIsotope);
244 if(pepIsotope.get()->getIntensityRatio(1) < minimum_ratio_to_compute)
245 {
246 // it++;
247 break;
248 }
249 }
250 it++;
251 }
252 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
253 // ******************************************************************
254
255 // qDebug() << "PeptideNaturalIsotopeList::PeptideNaturalIsotopeList end
256 // size="<<msp_peptide_natural_isotope_list.size();
257}
std::list< PeptideNaturalIsotopeSp > msp_peptide_natural_isotope_list
std::shared_ptr< const PeptideNaturalIsotope > PeptideNaturalIsotopeSp

References pappso::Enums::C, pappso::Enums::C13, pappso::Enums::H2, msp_peptide, pappso::Enums::N15, pappso::Enums::O17, pappso::Enums::O18, pappso::Enums::S33, pappso::Enums::S34, and pappso::Enums::S36.

Referenced by PeptideNaturalIsotopeList().

◆ PeptideNaturalIsotopeList() [2/2]

pappso::PeptideNaturalIsotopeList::PeptideNaturalIsotopeList ( const PeptideNaturalIsotopeList & other)

Definition at line 265 of file peptidenaturalisotopelist.cpp.

266 : msp_peptide(other.msp_peptide),
267 msp_peptide_natural_isotope_list(other.msp_peptide_natural_isotope_list)
268{
269}

References PeptideNaturalIsotopeList(), msp_peptide, and msp_peptide_natural_isotope_list.

◆ ~PeptideNaturalIsotopeList()

pappso::PeptideNaturalIsotopeList::~PeptideNaturalIsotopeList ( )

Definition at line 271 of file peptidenaturalisotopelist.cpp.

272{
273}

Member Function Documentation

◆ begin()

PeptideNaturalIsotopeList::const_iterator pappso::PeptideNaturalIsotopeList::begin ( ) const

Definition at line 479 of file peptidenaturalisotopelist.cpp.

480{
482}

References msp_peptide_natural_isotope_list.

◆ end()

PeptideNaturalIsotopeList::const_iterator pappso::PeptideNaturalIsotopeList::end ( ) const

Definition at line 485 of file peptidenaturalisotopelist.cpp.

486{
488}

References msp_peptide_natural_isotope_list.

◆ getByIntensityRatio()

std::vector< PeptideNaturalIsotopeAverageSp > pappso::PeptideNaturalIsotopeList::getByIntensityRatio ( unsigned int charge,
PrecisionPtr precision,
pappso_double minimumIntensityRatio ) const

get the list of natural isotopes representing at least a minimum ratio of the whole isotope pattern

Parameters
chargegives the number of H+, important to take into account for isotope ratio
precisionthe mass accuracy to take into acount each isotope (C13 != H2)
minimum_isotope_pattern_ratiothe minimum ratio of the isotope pattern to represent

/brief get a sorted (by expected intensity) vector of natural isotope average

Definition at line 398 of file peptidenaturalisotopelist.cpp.

401{
402
403 // qDebug() << "PeptideNaturalIsotopeList::getByIntensityRatio begin";
404 std::vector<PeptideNaturalIsotopeAverageSp> peptide_natural_isotope_average_list;
405
406 std::map<unsigned int, pappso::pappso_double> map_isotope_number =
408 std::vector<std::pair<unsigned int, pappso::pappso_double>> sorted_number_ratio;
409
410 for(unsigned int i = 0; i < map_isotope_number.size(); i++)
411 {
412 sorted_number_ratio.push_back(
413 std::pair<unsigned int, pappso::pappso_double>(i, map_isotope_number[i]));
414 unsigned int asked_rank = 0;
415 unsigned int given_rank = 0;
416 bool more_rank = true;
417 while(more_rank)
418 {
419 asked_rank++;
420 pappso::PeptideNaturalIsotopeAverage isotopeAverageMono(
421 *this, asked_rank, i, charge, precision);
422 given_rank = isotopeAverageMono.getIsotopeRank();
423 if(given_rank < asked_rank)
424 {
425 more_rank = false;
426 }
427 else if(isotopeAverageMono.getIntensityRatio() == 0)
428 {
429 more_rank = false;
430 }
431 else
432 {
433 // isotopeAverageMono.makePeptideNaturalIsotopeAverageSp();
434 peptide_natural_isotope_average_list.push_back(
435 isotopeAverageMono.makePeptideNaturalIsotopeAverageSp());
436 }
437 }
438 }
439
440
441 // sort by intensity ratio
442 std::sort(
443 sorted_number_ratio.begin(),
444 sorted_number_ratio.end(),
445 [](const std::pair<unsigned int, pappso::pappso_double> &m,
446 const std::pair<unsigned int, pappso::pappso_double> &n) { return (m.second > n.second); });
447
448
449 double cumulativeRatio = 0;
450 std::vector<unsigned int> selected_isotope_number_list;
451 for(auto &pair_isotope_number : sorted_number_ratio)
452 {
453 if(cumulativeRatio <= minimumIntensityRatio)
454 {
455 selected_isotope_number_list.push_back(pair_isotope_number.first);
456 }
457 else
458 {
459 break;
460 }
461 cumulativeRatio += pair_isotope_number.second;
462 }
463
464 auto it_remove =
465 std::remove_if(peptide_natural_isotope_average_list.begin(),
466 peptide_natural_isotope_average_list.end(),
467 [selected_isotope_number_list](const PeptideNaturalIsotopeAverageSp &average) {
468 auto it = std::find(selected_isotope_number_list.begin(),
469 selected_isotope_number_list.end(),
470 average.get()->getIsotopeNumber());
471 return (it == selected_isotope_number_list.end());
472 });
473 peptide_natural_isotope_average_list.erase(it_remove, peptide_natural_isotope_average_list.end());
474 return peptide_natural_isotope_average_list;
475}
const std::map< unsigned int, pappso_double > getIntensityRatioPerIsotopeNumber() const
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp

References pappso::PeptideNaturalIsotopeAverage::getIntensityRatio(), getIntensityRatioPerIsotopeNumber(), pappso::PeptideNaturalIsotopeAverage::getIsotopeRank(), and pappso::PeptideNaturalIsotopeAverage::makePeptideNaturalIsotopeAverageSp().

◆ getByIsotopeNumber()

std::vector< PeptideNaturalIsotopeSp > pappso::PeptideNaturalIsotopeList::getByIsotopeNumber ( unsigned int isotope_number,
unsigned int charge ) const

/brief get a sorted (by expected intensity) vector of isotopes of the same level

Definition at line 304 of file peptidenaturalisotopelist.cpp.

306{
307 std::vector<PeptideNaturalIsotopeSp> v_isotope_list;
308
309 for(auto &&isotopeSp : msp_peptide_natural_isotope_list)
310 {
311 if(isotopeSp.get()->getIsotopeNumber() == isotope_number)
312 {
313 v_isotope_list.push_back(isotopeSp);
314 }
315 }
316 std::sort(v_isotope_list.begin(),
317 v_isotope_list.end(),
318 [charge](const PeptideNaturalIsotopeSp &m, const PeptideNaturalIsotopeSp &n) {
319 return (m.get()->getIntensityRatio(charge) > n.get()->getIntensityRatio(charge));
320 });
321 return v_isotope_list;
322}

References msp_peptide_natural_isotope_list.

Referenced by pappso::PeptideNaturalIsotopeAverage::PeptideNaturalIsotopeAverage().

◆ getIntensityRatioPerIsotopeNumber()

const std::map< unsigned int, pappso_double > pappso::PeptideNaturalIsotopeList::getIntensityRatioPerIsotopeNumber ( ) const

Definition at line 276 of file peptidenaturalisotopelist.cpp.

277{
278 std::list<PeptideNaturalIsotopeSp>::const_iterator it = msp_peptide_natural_isotope_list.begin();
279 std::map<unsigned int, pappso_double> map_isotope_number;
280
281 while(it != msp_peptide_natural_isotope_list.end())
282 {
283 unsigned int number = it->get()->getIsotopeNumber();
284 std::pair<std::map<unsigned int, pappso_double>::iterator, bool> mapnew =
285 map_isotope_number.insert(std::pair<unsigned int, pappso_double>(number, 0));
286 if(mapnew.second == false)
287 {
288 // mapit = map_isotope_number.insert(std::pair<unsigned
289 // int,pappso_double>(number, 0));
290 }
291 mapnew.first->second += it->get()->getIntensityRatio(1);
292 it++;
293 }
294 return map_isotope_number;
295}

References msp_peptide_natural_isotope_list.

Referenced by pappso::MassSpectrumWidget::computeIsotopeMassList(), and getByIntensityRatio().

◆ getPeptideInterfaceSp()

const PeptideInterfaceSp & pappso::PeptideNaturalIsotopeList::getPeptideInterfaceSp ( ) const

Definition at line 497 of file peptidenaturalisotopelist.cpp.

498{
499 return msp_peptide;
500}

References msp_peptide.

◆ makePeptideNaturalIsotopeListSp()

PeptideNaturalIsotopeListSp pappso::PeptideNaturalIsotopeList::makePeptideNaturalIsotopeListSp ( ) const

Definition at line 260 of file peptidenaturalisotopelist.cpp.

261{
262 return std::make_shared<PeptideNaturalIsotopeList>(*this);
263}

References makePeptideNaturalIsotopeListSp().

Referenced by makePeptideNaturalIsotopeListSp().

◆ size()

unsigned int pappso::PeptideNaturalIsotopeList::size ( ) const

Definition at line 491 of file peptidenaturalisotopelist.cpp.

492{
494}

References msp_peptide_natural_isotope_list.

Member Data Documentation

◆ msp_peptide

const PeptideInterfaceSp pappso::PeptideNaturalIsotopeList::msp_peptide
private

◆ msp_peptide_natural_isotope_list

std::list<PeptideNaturalIsotopeSp> pappso::PeptideNaturalIsotopeList::msp_peptide_natural_isotope_list
private

The documentation for this class was generated from the following files: