libpappsomspp
Library for mass spectrometry
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 More...
 
 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 More...
 
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 69 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 59 of file peptidenaturalisotopelist.cpp.

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 }
274 
277 {
278  return std::make_shared<PeptideNaturalIsotopeList>(*this);
279 }
280 
282  const PeptideNaturalIsotopeList &other)
283  : msp_peptide(other.msp_peptide),
285 {
286 }
287 
289 {
290 }
291 
292 const std::map<unsigned int, pappso_double>
294 {

References pappso::C13.

◆ PeptideNaturalIsotopeList() [2/2]

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

Definition at line 302 of file peptidenaturalisotopelist.cpp.

306  {
307  // mapit = map_isotope_number.insert(std::pair<unsigned

◆ ~PeptideNaturalIsotopeList()

pappso::PeptideNaturalIsotopeList::~PeptideNaturalIsotopeList ( )

Definition at line 309 of file peptidenaturalisotopelist.cpp.

Member Function Documentation

◆ begin()

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

Definition at line 534 of file peptidenaturalisotopelist.cpp.

◆ end()

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

Definition at line 540 of file peptidenaturalisotopelist.cpp.

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

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 }
510 
511 
514 {
515  return msp_peptide_natural_isotope_list.begin();
516 }
517 
520 {
522 }
523 
524 unsigned int
526 {
527  return msp_peptide_natural_isotope_list.size();
528 }
529 
530 const PeptideInterfaceSp &

References pappso::PeptideNaturalIsotopeAverage::getIntensityRatio(), 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 344 of file peptidenaturalisotopelist.cpp.

356 {
357 
358  // qDebug() << "getByIntensityRatioByIsotopeNumber begin";
359  unsigned int askedIsotopeRank;
360  unsigned int maxAskedIsotopeRank = 10;
361  pappso_double cumulativeRatio = 0;
362  std::vector<PeptideNaturalIsotopeAverageSp> v_isotopeAverageList;
363  std::vector<PeptideNaturalIsotopeAverageSp> v_isotopeAverageListResult;
364 

◆ getIntensityRatioPerIsotopeNumber()

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

Definition at line 314 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(),

Referenced by pappso::MassSpectrumWidget::computeIsotopeMassList().

◆ getPeptideInterfaceSp()

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

Definition at line 552 of file peptidenaturalisotopelist.cpp.

◆ makePeptideNaturalIsotopeListSp()

PeptideNaturalIsotopeListSp pappso::PeptideNaturalIsotopeList::makePeptideNaturalIsotopeListSp ( ) const

Definition at line 297 of file peptidenaturalisotopelist.cpp.

300  {

◆ size()

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

Definition at line 546 of file peptidenaturalisotopelist.cpp.

Member Data Documentation

◆ msp_peptide

const PeptideInterfaceSp pappso::PeptideNaturalIsotopeList::msp_peptide
private

Definition at line 72 of file peptidenaturalisotopelist.h.

◆ msp_peptide_natural_isotope_list

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

Definition at line 73 of file peptidenaturalisotopelist.h.


The documentation for this class was generated from the following files:
pappso::AtomIsotopeSurvey::S
@ S
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:69
pappso::Isotope::H2
@ H2
pappso::Isotope::S36
@ S36
pappso::PeptideNaturalIsotopeList::getIntensityRatioPerIsotopeNumber
const std::map< unsigned int, pappso_double > getIntensityRatioPerIsotopeNumber() const
Definition: peptidenaturalisotopelist.cpp:314
pappso::PeptideNaturalIsotopeList::~PeptideNaturalIsotopeList
~PeptideNaturalIsotopeList()
Definition: peptidenaturalisotopelist.cpp:309
pappso::PeptideNaturalIsotopeList::end
const_iterator end() const
Definition: peptidenaturalisotopelist.cpp:540
pappso::PeptideNaturalIsotopeAverage
Definition: peptidenaturalisotopeaverage.h:64
pappso::Isotope::N15
@ N15
pappso::PeptideNaturalIsotopeList::makePeptideNaturalIsotopeListSp
PeptideNaturalIsotopeListSp makePeptideNaturalIsotopeListSp() const
Definition: peptidenaturalisotopelist.cpp:297
pappso::PeptideNaturalIsotopeList::PeptideNaturalIsotopeList
PeptideNaturalIsotopeList(const PeptideInterfaceSp &peptide, pappso_double minimum_ratio_to_compute=0.001)
compute the list of possible isotopes for a peptide
Definition: peptidenaturalisotopelist.cpp:59
pappso::PeptideInterfaceSp
std::shared_ptr< const PeptideInterface > PeptideInterfaceSp
Definition: peptideinterface.h:59
pappso::PeptideNaturalIsotopeListSp
std::shared_ptr< const PeptideNaturalIsotopeList > PeptideNaturalIsotopeListSp
Definition: peptidenaturalisotopelist.h:64
pappso::AtomIsotopeSurvey::H
@ H
pappso::PeptideNaturalIsotopeList::size
unsigned int size() const
Definition: peptidenaturalisotopelist.cpp:546
pappso::Isotope::S34
@ S34
pappso::PeptideNaturalIsotopeList::msp_peptide_natural_isotope_list
std::list< PeptideNaturalIsotopeSp > msp_peptide_natural_isotope_list
Definition: peptidenaturalisotopelist.h:73
pappso::PeptideNaturalIsotopeSp
std::shared_ptr< const PeptideNaturalIsotope > PeptideNaturalIsotopeSp
Definition: peptidenaturalisotope.h:62
pappso::PeptideNaturalIsotopeList::msp_peptide
const PeptideInterfaceSp msp_peptide
Definition: peptidenaturalisotopelist.h:72
pappso::PeptideNaturalIsotopeList::const_iterator
std::list< PeptideNaturalIsotopeSp >::const_iterator const_iterator
Definition: peptidenaturalisotopelist.h:88
pappso::PeptideNaturalIsotopeList::begin
const_iterator begin() const
Definition: peptidenaturalisotopelist.cpp:534
pappso::Isotope::C13
@ C13
pappso::AtomIsotopeSurvey::N
@ N
pappso::Isotope::O18
@ O18
pappso::PeptideNaturalIsotopeAverageSp
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
Definition: peptidenaturalisotopeaverage.h:58
pappso::AtomIsotopeSurvey::O
@ O
pappso::Isotope::S33
@ S33