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

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

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

◆ PeptideNaturalIsotopeList() [2/2]

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

Definition at line 281 of file peptidenaturalisotopelist.cpp.

283 : msp_peptide(other.msp_peptide),
284 msp_peptide_natural_isotope_list(other.msp_peptide_natural_isotope_list)
285{
286}

◆ ~PeptideNaturalIsotopeList()

pappso::PeptideNaturalIsotopeList::~PeptideNaturalIsotopeList ( )

Definition at line 288 of file peptidenaturalisotopelist.cpp.

289{
290}

Member Function Documentation

◆ begin()

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

Definition at line 513 of file peptidenaturalisotopelist.cpp.

514{
516}

References msp_peptide_natural_isotope_list.

◆ end()

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

Definition at line 519 of file peptidenaturalisotopelist.cpp.

520{
522}

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 425 of file peptidenaturalisotopelist.cpp.

429{
430
431 // qDebug() << "PeptideNaturalIsotopeList::getByIntensityRatio begin";
432 std::vector<PeptideNaturalIsotopeAverageSp>
433 peptide_natural_isotope_average_list;
434
435 std::map<unsigned int, pappso::pappso_double> map_isotope_number =
437 std::vector<std::pair<unsigned int, pappso::pappso_double>>
438 sorted_number_ratio;
439
440 for(unsigned int i = 0; i < map_isotope_number.size(); i++)
441 {
442 sorted_number_ratio.push_back(
443 std::pair<unsigned int, pappso::pappso_double>(i,
444 map_isotope_number[i]));
445 unsigned int asked_rank = 0;
446 unsigned int given_rank = 0;
447 bool more_rank = true;
448 while(more_rank)
449 {
450 asked_rank++;
451 pappso::PeptideNaturalIsotopeAverage isotopeAverageMono(
452 *this, asked_rank, i, charge, precision);
453 given_rank = isotopeAverageMono.getIsotopeRank();
454 if(given_rank < asked_rank)
455 {
456 more_rank = false;
457 }
458 else if(isotopeAverageMono.getIntensityRatio() == 0)
459 {
460 more_rank = false;
461 }
462 else
463 {
464 // isotopeAverageMono.makePeptideNaturalIsotopeAverageSp();
465 peptide_natural_isotope_average_list.push_back(
466 isotopeAverageMono.makePeptideNaturalIsotopeAverageSp());
467 }
468 }
469 }
470
471
472 // sort by intensity ratio
473 std::sort(sorted_number_ratio.begin(),
474 sorted_number_ratio.end(),
475 [](const std::pair<unsigned int, pappso::pappso_double> &m,
476 const std::pair<unsigned int, pappso::pappso_double> &n) {
477 return (m.second > n.second);
478 });
479
480
481 double cumulativeRatio = 0;
482 std::vector<unsigned int> selected_isotope_number_list;
483 for(auto &pair_isotope_number : sorted_number_ratio)
484 {
485 if(cumulativeRatio <= minimumIntensityRatio)
486 {
487 selected_isotope_number_list.push_back(pair_isotope_number.first);
488 }
489 else
490 {
491 break;
492 }
493 cumulativeRatio += pair_isotope_number.second;
494 }
495
496 auto it_remove =
497 std::remove_if(peptide_natural_isotope_average_list.begin(),
498 peptide_natural_isotope_average_list.end(),
499 [selected_isotope_number_list](
500 const PeptideNaturalIsotopeAverageSp &average) {
501 auto it = std::find(selected_isotope_number_list.begin(),
502 selected_isotope_number_list.end(),
503 average.get()->getIsotopeNumber());
504 return (it == selected_isotope_number_list.end());
505 });
506 peptide_natural_isotope_average_list.erase(
507 it_remove, peptide_natural_isotope_average_list.end());
508 return peptide_natural_isotope_average_list;
509}
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 323 of file peptidenaturalisotopelist.cpp.

325{
326 std::vector<PeptideNaturalIsotopeSp> v_isotope_list;
327
328 for(auto &&isotopeSp : msp_peptide_natural_isotope_list)
329 {
330 if(isotopeSp.get()->getIsotopeNumber() == isotope_number)
331 {
332 v_isotope_list.push_back(isotopeSp);
333 }
334 }
335 std::sort(v_isotope_list.begin(),
336 v_isotope_list.end(),
337 [charge](const PeptideNaturalIsotopeSp &m,
338 const PeptideNaturalIsotopeSp &n) {
339 return (m.get()->getIntensityRatio(charge) >
340 n.get()->getIntensityRatio(charge));
341 });
342 return v_isotope_list;
343}

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 293 of file peptidenaturalisotopelist.cpp.

294{
295 std::list<PeptideNaturalIsotopeSp>::const_iterator it =
297 std::map<unsigned int, pappso_double> map_isotope_number;
298
299 while(it != msp_peptide_natural_isotope_list.end())
300 {
301 unsigned int number = it->get()->getIsotopeNumber();
302 std::pair<std::map<unsigned int, pappso_double>::iterator, bool> mapnew =
303 map_isotope_number.insert(
304 std::pair<unsigned int, pappso_double>(number, 0));
305 if(mapnew.second == false)
306 {
307 // mapit = map_isotope_number.insert(std::pair<unsigned
308 // int,pappso_double>(number, 0));
309 }
310 mapnew.first->second += it->get()->getIntensityRatio(1);
311 it++;
312 }
313 return map_isotope_number;
314}

References msp_peptide_natural_isotope_list.

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

◆ getPeptideInterfaceSp()

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

Definition at line 531 of file peptidenaturalisotopelist.cpp.

532{
533 return msp_peptide;
534}

References msp_peptide.

◆ makePeptideNaturalIsotopeListSp()

PeptideNaturalIsotopeListSp pappso::PeptideNaturalIsotopeList::makePeptideNaturalIsotopeListSp ( ) const

Definition at line 276 of file peptidenaturalisotopelist.cpp.

277{
278 return std::make_shared<PeptideNaturalIsotopeList>(*this);
279}

◆ size()

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

Definition at line 525 of file peptidenaturalisotopelist.cpp.

526{
528}

References msp_peptide_natural_isotope_list.

Member Data Documentation

◆ msp_peptide

const PeptideInterfaceSp pappso::PeptideNaturalIsotopeList::msp_peptide
private

Definition at line 51 of file peptidenaturalisotopelist.h.

Referenced by PeptideNaturalIsotopeList(), and getPeptideInterfaceSp().

◆ 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: