libpappsomspp
Library for mass spectrometry
pappso::PeptideIsotopeSpectrumMatch Class Reference

#include <peptideisotopespectrummatch.h>

Public Types

typedef std::list< PeakIonIsotopeMatch >::const_iterator const_iterator
 

Public Member Functions

 PeptideIsotopeSpectrumMatch (const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, const std::list< PeptideIon > &ion_type_list, unsigned int max_isotope_number, unsigned int max_isotope_rank)
 annotate spectrum with peptide ions and isotopes More...
 
 PeptideIsotopeSpectrumMatch (const MassSpectrum &spectrum, std::vector< PeptideNaturalIsotopeAverageSp > v_peptideIsotopeList, std::vector< PeptideFragmentIonSp > v_peptideIonList, PrecisionPtr precision)
 
 PeptideIsotopeSpectrumMatch (const PeptideIsotopeSpectrumMatch &other)
 
virtual ~PeptideIsotopeSpectrumMatch ()
 
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList () const
 
std::size_t size () const
 
const_iterator begin () const
 
const_iterator end () const
 
void dropPeaksLackingMonoisotope ()
 

Private Member Functions

virtual std::vector< DataPoint >::iterator getBestPeakIterator (std::vector< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const
 

Private Attributes

PrecisionPtr _precision
 
std::list< PeakIonIsotopeMatch_peak_ion_match_list
 

Detailed Description

Definition at line 39 of file peptideisotopespectrummatch.h.

Member Typedef Documentation

◆ const_iterator

Constructor & Destructor Documentation

◆ PeptideIsotopeSpectrumMatch() [1/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch ( const MassSpectrum spectrum,
const PeptideSp peptide_sp,
unsigned int  parent_charge,
PrecisionPtr  precision,
const std::list< PeptideIon > &  ion_type_list,
unsigned int  max_isotope_number,
unsigned int  max_isotope_rank 
)

annotate spectrum with peptide ions and isotopes

Parameters
spectrumthe spectrum to annotate
peptide_sppeptide to fragment
parent_chargecharge of the ion parent
precisionMS2 mass measurement precision
ion_listion types to compute fragments
max_isotope_numbermaximum isotope number to compute (0 means only monoisotope is computed)
max_isotope_rankmaximum rank inside isotope level to compute

◆ PeptideIsotopeSpectrumMatch() [2/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch ( const MassSpectrum spectrum,
std::vector< PeptideNaturalIsotopeAverageSp v_peptideIsotopeList,
std::vector< PeptideFragmentIonSp v_peptideIonList,
PrecisionPtr  precision 
)

Definition at line 112 of file peptideisotopespectrummatch.cpp.

117  : _precision(precision)
118 {
119  qDebug() << " begin";
120  if(v_peptideIsotopeList.size() != v_peptideIonList.size())
121  {
122  throw PappsoException(
123  QObject::tr(
124  "v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
125  .arg(v_peptideIsotopeList.size())
126  .arg(v_peptideIonList.size()));
127  }
128 
129  auto isotopeIt = v_peptideIsotopeList.begin();
130  auto ionIt = v_peptideIonList.begin();
131  std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
132 
133  while(isotopeIt != v_peptideIsotopeList.end())
134  {
135  std::vector<DataPoint>::iterator it_peak =
136  getBestPeakIterator(peak_list, *(isotopeIt->get()));
137  if(it_peak != peak_list.end())
138  {
139  _peak_ion_match_list.push_back(
140  PeakIonIsotopeMatch(*it_peak, *isotopeIt, *ionIt));
141  peak_list.erase(it_peak);
142  }
143  isotopeIt++;
144  ionIt++;
145  }
146  qDebug() << " end";
147 }
std::list< PeakIonIsotopeMatch > _peak_ion_match_list
virtual std::vector< DataPoint >::iterator getBestPeakIterator(std::vector< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const

References _peak_ion_match_list, and getBestPeakIterator().

◆ PeptideIsotopeSpectrumMatch() [3/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch ( const PeptideIsotopeSpectrumMatch other)

Definition at line 150 of file peptideisotopespectrummatch.cpp.

152  : _precision(other._precision),
153  _peak_ion_match_list(other._peak_ion_match_list)
154 {
155  qDebug();
156 }

◆ ~PeptideIsotopeSpectrumMatch()

pappso::PeptideIsotopeSpectrumMatch::~PeptideIsotopeSpectrumMatch ( )
virtual

Definition at line 158 of file peptideisotopespectrummatch.cpp.

159 {
160 }

Member Function Documentation

◆ begin()

PeptideIsotopeSpectrumMatch::const_iterator pappso::PeptideIsotopeSpectrumMatch::begin ( ) const

Definition at line 203 of file peptideisotopespectrummatch.cpp.

204 {
205  return _peak_ion_match_list.begin();
206 }

References _peak_ion_match_list.

◆ dropPeaksLackingMonoisotope()

void pappso::PeptideIsotopeSpectrumMatch::dropPeaksLackingMonoisotope ( )

Definition at line 214 of file peptideisotopespectrummatch.cpp.

215 {
216  qDebug();
218  [](const PeakIonIsotopeMatch &a, const PeakIonIsotopeMatch &b) {
219  if(a.getPeptideIonType() < b.getPeptideIonType())
220  return true;
221  if(a.getPeptideFragmentIonSp().get()->size() <
222  b.getPeptideFragmentIonSp().get()->size())
223  return true;
224  if(a.getCharge() < b.getCharge())
225  return true;
226  if(a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() <
227  b.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
228  return true;
229  return false;
230  });
231  PeptideIon ion_type = PeptideIon::b;
232  std::size_t nserie = 0;
233  std::size_t isotopeserie = 0;
234  unsigned int charge = 0;
235  for(std::list<PeakIonIsotopeMatch>::iterator it =
236  _peak_ion_match_list.begin();
237  it != _peak_ion_match_list.end();
238  it++)
239  {
240  if((nserie != it->getPeptideFragmentIonSp().get()->size()) ||
241  (ion_type != it->getPeptideIonType()) || (charge != it->getCharge()))
242  {
243  ion_type = it->getPeptideIonType();
244  isotopeserie = 0;
245  nserie = it->getPeptideFragmentIonSp().get()->size();
246  charge = it->getCharge();
247  }
248  if(isotopeserie <=
249  it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
250  {
251  isotopeserie =
252  it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
253  }
254  else
255  {
256  it = _peak_ion_match_list.erase(it);
257  }
258  }
259  qDebug();
260 }
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition: types.h:386
@ b
Nter acylium ions.

References _peak_ion_match_list, pappso::a, and pappso::b.

◆ end()

PeptideIsotopeSpectrumMatch::const_iterator pappso::PeptideIsotopeSpectrumMatch::end ( ) const

Definition at line 208 of file peptideisotopespectrummatch.cpp.

209 {
210  return _peak_ion_match_list.end();
211 }

References _peak_ion_match_list.

◆ getBestPeakIterator()

std::vector< DataPoint >::iterator pappso::PeptideIsotopeSpectrumMatch::getBestPeakIterator ( std::vector< DataPoint > &  peak_list,
const PeptideNaturalIsotopeAverage ion 
) const
privatevirtual

Definition at line 164 of file peptideisotopespectrummatch.cpp.

167 {
168  // qDebug();
169  std::vector<DataPoint>::iterator itpeak = peak_list.begin();
170  std::vector<DataPoint>::iterator itend = peak_list.end();
171  std::vector<DataPoint>::iterator itselect = peak_list.end();
172 
173  pappso_double best_intensity = 0;
174 
175  while(itpeak != itend)
176  {
177  if(ion.matchPeak(itpeak->x))
178  {
179  if(itpeak->y > best_intensity)
180  {
181  best_intensity = itpeak->y;
182  itselect = itpeak;
183  }
184  }
185  itpeak++;
186  }
187  // qDebug();
188  return (itselect);
189 }
double pappso_double
A type definition for doubles.
Definition: types.h:49

References pappso::PeptideNaturalIsotopeAverage::matchPeak().

Referenced by PeptideIsotopeSpectrumMatch().

◆ getPeakIonIsotopeMatchList()

const std::list< PeakIonIsotopeMatch > & pappso::PeptideIsotopeSpectrumMatch::getPeakIonIsotopeMatchList ( ) const

◆ size()

std::size_t pappso::PeptideIsotopeSpectrumMatch::size ( ) const

Definition at line 198 of file peptideisotopespectrummatch.cpp.

199 {
200  return _peak_ion_match_list.size();
201 }

References _peak_ion_match_list.

Member Data Documentation

◆ _peak_ion_match_list

std::list<PeakIonIsotopeMatch> pappso::PeptideIsotopeSpectrumMatch::_peak_ion_match_list
private

◆ _precision

PrecisionPtr pappso::PeptideIsotopeSpectrumMatch::_precision
private

Definition at line 84 of file peptideisotopespectrummatch.h.


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