Loading...
Searching...
No Matches
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
| 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

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

Definition at line 71 of file peptideisotopespectrummatch.h.

## 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

  spectrum | the spectrum to annotate
  peptide_sp | peptide to fragment
  parent_charge | charge of the ion parent
  precision | MS2 mass measurement precision
  ion_list | ion types to compute fragments
  max_isotope_number | maximum isotope number to compute (0 means only monoisotope is computed)
  max_isotope_rank | maximum rank inside isotope level to compute

Definition at line 31 of file peptideisotopespectrummatch.cpp.

: _precision(precision)
{
try
{
_peak_ion_match_list.clear();
qDebug() << "peptideSp.get()->getSequence()="
<< peptideSp.get()->getSequence()
<< " max_isotope_number=" << max_isotope_number
<< " spectrum.size=" << spectrum.size()
<< " parent_charge=" << parent_charge
<< " ion_type_list.size=" << ion_type_list.size()
<< " max_isotope_rank=" << max_isotope_rank;
PeptideFragmentIonListBase fragmentIonList(peptideSp, ion_type_list);
qDebug() << " fragmentIonList.size()=" << fragmentIonList.size();
std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
for(auto ion_type : ion_type_list)
{
const std::list<PeptideFragmentIonSp> peptide_fragment_ion_list =
fragmentIonList.getPeptideFragmentIonSp(ion_type);
qDebug() << " peptide_fragment_ion_list.size()="
<< peptide_fragment_ion_list.size();
for(unsigned int charge = 1; charge <= parent_charge; charge++)
{
qDebug();
for(auto &&peptide_fragment_ion : peptide_fragment_ion_list)
{
qDebug() << "peptide_fragment_ion.get()->getMz(charge)="
<< peptide_fragment_ion.get()->getMz(charge);
PeptideNaturalIsotopeList isotope_list(peptide_fragment_ion);
for(unsigned int isotope_number = 0;
isotope_number <= max_isotope_number;
isotope_number++)
{
qDebug();
PeptideNaturalIsotopeAverage *p_isotopeIon;
if(max_isotope_rank == 0)
{
// fast constructor, no need to compute isotope ratio
p_isotopeIon = new PeptideNaturalIsotopeAverage(
peptide_fragment_ion,
isotope_number,
charge,
precision);
}
else
{
p_isotopeIon =
new PeptideNaturalIsotopeAverage(isotope_list,
max_isotope_rank,
isotope_number,
charge,
precision);
}
qDebug()
<< "max_isotope_rank=" << max_isotope_rank
<< " isotope_number=" << isotope_number
<< " charge=" << charge << " precision=" << precision
<< " p_isotopeIon->getMz()=" << p_isotopeIon->getMz()
<< " " << isotope_number << " "
<< p_isotopeIon->toString();
std::vector<DataPoint>::iterator it_peak =
getBestPeakIterator(peak_list, *p_isotopeIon);
if(it_peak != peak_list.end())
{
_peak_ion_match_list.push_back(PeakIonIsotopeMatch(
*it_peak,
p_isotopeIon->makePeptideNaturalIsotopeAverageSp(),
peptide_fragment_ion));
peak_list.erase(it_peak);
qDebug() << isotope_number << " "
<< _peak_ion_match_list.back().toString();
}
delete p_isotopeIon;
}
}
}
}
}
catch(PappsoException &exception_pappso)
{
QString errorStr =
QObject::tr(
"ERROR building PeptideIsotopeSpectrumMatch, PAPPSO exception:\n%1")
.arg(exception_pappso.qwhat());
qDebug() << "PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
"PappsoException :\n"
<< errorStr;
throw PappsoException(errorStr);
}
catch(std::exception &exception_std)
{
QString errorStr =
QObject::tr(
"ERROR building PeptideIsotopeSpectrumMatch, std exception:\n%1")
.arg(exception_std.what());
qDebug() << "PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch "
"std::exception :\n"
<< errorStr;
throw PappsoException(errorStr);
}
qDebug() << "_peak_ion_match_list.size()=" << _peak_ion_match_list.size();
}
pappso::PeptideIsotopeSpectrumMatch::_precision
PrecisionPtr _precision
Definition peptideisotopespectrummatch.h:84
pappso::PeptideIsotopeSpectrumMatch::_peak_ion_match_list
std::list< PeakIonIsotopeMatch > _peak_ion_match_list
Definition peptideisotopespectrummatch.h:85
pappso::PeptideIsotopeSpectrumMatch::getBestPeakIterator
virtual std::vector< DataPoint >::iterator getBestPeakIterator(std::vector< DataPoint > &peak_list, const PeptideNaturalIsotopeAverage &ion) const
Definition peptideisotopespectrummatch.cpp:201

References _peak_ion_match_list, getBestPeakIterator(), pappso::PeptideNaturalIsotopeAverage::getMz(), pappso::PeptideFragmentIonListBase::getPeptideFragmentIonSp(), pappso::PeptideNaturalIsotopeAverage::makePeptideNaturalIsotopeAverageSp(), pappso::PappsoException::qwhat(), pappso::PeptideFragmentIonListBase::size(), and pappso::PeptideNaturalIsotopeAverage::toString().

## PeptideIsotopeSpectrumMatch() [2/3]

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

Definition at line 148 of file peptideisotopespectrummatch.cpp.

: _precision(precision)
{
qDebug() << " begin";
if(v_peptideIsotopeList.size() != v_peptideIonList.size())
{
throw PappsoException(
QObject::tr(
"v_peptideIsotopeList.size() %1 != v_peptideIonList.size() %2")
.arg(v_peptideIsotopeList.size())
.arg(v_peptideIonList.size()));
}
auto isotopeIt = v_peptideIsotopeList.begin();
auto ionIt = v_peptideIonList.begin();
std::vector<DataPoint> peak_list(spectrum.begin(), spectrum.end());
while(isotopeIt != v_peptideIsotopeList.end())
{
std::vector<DataPoint>::iterator it_peak =
getBestPeakIterator(peak_list, *(isotopeIt->get()));
if(it_peak != peak_list.end())
{
_peak_ion_match_list.push_back(
PeakIonIsotopeMatch(*it_peak, *isotopeIt, *ionIt));
peak_list.erase(it_peak);
}
isotopeIt++;
ionIt++;
}
qDebug() << "_peak_ion_match_list.size()=" << _peak_ion_match_list.size()
<< " end";
}

References _peak_ion_match_list, and getBestPeakIterator().

## PeptideIsotopeSpectrumMatch() [3/3]

pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch | ( | const PeptideIsotopeSpectrumMatch & | other | ) |

Definition at line 187 of file peptideisotopespectrummatch.cpp.

: _precision(other._precision),
_peak_ion_match_list(other._peak_ion_match_list)
{
qDebug();
}

## ~PeptideIsotopeSpectrumMatch()

pappso::PeptideIsotopeSpectrumMatch::~PeptideIsotopeSpectrumMatch | ( |  | ) |

virtual

Definition at line 195 of file peptideisotopespectrummatch.cpp.

{
}

## Member Function Documentation

## begin()

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

Definition at line 242 of file peptideisotopespectrummatch.cpp.

{
return _peak_ion_match_list.begin();
}

References _peak_ion_match_list.

## dropPeaksLackingMonoisotope()

void pappso::PeptideIsotopeSpectrumMatch::dropPeaksLackingMonoisotope | ( |  | ) |

Definition at line 253 of file peptideisotopespectrummatch.cpp.

{
qDebug();
_peak_ion_match_list.sort(
[](const PeakIonIsotopeMatch &a, const PeakIonIsotopeMatch &b) {
if(a.getPeptideIonType() < b.getPeptideIonType())
return true;
if(a.getPeptideFragmentIonSp().get()->size() <
b.getPeptideFragmentIonSp().get()->size())
return true;
if(a.getCharge() < b.getCharge())
return true;
if(a.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber() <
b.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
return true;
return false;
});
PeptideIon ion_type = PeptideIon::b;
std::size_t nserie = 0;
std::size_t isotopeserie = 0;
unsigned int charge = 0;
for(std::list<PeakIonIsotopeMatch>::iterator it =
_peak_ion_match_list.begin();
it != _peak_ion_match_list.end();
it++)
{
if((nserie != it->getPeptideFragmentIonSp().get()->size()) ||
(ion_type != it->getPeptideIonType()) || (charge != it->getCharge()))
{
ion_type = it->getPeptideIonType();
isotopeserie = 0;
nserie = it->getPeptideFragmentIonSp().get()->size();
charge = it->getCharge();
}
if(isotopeserie <=
it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber())
{
isotopeserie =
it->getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
}
else
{
it = _peak_ion_match_list.erase(it);
}
}
qDebug();
}
pappso::PeptideIon
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:425
pappso::PeptideIon::b
@ b
Nter acylium ions.
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::b
@ b

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

## end()

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

Definition at line 247 of file peptideisotopespectrummatch.cpp.

{
return _peak_ion_match_list.end();
}

References _peak_ion_match_list.

## getBestPeakIterator()

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

private virtual

Definition at line 201 of file peptideisotopespectrummatch.cpp.

{
// qDebug();
std::vector<DataPoint>::iterator itpeak = peak_list.begin();
std::vector<DataPoint>::iterator itend = peak_list.end();
std::vector<DataPoint>::iterator itselect = peak_list.end();
pappso_double best_intensity = 0;
while(itpeak != itend)
{
// qDebug() << itpeak->x;
if(ion.matchPeak(itpeak->x))
{
if(itpeak->y > best_intensity)
{
best_intensity = itpeak->y;
itselect = itpeak;
}
}
itpeak++;
}
// qDebug();
return (itselect);
}
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50

References pappso::PeptideNaturalIsotopeAverage::matchPeak().

Referenced by PeptideIsotopeSpectrumMatch(), and PeptideIsotopeSpectrumMatch().

## getPeakIonIsotopeMatchList()

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

Definition at line 230 of file peptideisotopespectrummatch.cpp.

{
qDebug() << "_peak_ion_match_list.size()=" << _peak_ion_match_list.size();
return _peak_ion_match_list;
}

References _peak_ion_match_list.

Referenced by pappso::IonIsotopeRatioScore::IonIsotopeRatioScore(), and pappso::MassSpectrumWidget::peptideAnnotate().

## size()

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

Definition at line 237 of file peptideisotopespectrummatch.cpp.

{
return _peak_ion_match_list.size();
}

References _peak_ion_match_list.

## Member Data Documentation

## _peak_ion_match_list

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

private

Definition at line 85 of file peptideisotopespectrummatch.h.

Referenced by PeptideIsotopeSpectrumMatch(), PeptideIsotopeSpectrumMatch(), begin(), dropPeaksLackingMonoisotope(), end(), getPeakIonIsotopeMatchList(), and size().

## _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:

- pappsomspp/psm/peptideisotopespectrummatch.h
- pappsomspp/psm/peptideisotopespectrummatch.cpp