44  int number_of_fixed_oxygen =
 
   47  int number_of_fixed_sulfur =
 
   51  int number_of_fixed_nitrogen =
 
   53  int number_of_fixed_hydrogen =
 
   61  std::map<Enums::Isotope, int> map_isotope;
 
   71  for(
int nbc13 = 0; nbc13 <= total_carbon; nbc13++)
 
   73      map_isotope[Enums::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)
 
   82  std::list<PeptideNaturalIsotopeSp> temp_list;
 
   87                   number_of_fixed_sulfur);
 
   88  std::list<PeptideNaturalIsotopeSp>::iterator it =
 
   89    msp_peptide_natural_isotope_list.begin();
 
   90  while(it != msp_peptide_natural_isotope_list.end())
 
   92      map_isotope = it->get()->getIsotopeMap();
 
   93      for(
int nbS34 = 1; nbS34 <= total_sulfur; nbS34++)
 
   97            std::make_shared<PeptideNaturalIsotope>(msp_peptide, map_isotope);
 
   98          temp_list.push_back(pepIsotope);
 
  108  msp_peptide_natural_isotope_list.insert(
 
  109    it, temp_list.begin(), temp_list.end());
 
  113  it = msp_peptide_natural_isotope_list.begin();
 
  114  while(it != msp_peptide_natural_isotope_list.end())
 
  118      map_isotope = it->get()->getIsotopeMap();
 
  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)
 
  135  msp_peptide_natural_isotope_list.insert(
 
  136    it, temp_list.begin(), temp_list.end());
 
  140  it = msp_peptide_natural_isotope_list.begin();
 
  141  while(it != msp_peptide_natural_isotope_list.end())
 
  143      map_isotope = it->get()->getIsotopeMap();
 
  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)
 
  161  msp_peptide_natural_isotope_list.insert(
 
  162    it, temp_list.begin(), temp_list.end());
 
  173                     number_of_fixed_hydrogen);
 
  174  it = msp_peptide_natural_isotope_list.begin();
 
  175  while(it != msp_peptide_natural_isotope_list.end())
 
  180      map_isotope = it->get()->getIsotopeMap();
 
  181      for(
int nbH2 = 1; nbH2 <= total_hydrogen; nbH2++)
 
  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)
 
  195  msp_peptide_natural_isotope_list.insert(
 
  196    it, temp_list.begin(), temp_list.end());
 
  205  unsigned int total_oxygen(
 
  207    number_of_fixed_oxygen);
 
  208  it = msp_peptide_natural_isotope_list.begin();
 
  209  while(it != msp_peptide_natural_isotope_list.end())
 
  214      map_isotope = it->get()->getIsotopeMap();
 
  215      for(
unsigned int nbO18 = 1; nbO18 <= total_oxygen; nbO18++)
 
  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)
 
  231  msp_peptide_natural_isotope_list.insert(
 
  232    it, temp_list.begin(), temp_list.end());
 
  241  unsigned int total_nitrogen(
 
  243    number_of_fixed_nitrogen);
 
  244  it = msp_peptide_natural_isotope_list.begin();
 
  245  while(it != msp_peptide_natural_isotope_list.end())
 
  250      map_isotope = it->get()->getIsotopeMap();
 
  251      for(
unsigned int nbN15 = 1; nbN15 <= total_nitrogen; nbN15++)
 
  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)
 
  267  msp_peptide_natural_isotope_list.insert(
 
  268    it, temp_list.begin(), temp_list.end());
 
 
  354                                   unsigned int isotopeNumber,
 
  359  unsigned int askedIsotopeRank;
 
  360  unsigned int maxAskedIsotopeRank = 10;
 
  362  std::vector<PeptideNaturalIsotopeAverageSp> v_isotopeAverageList;
 
  363  std::vector<PeptideNaturalIsotopeAverageSp> v_isotopeAverageListResult;
 
  365  std::vector<unsigned int> previousIsotopeRank;
 
  366  bool isEmpty = 
false;
 
  367  for(askedIsotopeRank = 1;
 
  368      (askedIsotopeRank < maxAskedIsotopeRank) && (!isEmpty);
 
  372        peptide, askedIsotopeRank, isotopeNumber, charge, precision);
 
  373      isEmpty = isotopeAverage.
isEmpty();
 
  379          if(std::find(previousIsotopeRank.begin(),
 
  380                       previousIsotopeRank.end(),
 
  382             previousIsotopeRank.end())
 
  385              v_isotopeAverageList.push_back(
 
  390  if(v_isotopeAverageList.size() == 0)
 
  391    return v_isotopeAverageListResult;
 
  394  std::sort(v_isotopeAverageList.begin(),
 
  395            v_isotopeAverageList.end(),
 
  398              return (m.get()->getIntensityRatio() >
 
  399                      n.get()->getIntensityRatio());
 
  403  auto it         = v_isotopeAverageList.begin();
 
  404  v_isotopeAverageListResult.clear();
 
  406  while((it != v_isotopeAverageList.end()) &&
 
  407        (cumulativeRatio < minimumIntensity))
 
  409      cumulativeRatio += it->get()->getIntensityRatio();
 
  410      v_isotopeAverageListResult.push_back(*it);
 
  416  return v_isotopeAverageListResult;
 
 
  432  std::vector<PeptideNaturalIsotopeAverageSp>
 
  433    peptide_natural_isotope_average_list;
 
  435  std::map<unsigned int, pappso::pappso_double> map_isotope_number =
 
  437  std::vector<std::pair<unsigned int, pappso::pappso_double>>
 
  440  for(
unsigned int i = 0; i < map_isotope_number.size(); i++)
 
  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;
 
  452            *
this, asked_rank, i, charge, precision);
 
  454          if(given_rank < asked_rank)
 
  465              peptide_natural_isotope_average_list.push_back(
 
  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);
 
  481  double cumulativeRatio = 0;
 
  482  std::vector<unsigned int> selected_isotope_number_list;
 
  483  for(
auto &pair_isotope_number : sorted_number_ratio)
 
  485      if(cumulativeRatio <= minimumIntensityRatio)
 
  487          selected_isotope_number_list.push_back(pair_isotope_number.first);
 
  493      cumulativeRatio += pair_isotope_number.second;
 
  497    std::remove_if(peptide_natural_isotope_average_list.begin(),
 
  498                   peptide_natural_isotope_average_list.end(),
 
  499                   [selected_isotope_number_list](
 
  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());
 
  506  peptide_natural_isotope_average_list.erase(
 
  507    it_remove, peptide_natural_isotope_average_list.end());
 
  508  return peptide_natural_isotope_average_list;