57 std::map<Enums::Isotope, int> map_isotope;
67 for(
int nbc13 = 0; nbc13 <= total_carbon; nbc13++)
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)
78 std::list<PeptideNaturalIsotopeSp> temp_list;
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())
87 map_isotope = it->get()->getIsotopeMap();
88 for(
int nbS34 = 1; nbS34 <= total_sulfur; nbS34++)
92 std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
93 temp_list.push_back(pepIsotope);
103 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
107 it = msp_peptide_natural_isotope_list.begin();
108 while(it != msp_peptide_natural_isotope_list.end())
112 map_isotope = it->get()->getIsotopeMap();
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)
127 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
131 it = msp_peptide_natural_isotope_list.begin();
132 while(it != msp_peptide_natural_isotope_list.end())
134 map_isotope = it->get()->getIsotopeMap();
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)
151 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
162 number_of_fixed_hydrogen);
163 it = msp_peptide_natural_isotope_list.begin();
164 while(it != msp_peptide_natural_isotope_list.end())
169 map_isotope = it->get()->getIsotopeMap();
170 for(
int nbH2 = 1; nbH2 <= total_hydrogen; nbH2++)
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)
184 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
194 number_of_fixed_oxygen);
195 it = msp_peptide_natural_isotope_list.begin();
196 while(it != msp_peptide_natural_isotope_list.end())
201 map_isotope = it->get()->getIsotopeMap();
202 for(
unsigned int nbO18 = 1; nbO18 <= total_oxygen; nbO18++)
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)
218 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
228 number_of_fixed_nitrogen);
229 it = msp_peptide_natural_isotope_list.begin();
230 while(it != msp_peptide_natural_isotope_list.end())
235 map_isotope = it->get()->getIsotopeMap();
236 for(
unsigned int nbN15 = 1; nbN15 <= total_nitrogen; nbN15++)
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)
252 msp_peptide_natural_isotope_list.insert(it, temp_list.begin(), temp_list.end());
333 unsigned int isotopeNumber,
338 unsigned int askedIsotopeRank;
339 unsigned int maxAskedIsotopeRank = 10;
341 std::vector<PeptideNaturalIsotopeAverageSp> v_isotopeAverageList;
342 std::vector<PeptideNaturalIsotopeAverageSp> v_isotopeAverageListResult;
344 std::vector<unsigned int> previousIsotopeRank;
345 bool isEmpty =
false;
346 for(askedIsotopeRank = 1; (askedIsotopeRank < maxAskedIsotopeRank) && (!isEmpty);
350 peptide, askedIsotopeRank, isotopeNumber, charge, precision);
351 isEmpty = isotopeAverage.
isEmpty();
357 if(std::find(previousIsotopeRank.begin(),
358 previousIsotopeRank.end(),
366 if(v_isotopeAverageList.size() == 0)
367 return v_isotopeAverageListResult;
370 std::sort(v_isotopeAverageList.begin(),
371 v_isotopeAverageList.end(),
373 return (m.get()->getIntensityRatio() > n.get()->getIntensityRatio());
377 auto it = v_isotopeAverageList.begin();
378 v_isotopeAverageListResult.clear();
380 while((it != v_isotopeAverageList.end()) && (cumulativeRatio < minimumIntensity))
382 cumulativeRatio += it->get()->getIntensityRatio();
383 v_isotopeAverageListResult.push_back(*it);
389 return v_isotopeAverageListResult;
404 std::vector<PeptideNaturalIsotopeAverageSp> peptide_natural_isotope_average_list;
406 std::map<unsigned int, pappso::pappso_double> map_isotope_number =
408 std::vector<std::pair<unsigned int, pappso::pappso_double>> sorted_number_ratio;
410 for(
unsigned int i = 0; i < map_isotope_number.size(); i++)
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;
421 *
this, asked_rank, i, charge, precision);
423 if(given_rank < asked_rank)
434 peptide_natural_isotope_average_list.push_back(
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); });
449 double cumulativeRatio = 0;
450 std::vector<unsigned int> selected_isotope_number_list;
451 for(
auto &pair_isotope_number : sorted_number_ratio)
453 if(cumulativeRatio <= minimumIntensityRatio)
455 selected_isotope_number_list.push_back(pair_isotope_number.first);
461 cumulativeRatio += pair_isotope_number.second;
465 std::remove_if(peptide_natural_isotope_average_list.begin(),
466 peptide_natural_isotope_average_list.end(),
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());
473 peptide_natural_isotope_average_list.erase(it_remove, peptide_natural_isotope_average_list.end());
474 return peptide_natural_isotope_average_list;