Loading...
Searching...
No Matches
pappso::specglob::PeptideModel Class Reference

`#include <peptidemodel.h>`

Inheritance diagram for pappso::specglob::PeptideModel:

## Public Member Functions

| PeptideModel (const pappso::QualifiedMassSpectrum &qmass_spectrum, const pappso::Peptide &peptide)
| PeptideModel ()
| PeptideModel (const PeptideModel &other)
virtual | ~PeptideModel ()
QString | toString () const
double | getMass () const
double | getMassDelta () const
| mass delta between experimental and theoretical mass
std::size_t | modifCount () const
void | setBeginMassDelta (double)
void | matchExperimentalPeaks (pappso::PrecisionPtr precision)
std::vector< double > | getTheoreticalIonMassList () const
std::size_t | getCountSharedPeaks () const
double | getIntensitySharedPeaks () const
double | getIntensityExperimentalPeaks () const
void | assignResidualMass2Cter ()
bool | eliminateComplementaryDelta (pappso::PrecisionPtr precision)
bool | checkForMutations (const std::vector< AminoAcidChar > &aa_list, pappso::PrecisionPtr precision)
| try to replace mass differences with corresponding mutations mass delta
bool | checkForMutation (const pappso::Aa &amino_acid_candidate, pappso::PrecisionPtr precision)
| try to replace mass differences with corresponding mutation mass delta
bool | checkForAaModification (const pappso::Aa &aa_modified, pappso::PrecisionPtr precision)
| try to replace mass differences with the given modifications on a specific amino acid
bool | checkForAaModificationP (pappso::AaModificationP modification, pappso::PrecisionPtr precision)
| try to replace mass differences with the given modification
PeptideModel & | operator= (const PeptideModel &other)
PeptideModel & | copyDeep (const PeptideModel &other)
bool | eliminateNegativeOffset (pappso::PrecisionPtr precision)
bool | removeBracketsForAlignedAA ()
const std::vector< TheoreticalPeakDataPoint > & | getTheoreticalPeakDataPointList () const
QString | getTheoreticalPeakDataPointListToString () const
QString | toProForma () const
| get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README.md

## Private Member Functions

void | generateTheoreticalPeaks (pappso::PrecisionPtr precision)

## Private Attributes

std::vector< TheoreticalPeakDataPoint > | m_theoreticalPeakList
double | m_experimentalPrecursorMass
double | m_beginMassDelta = 0
pappso::MassSpectrumCstSPtr | mcsp_peakList = nullptr
pappso::AaModificationP | m_nterModification
pappso::AaModificationP | m_cterModification
std::size_t | m_countSharedPeaks = 0
double | m_intensitySharedPeaks = 0
double | m_intensityExperimentalPeaks = 0

## Detailed Description

Todo:
  write docs

Definition at line 72 of file peptidemodel.h.

## Constructor & Destructor Documentation

## PeptideModel() [1/3]

pappso::specglob::PeptideModel::PeptideModel | ( | const pappso::QualifiedMassSpectrum & | qmass_spectrum,
|  | const pappso::Peptide & | peptide
| ) |  |

Default constructor

Definition at line 53 of file peptidemodel.cpp.

: std::vector<AminoAcidModel>()
{
m_experimentalPrecursorMass = qmass_spectrum.getPrecursorMass();
mcsp_peakList = qmass_spectrum.getMassSpectrumCstSPtr();
m_nterModification = peptide.getInternalNterModification();
m_cterModification = peptide.getInternalCterModification();
for(auto aa_pep : peptide)
{
aa_pep.removeInternalCterModification();
aa_pep.removeInternalNterModification();
push_back({aa_pep, SpectralAlignmentType::nonAlign, false, 0.0});
}
// internal:Nter_hydrolytic_cleavage_H
// internal:Cter_hydrolytic_cleavage_HO
//
}
pappso::Peptide::getInternalNterModification
AaModificationP getInternalNterModification() const
Definition peptide.cpp:467
pappso::Peptide::getInternalCterModification
AaModificationP getInternalCterModification() const
Definition peptide.cpp:478
pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
Definition qualifiedmassspectrum.cpp:141
pappso::QualifiedMassSpectrum::getPrecursorMass
double getPrecursorMass(bool *ok_p=nullptr) const
get precursor mass given the charge stats and precursor mz
Definition qualifiedmassspectrum.cpp:258
pappso::specglob::PeptideModel::m_nterModification
pappso::AaModificationP m_nterModification
Definition peptidemodel.h:222
pappso::specglob::PeptideModel::m_experimentalPrecursorMass
double m_experimentalPrecursorMass
Definition peptidemodel.h:218
pappso::specglob::PeptideModel::m_cterModification
pappso::AaModificationP m_cterModification
Definition peptidemodel.h:223
pappso::specglob::PeptideModel::mcsp_peakList
pappso::MassSpectrumCstSPtr mcsp_peakList
Definition peptidemodel.h:220
pappso::specglob::SpectralAlignmentType::nonAlign
@ nonAlign
the type of alignment to put in origin matrix NON Alignment (0 - NA)

References pappso::Peptide::getInternalCterModification(), pappso::Peptide::getInternalNterModification(), pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr(), pappso::QualifiedMassSpectrum::getPrecursorMass(), m_cterModification, m_experimentalPrecursorMass, m_nterModification, mcsp_peakList, and pappso::specglob::nonAlign.

## PeptideModel() [2/3]

pappso::specglob::PeptideModel::PeptideModel | ( |  | ) |

Definition at line 48 of file peptidemodel.cpp.

{
// not valid
}

## PeptideModel() [3/3]

pappso::specglob::PeptideModel::PeptideModel | ( | const PeptideModel & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 75 of file peptidemodel.cpp.

: std::vector<AminoAcidModel>(other)
{
m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
mcsp_peakList = other.mcsp_peakList;
m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
m_beginMassDelta = other.m_beginMassDelta;
m_nterModification = other.m_nterModification;
m_cterModification = other.m_cterModification;
m_countSharedPeaks = other.m_countSharedPeaks;
m_intensitySharedPeaks = other.m_intensitySharedPeaks;
m_intensityExperimentalPeaks = other.m_intensityExperimentalPeaks;
}
pappso::specglob::PeptideModel::m_intensitySharedPeaks
double m_intensitySharedPeaks
Definition peptidemodel.h:226
pappso::specglob::PeptideModel::m_intensityExperimentalPeaks
double m_intensityExperimentalPeaks
Definition peptidemodel.h:227
pappso::specglob::PeptideModel::m_beginMassDelta
double m_beginMassDelta
Definition peptidemodel.h:219
pappso::specglob::PeptideModel::m_countSharedPeaks
std::size_t m_countSharedPeaks
Definition peptidemodel.h:225

References m_beginMassDelta, m_countSharedPeaks, m_cterModification, m_experimentalPrecursorMass, m_intensityExperimentalPeaks, m_intensitySharedPeaks, m_nterModification, and mcsp_peakList.

## ~PeptideModel()

pappso::specglob::PeptideModel::~PeptideModel | ( |  | ) |

virtual

Destructor

Definition at line 120 of file peptidemodel.cpp.

{
}

## Member Function Documentation

## assignResidualMass2Cter()

void pappso::specglob::PeptideModel::assignResidualMass2Cter | ( |  | ) |

Definition at line 426 of file peptidemodel.cpp.

{
back().mass_difference = getMassDelta();
}
pappso::specglob::PeptideModel::getMassDelta
double getMassDelta() const
mass delta between experimental and theoretical mass
Definition peptidemodel.cpp:248

References getMassDelta().

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel().

## checkForAaModification()

bool pappso::specglob::PeptideModel::checkForAaModification | ( | const pappso::Aa & | aa_modified,
|  | pappso::PrecisionPtr | precision
| ) |  |

try to replace mass differences with the given modifications on a specific amino acid

Parameters

  aa_modified | the modified amino acid
  precision | The mass spectrometer precision

Returns
  true if model is modified

Definition at line 751 of file peptidemodel.cpp.

{
bool modif = false;
double mass_difference = m_beginMassDelta;
for(auto &aa_model : *this)
{
mass_difference += aa_model.mass_difference;
auto aa_ref = aa_model.amino_acid;
if(aa_ref.getLetter() == aa_modified.getLetter())
{
if(mass_difference != 0.0)
{
double mass_modification = aa_modified.getTotalModificationMass();
if(std::abs(mass_modification - mass_difference) <
precision->getNominal())
{
aa_model.mass_difference = 0;
for(auto &modification : aa_modified.getModificationList())
{
aa_model.amino_acid.addAaModification(modification);
}
modif = true;
}
}
}
mass_difference = 0;
}
return modif;
}
pappso::AaBase::getLetter
virtual const char & getLetter() const
Definition aabase.cpp:433
pappso::Aa::getTotalModificationMass
double getTotalModificationMass() const
get the sum of mass modifications
Definition aa.cpp:79
pappso::PrecisionBase::getNominal
virtual pappso_double getNominal() const final
Definition precision.cpp:65

References pappso::AaBase::getLetter(), pappso::Aa::getModificationList(), pappso::PrecisionBase::getNominal(), pappso::Aa::getTotalModificationMass(), and m_beginMassDelta.

## checkForAaModificationP()

bool pappso::specglob::PeptideModel::checkForAaModificationP | ( | pappso::AaModificationP | modification,
|  | pappso::PrecisionPtr | precision
| ) |  |

try to replace mass differences with the given modification

Parameters

  modification | : The proposed modification pointer
  precision | : The mass spectrometer precision

Returns
  true if model is modified

Definition at line 723 of file peptidemodel.cpp.

{
bool modif = false;
double mass_difference = m_beginMassDelta;
for(auto &aa_model : *this)
{
mass_difference += aa_model.mass_difference;
auto aa_ref = aa_model.amino_acid;
if(mass_difference != 0.0)
{
if(std::abs(modification->getMass() - mass_difference) <
precision->getNominal())
{
aa_model.mass_difference = 0;
aa_model.amino_acid.addAaModification(modification);
modif = true;
}
}
mass_difference = 0;
}
return modif;
}
pappso::AaModification::getMass
pappso_double getMass() const
Definition aamodification.cpp:854

References pappso::AaModification::getMass(), pappso::PrecisionBase::getNominal(), and m_beginMassDelta.

## checkForMutation()

bool pappso::specglob::PeptideModel::checkForMutation | ( | const pappso::Aa & | amino_acid_candidate,
|  | pappso::PrecisionPtr | precision
| ) |  |

try to replace mass differences with corresponding mutation mass delta

amino acid candidate tested could bear some modifications

Parameters

  amino_acid_candidate | : The amino acid candidate to check
  precision | : The mass spectrometer precision

Returns
  true if model is modified

Definition at line 617 of file peptidemodel.cpp.

{
bool modif = false;
double total_mass_to_insert = amino_acid_candidate.getMass();
auto insert_aa_modification =
AaModification::getInstanceInsertionAccessionByAaLetter(
amino_acid_candidate.getLetter());
double mass_difference = m_beginMassDelta;
for(auto &aa_model : *this)
{
mass_difference += aa_model.mass_difference;
auto aa_ref = aa_model.amino_acid;
if(mass_difference != 0.0)
{
mass_difference += aa_ref.getTotalModificationMass();
AaModificationP aa_ref_remove =
AaModification::getInstanceRemovalAccessionByAaLetter(
aa_model.amino_acid.getLetter());
// check for possible mutation
double current_diff =
(aa_ref_remove->getMass() - mass_difference) + total_mass_to_insert;
qDebug() << "current_diff=" << current_diff;
if(std::abs(current_diff) < precision->getNominal())
{
qDebug() << "modif = true=";
aa_model.mass_difference = 0;
aa_model.amino_acid.removeAllButInternalModification();
aa_model.amino_acid.addAaModification(aa_ref_remove);
aa_model.amino_acid.addAaModification(insert_aa_modification);
for(auto &mod : amino_acid_candidate.getModificationList())
{
aa_model.amino_acid.addAaModification(mod);
}
modif = true;
}
}
mass_difference = 0;
}
return modif;
}
pappso::AaModification::getInstanceRemovalAccessionByAaLetter
static AaModificationP getInstanceRemovalAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the removal of the given amino acid find the modifications th...
Definition aamodification.cpp:501
pappso::AaModification::getInstanceInsertionAccessionByAaLetter
static AaModificationP getInstanceInsertionAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the insertion of the given amino acid find the modifications.
Definition aamodification.cpp:607
pappso::Aa::getMass
pappso_double getMass() const override
Definition aa.cpp:90
pappso::AaModificationP
const AaModification * AaModificationP
Definition aamodification.h:52

References pappso::AaModification::getInstanceInsertionAccessionByAaLetter(), pappso::AaModification::getInstanceRemovalAccessionByAaLetter(), pappso::AaBase::getLetter(), pappso::AaModification::getMass(), pappso::Aa::getMass(), pappso::Aa::getModificationList(), pappso::PrecisionBase::getNominal(), and m_beginMassDelta.

## checkForMutations()

bool pappso::specglob::PeptideModel::checkForMutations | ( | const std::vector< AminoAcidChar > & | aa_list,
|  | pappso::PrecisionPtr | precision
| ) |  |

try to replace mass differences with corresponding mutations mass delta

amino acid list is tested as raw (no modification)

Parameters

  aa_list | amno acid list to test (beware of cysteine + carbamidomethyl)
  precision | : The mass spectrometer precision

Returns
  true if model is modified

Definition at line 663 of file peptidemodel.cpp.

{
bool modif = false;
// AaModificationP carbamido = AaModification::getInstance("MOD:00397");
// AaModificationP metox = AaModification::getInstance("MOD:00719");
std::vector<AaModificationP> modificationInsertList;
for(const auto aa : aa_list)
{
modificationInsertList.push_back(
AaModification::getInstanceInsertionAccessionByAaLetter((char)aa));
}
double mass_difference = m_beginMassDelta;
for(auto &aa_model : *this)
{
mass_difference += aa_model.mass_difference;
auto aa_ref = aa_model.amino_acid;
if(mass_difference != 0.0)
{
mass_difference += aa_ref.getTotalModificationMass();
AaModificationP aa_ref_remove =
AaModification::getInstanceRemovalAccessionByAaLetter(
aa_model.amino_acid.getLetter());
AaModificationP aa_ref_insert = nullptr;
double better_diff = 10;
// check for possible mutation
for(const auto aaInsertion : modificationInsertList)
{
double current_diff =
(aa_ref_remove->getMass() - mass_difference) +
aaInsertion->getMass();
qDebug() << aa_model.amino_acid.getLetter() << " "
<< aaInsertion->getName() << " "
<< aaInsertion->getMass() << " " << current_diff;
if(std::abs(current_diff) < std::abs(better_diff))
{
aa_ref_insert = aaInsertion;
better_diff = current_diff;
}
}
qDebug() << "better_diff=" << better_diff;
if((aa_ref_insert != nullptr) &&
(std::abs(better_diff) < precision->getNominal()))
{
qDebug() << "modif = true=";
aa_model.mass_difference = 0;
aa_model.amino_acid.removeAllButInternalModification();
aa_model.amino_acid.addAaModification(aa_ref_remove);
aa_model.amino_acid.addAaModification(aa_ref_insert);
modif = true;
}
}
mass_difference = 0;
}
return modif;
}

References pappso::AaModification::getInstanceInsertionAccessionByAaLetter(), pappso::AaModification::getInstanceRemovalAccessionByAaLetter(), pappso::AaModification::getMass(), pappso::PrecisionBase::getNominal(), and m_beginMassDelta.

## copyDeep()

PeptideModel & pappso::specglob::PeptideModel::copyDeep | ( | const PeptideModel & | other | ) |

Definition at line 112 of file peptidemodel.cpp.

{
operator=(other);
m_theoreticalPeakList = other.m_theoreticalPeakList;
return *this;
}
pappso::specglob::PeptideModel::m_theoreticalPeakList
std::vector< TheoreticalPeakDataPoint > m_theoreticalPeakList
Definition peptidemodel.h:216
pappso::specglob::PeptideModel::operator=
PeptideModel & operator=(const PeptideModel &other)
Definition peptidemodel.cpp:92

References m_theoreticalPeakList, and operator=().

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel(), pappso::specglob::PostTreatment::tryBetterPositionOffsets(), pappso::specglob::PostTreatment::tryToCumulateOffSets(), and pappso::specglob::PostTreatment::tryToRemoveOffsets().

## eliminateComplementaryDelta()

bool pappso::specglob::PeptideModel::eliminateComplementaryDelta | ( | pappso::PrecisionPtr | precision | ) |

Use to delete offset when there is two opposite mass in the hit modified example : [150.2]SDS[-150.2]KR --> SDSKR

Parameters

  precision | : The mass spectrometer precision

Returns
  true if model is modified

Definition at line 432 of file peptidemodel.cpp.

{
double precision_ref = precision->getNominal();
double offset = 0;
bool modified = false;
std::vector<AminoAcidModel>::iterator it_begin_block = end();
if(std::abs(m_beginMassDelta) > precision_ref)
{
it_begin_block = begin();
offset = m_beginMassDelta;
qDebug() << " new block offset=" << offset;
}
qDebug() << offset;
for(auto it = begin(); it != end(); it++)
{
qDebug() << " it->mass_difference=" << it->mass_difference;
if(it_begin_block == end())
{
if(std::abs(it->mass_difference) > precision_ref)
{
// new block
it_begin_block = it;
offset = it->mass_difference;
}
qDebug() << " new block offset=" << offset;
}
if(it_begin_block != end())
{
// existing block
qDebug() << " existing block offset=" << offset;
if(it == begin())
{
offset += it->mass_difference;
}
else
{
// where is the end of the block ?
qDebug() << " where is the end of the block ? offset=" << offset;
auto it_end_block = std::find_if(
it,
end(),
[offset, precision_ref](const AminoAcidModel &point) {
qDebug() << point.mass_difference << " "
<< offset + point.mass_difference;
if(std::abs(offset + point.mass_difference) <= precision_ref)
return true;
return false;
});
if(it_end_block != end())
{
// eliminate mass mass_difference
modified = true;
if(it_begin_block == begin())
m_beginMassDelta = 0;
it_begin_block->mass_difference = 0.0;
it_end_block->mass_difference = 0.0;
// start new block search
it_begin_block = end();
offset = 0;
qDebug() << " existing block end block found";
}
else
{
qDebug() << " existing block end block not found offset="
<< offset;
// close block
it_begin_block = end();
offset = 0;
}
}
}
}
qDebug() << toString();
return modified;
}
pappso::specglob::PeptideModel::toString
QString toString() const
Definition peptidemodel.cpp:125

References pappso::PrecisionBase::getNominal(), m_beginMassDelta, pappso::specglob::AminoAcidModel::mass_difference, and toString().

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel().

## eliminateNegativeOffset()

bool pappso::specglob::PeptideModel::eliminateNegativeOffset | ( | pappso::PrecisionPtr | precision | ) |

Use to try to explain negative offset with deletion of amino acids

Parameters

  precision | : The mass spectrometer precision

Returns
  true if model is modified

Definition at line 513 of file peptidemodel.cpp.

{ // System.out.println("Elimination des neg offsets");
double precision_ref = precision->getNominal();
auto it_reverse = rbegin();
bool modified = false;
while(it_reverse != rend())
{
if(it_reverse->remove)
{
// this is a part of already removed block
}
else
{
double mass_difference = it_reverse->mass_difference;
if(mass_difference < 0)
{
// try to find an amino acid blocl of that mass
double cumul_mass_aa = 0;
auto it_block_end = it_reverse;
while(it_block_end != rend())
{
cumul_mass_aa += it_block_end->amino_acid.getMass();
it_block_end++;
if(std::abs(mass_difference + cumul_mass_aa) < precision_ref)
{
modified = true;
// block found -> remove this range
for(auto it_block = it_reverse; it_block != it_block_end;
it_block++)
{
it_block->remove = true;
}
}
else
{
if((it_block_end != rend()) &&
(it_block_end->mass_difference != 0.0))
{
// interrupted block
break;
}
}
}
}
}
it_reverse++;
}
return modified;
}

References pappso::PrecisionBase::getNominal().

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel().

## generateTheoreticalPeaks()

void pappso::specglob::PeptideModel::generateTheoreticalPeaks | ( | pappso::PrecisionPtr | precision | ) |

private

Definition at line 352 of file peptidemodel.cpp.

{
m_theoreticalPeakList.clear();
double cumul_mass = m_beginMassDelta + m_nterModification->getMass() -
pappso::MPROTIUM + pappso::MHPLUS;
auto it_expe_peaks_end = mcsp_peakList.get()->end();
std::size_t i = 0;
for(auto aa_model : *this)
{
// compute B ions
cumul_mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
qDebug() << cumul_mass;
m_theoreticalPeakList.push_back(
{pappso::MzRange(cumul_mass, precision), it_expe_peaks_end, i});
i++;
}
// remove the complete ion B (entire peptide, no fragment):
m_theoreticalPeakList.pop_back();
std::size_t bmaxindice = m_theoreticalPeakList.size();
double yion_delta =
pappso::PeptideRawFragmentMasses::getDeltaMass(pappso::PeptideIon::y);
cumul_mass += yion_delta + pappso::MHPLUS;
for(std::size_t i = 0; i < bmaxindice; i++)
{
m_theoreticalPeakList.push_back(
{pappso::MzRange(cumul_mass - m_theoreticalPeakList[i].mz_range.getMz(),
precision),
it_expe_peaks_end,
i + 1});
qDebug() << m_theoreticalPeakList.back().mz_range.getMz();
}
std::sort(
m_theoreticalPeakList.begin(),
m_theoreticalPeakList.end(),
[](const TheoreticalPeakDataPoint &a, const TheoreticalPeakDataPoint &b) {
return a.mz_range.getMz() < b.mz_range.getMz();
});
}
pappso::MzRange
Definition mzrange.h:46
pappso::PeptideRawFragmentMasses::getDeltaMass
static pappso_double getDeltaMass(PeptideIon ion_type)
Definition peptiderawfragmentmasses.cpp:56
pappso::PeptideIon::y
@ y
Cter amino ions.
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::b
@ b
pappso::MHPLUS
const pappso_double MHPLUS(1.007276466879)
pappso::MPROTIUM
const pappso_double MPROTIUM(1.007825032241)

References pappso::a, pappso::b, pappso::PeptideRawFragmentMasses::getDeltaMass(), pappso::AaModification::getMass(), m_beginMassDelta, m_nterModification, m_theoreticalPeakList, mcsp_peakList, pappso::MHPLUS(), pappso::MPROTIUM(), and pappso::y.

Referenced by matchExperimentalPeaks().

## getCountSharedPeaks()

std::size_t pappso::specglob::PeptideModel::getCountSharedPeaks | ( |  | ) | const

Definition at line 408 of file peptidemodel.cpp.

{
return m_countSharedPeaks;
}

References m_countSharedPeaks.

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel(), pappso::specglob::PostTreatment::tryBetterPositionOffsets(), pappso::specglob::PostTreatment::tryToCumulateOffSets(), and pappso::specglob::PostTreatment::tryToRemoveOffsets().

## getIntensityExperimentalPeaks()

double pappso::specglob::PeptideModel::getIntensityExperimentalPeaks | ( |  | ) | const

Definition at line 420 of file peptidemodel.cpp.

{
return m_intensityExperimentalPeaks;
}

References m_intensityExperimentalPeaks.

## getIntensitySharedPeaks()

double pappso::specglob::PeptideModel::getIntensitySharedPeaks | ( |  | ) | const

Definition at line 414 of file peptidemodel.cpp.

{
return m_intensitySharedPeaks;
}

References m_intensitySharedPeaks.

## getMass()

double pappso::specglob::PeptideModel::getMass | ( |  | ) | const

Definition at line 232 of file peptidemodel.cpp.

{
double mass = m_beginMassDelta;
if(m_cterModification != nullptr)
mass += m_cterModification->getMass();
if(m_nterModification != nullptr)
mass += m_nterModification->getMass();
for(auto aa_model : *this)
{
mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
}
return mass;
}

References pappso::AaModification::getMass(), m_beginMassDelta, m_cterModification, and m_nterModification.

Referenced by getMassDelta().

## getMassDelta()

double pappso::specglob::PeptideModel::getMassDelta | ( |  | ) | const

mass delta between experimental and theoretical mass

Definition at line 248 of file peptidemodel.cpp.

{
return m_experimentalPrecursorMass - getMass();
}
pappso::specglob::PeptideModel::getMass
double getMass() const
Definition peptidemodel.cpp:232

References getMass(), and m_experimentalPrecursorMass.

Referenced by assignResidualMass2Cter(), pappso::specglob::PostTreatment::findBetterPeptideModel(), toString(), and pappso::specglob::PostTreatment::tryToCumulateOffSets().

## getTheoreticalIonMassList()

std::vector< double > pappso::specglob::PeptideModel::getTheoreticalIonMassList | ( |  | ) | const

Definition at line 397 of file peptidemodel.cpp.

{
std::vector<double> mass_list;
for(auto &datapoint : m_theoreticalPeakList)
{
mass_list.push_back(datapoint.mz_range.getMz());
}
return mass_list;
}

References m_theoreticalPeakList.

## getTheoreticalPeakDataPointList()

const std::vector< TheoreticalPeakDataPoint > & pappso::specglob::PeptideModel::getTheoreticalPeakDataPointList | ( |  | ) | const

Definition at line 589 of file peptidemodel.cpp.

{
return m_theoreticalPeakList;
}

References m_theoreticalPeakList.

## getTheoreticalPeakDataPointListToString()

QString pappso::specglob::PeptideModel::getTheoreticalPeakDataPointListToString | ( |  | ) | const

Definition at line 595 of file peptidemodel.cpp.

{
auto it_expe_peaks_end = mcsp_peakList.get()->end();
QString str;
for(auto &theo_peak : m_theoreticalPeakList)
{
double intensity = 0;
if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
{
intensity = theo_peak.it_experimental_peak_match->y;
}
str.append(QString("{%1,%2,%3,%4}")
.arg(theo_peak.mz_range.getMz())
.arg(intensity)
.arg(theo_peak.aa_indice)
.arg(at(theo_peak.aa_indice).amino_acid.toString()));
}
return str;
}

References m_theoreticalPeakList, and mcsp_peakList.

## matchExperimentalPeaks()

void pappso::specglob::PeptideModel::matchExperimentalPeaks | ( | pappso::PrecisionPtr | precision | ) |

Definition at line 274 of file peptidemodel.cpp.

{
if(m_theoreticalPeakList.size() == 0)
{
m_intensityExperimentalPeaks = mcsp_peakList.get()->totalIonCurrent();
generateTheoreticalPeaks(precision);
}
auto it_expe_peaks_end = mcsp_peakList.get()->end();
auto it_expe_peaks = mcsp_peakList.get()->begin();
auto it_theo_peaks = m_theoreticalPeakList.begin();
while((it_expe_peaks != mcsp_peakList.get()->end()) &&
(it_theo_peaks != m_theoreticalPeakList.end()))
{
while((it_expe_peaks != mcsp_peakList.get()->end()) &&
(it_expe_peaks->x < it_theo_peaks->mz_range.lower()))
{ // find the first possible ion hit
it_expe_peaks++;
}
if(it_expe_peaks == mcsp_peakList.get()->end())
continue;
if(it_expe_peaks->x < it_theo_peaks->mz_range.upper())
{
// ok, we've got a hit
auto it_theo_peaks_loop = it_theo_peaks;
while((it_theo_peaks_loop != m_theoreticalPeakList.end()) &&
(it_theo_peaks_loop->mz_range.contains(it_expe_peaks->x)))
{
if((it_theo_peaks_loop->it_experimental_peak_match ==
it_expe_peaks_end) ||
(it_theo_peaks_loop->it_experimental_peak_match->y <
it_expe_peaks->y))
{
it_theo_peaks_loop->it_experimental_peak_match =
it_expe_peaks;
qDebug() << "match: mz=" << it_expe_peaks->x
<< " intensity=" << it_expe_peaks->y;
break;
}
it_theo_peaks_loop++;
}
it_expe_peaks++;
}
else
{
it_theo_peaks++;
}
// it_expe_peaks++;
}
// get number of shared peaks
m_countSharedPeaks = 0;
m_intensitySharedPeaks = 0;
std::vector<std::vector<pappso::DataPoint>::const_iterator>
matched_experimental_peaks;
for(auto &theo_peak : m_theoreticalPeakList)
{
if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
{
matched_experimental_peaks.push_back(
theo_peak.it_experimental_peak_match);
// m_countSharedPeaks++;
}
}
auto it_end = std::unique(matched_experimental_peaks.begin(),
matched_experimental_peaks.end());
m_countSharedPeaks =
std::distance(matched_experimental_peaks.begin(), it_end);
m_intensitySharedPeaks = std::accumulate(
matched_experimental_peaks.begin(),
it_end,
0.0,
[](double k, const std::vector<pappso::DataPoint>::const_iterator &l) {
return (k + l->y);
});
}
pappso::specglob::PeptideModel::generateTheoreticalPeaks
void generateTheoreticalPeaks(pappso::PrecisionPtr precision)
Definition peptidemodel.cpp:352

References generateTheoreticalPeaks(), m_countSharedPeaks, m_intensityExperimentalPeaks, m_intensitySharedPeaks, m_theoreticalPeakList, and mcsp_peakList.

Referenced by pappso::specglob::PostTreatment::PostTreatment(), pappso::specglob::PostTreatment::findBetterPeptideModel(), pappso::specglob::PostTreatment::tryBetterPositionOffsets(), pappso::specglob::PostTreatment::tryToCumulateOffSets(), and pappso::specglob::PostTreatment::tryToRemoveOffsets().

## modifCount()

std::size_t pappso::specglob::PeptideModel::modifCount | ( |  | ) | const

Definition at line 254 of file peptidemodel.cpp.

{
std::size_t count = 0;
if(m_beginMassDelta != 0.0)
count++;
for(auto aa_model : *this)
{
if(aa_model.mass_difference != 0.0)
count++;
}
return count;
}

References m_beginMassDelta.

## operator=()

PeptideModel & pappso::specglob::PeptideModel::operator= | ( | const PeptideModel & | other | ) |

Definition at line 92 of file peptidemodel.cpp.

{
assign(other.begin(), other.end());
m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
mcsp_peakList = other.mcsp_peakList;
m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
m_beginMassDelta = other.m_beginMassDelta;
m_nterModification = other.m_nterModification;
m_cterModification = other.m_cterModification;
m_countSharedPeaks = other.m_countSharedPeaks;
m_intensitySharedPeaks = other.m_intensitySharedPeaks;
m_intensityExperimentalPeaks = other.m_intensityExperimentalPeaks;
m_theoreticalPeakList.clear();
return *this;
}

References m_beginMassDelta, m_countSharedPeaks, m_cterModification, m_experimentalPrecursorMass, m_intensityExperimentalPeaks, m_intensitySharedPeaks, m_nterModification, m_theoreticalPeakList, and mcsp_peakList.

Referenced by copyDeep().

## removeBracketsForAlignedAA()

bool pappso::specglob::PeptideModel::removeBracketsForAlignedAA | ( |  | ) |

Use to remove brackets around not found Amino acids when the B or Y peak corresponding to the amino acid in the sequence is in the experimental peak list

Parameters

  betterModified | : The better sequence of hit Modified
  experimentalMassList | : The list of mass that are in the experimental spectrum
  precision | : The precision of the mass spectrometer

Returns
  the new sequence without brackets around found amino acids after all post treatments

Definition at line 566 of file peptidemodel.cpp.

{
if(m_theoreticalPeakList.size() == 0)
{
throw pappso::PappsoException("missing peak matching");
}
bool modified = false;
auto it_expe_peaks_end = mcsp_peakList.get()->end();
for(auto &theo_peak : m_theoreticalPeakList)
{
if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
{
if(at(theo_peak.aa_indice).bracket == true)
{
modified = true;
at(theo_peak.aa_indice).bracket = false;
}
}
}
return modified;
}
pappso::PappsoException
Definition pappsoexception.h:42

References m_theoreticalPeakList, and mcsp_peakList.

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel().

## setBeginMassDelta()

void pappso::specglob::PeptideModel::setBeginMassDelta | ( | double | delta | ) |

Definition at line 268 of file peptidemodel.cpp.

{
m_beginMassDelta = delta;
}

References m_beginMassDelta.

Referenced by pappso::specglob::SpectralAlignment::buildPeptideModel().

## toProForma()

QString pappso::specglob::PeptideModel::toProForma | ( |  | ) | const

get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README.md

Returns
  QString as described in ProForma

Definition at line 175 of file peptidemodel.cpp.

{
QString peptide_str;
// if(m_beginMassDelta != 0.0)
// peptide_str.append(
// QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
double mass_diff = m_beginMassDelta;
for(auto aa_model : *this)
{
qDebug() << " aa_model.amino_acid.toString()="
<< aa_model.amino_acid.toAbsoluteString()
<< " aa_model.alignment_type="
<< Utils::toString(aa_model.alignment_type)
<< " aa_model.mass_difference=" << aa_model.mass_difference
<< " aa_model.bracket=" << aa_model.bracket;
if(aa_model.bracket)
{
}
if(aa_model.remove)
{
peptide_str.append(aa_model.amino_acid.getLetter());
peptide_str.append(
"[" +
AaModification::getInstanceRemovalAccessionByAaLetter(
aa_model.amino_acid.getLetter())
->getAccession() +
"]");
}
else
{
peptide_str.append(aa_model.amino_acid.toProForma());
mass_diff += aa_model.mass_difference;
if(mass_diff != 0.0)
{
if(mass_diff > 0)
{
peptide_str.append(
QString("[+%1]").arg(QString::number(mass_diff, 'f', 4)));
}
else
{
peptide_str.append(
QString("[%1]").arg(QString::number(mass_diff, 'f', 4)));
}
}
}
mass_diff = 0.0;
}
return peptide_str;
}
pappso::AaModification::getAccession
const QString & getAccession() const
Definition aamodification.cpp:91
pappso::Utils::toString
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:489

References pappso::AaModification::getAccession(), pappso::AaModification::getInstanceRemovalAccessionByAaLetter(), m_beginMassDelta, and pappso::Utils::toString().

## toString()

QString pappso::specglob::PeptideModel::toString | ( |  | ) | const

Definition at line 125 of file peptidemodel.cpp.

{
QString peptide_str;
if(m_beginMassDelta != 0.0)
peptide_str.append(
QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
for(auto aa_model : *this)
{
qDebug() << " aa_model.amino_acid.toString()="
<< aa_model.amino_acid.toAbsoluteString()
<< " aa_model.alignment_type="
<< Utils::toString(aa_model.alignment_type)
<< " aa_model.mass_difference=" << aa_model.mass_difference
<< " aa_model.bracket=" << aa_model.bracket;
if(aa_model.remove)
peptide_str.append("-(");
if(aa_model.bracket)
{
peptide_str.append(
QString("[%1]").arg(aa_model.amino_acid.toString()));
}
else
{
peptide_str.append(aa_model.amino_acid.toString());
}
if(aa_model.mass_difference != 0.0)
{
peptide_str.append(QString("[%1]").arg(
QString::number(aa_model.mass_difference, 'f', 2)));
}
if(aa_model.remove)
peptide_str.append(")");
}
peptide_str.replace(")-(", "");
peptide_str.append(
QString("_[%1]").arg(QString::number(getMassDelta(), 'f', 2)));
peptide_str.replace("_[0.00]", "");
peptide_str.replace("_[-0.00]", "");
return peptide_str;
}

References getMassDelta(), m_beginMassDelta, and pappso::Utils::toString().

Referenced by eliminateComplementaryDelta(), pappso::specglob::PostTreatment::findBetterPeptideModel(), pappso::specglob::PostTreatment::tryBetterPositionOffsets(), and pappso::specglob::PostTreatment::tryToRemoveOffsets().

## Member Data Documentation

## m_beginMassDelta

double pappso::specglob::PeptideModel::m_beginMassDelta = 0

private

Definition at line 219 of file peptidemodel.h.

Referenced by PeptideModel(), checkForAaModification(), checkForAaModificationP(), checkForMutation(), checkForMutations(), eliminateComplementaryDelta(), generateTheoreticalPeaks(), getMass(), modifCount(), operator=(), setBeginMassDelta(), toProForma(), and toString().

## m_countSharedPeaks

std::size_t pappso::specglob::PeptideModel::m_countSharedPeaks = 0

private

Definition at line 225 of file peptidemodel.h.

Referenced by PeptideModel(), getCountSharedPeaks(), matchExperimentalPeaks(), and operator=().

## m_cterModification

pappso::AaModificationP pappso::specglob::PeptideModel::m_cterModification

private

Definition at line 223 of file peptidemodel.h.

Referenced by PeptideModel(), PeptideModel(), getMass(), and operator=().

## m_experimentalPrecursorMass

double pappso::specglob::PeptideModel::m_experimentalPrecursorMass

private

Definition at line 218 of file peptidemodel.h.

Referenced by PeptideModel(), PeptideModel(), getMassDelta(), and operator=().

## m_intensityExperimentalPeaks

double pappso::specglob::PeptideModel::m_intensityExperimentalPeaks = 0

private

Definition at line 227 of file peptidemodel.h.

Referenced by PeptideModel(), getIntensityExperimentalPeaks(), matchExperimentalPeaks(), and operator=().

## m_intensitySharedPeaks

double pappso::specglob::PeptideModel::m_intensitySharedPeaks = 0

private

Definition at line 226 of file peptidemodel.h.

Referenced by PeptideModel(), getIntensitySharedPeaks(), matchExperimentalPeaks(), and operator=().

## m_nterModification

pappso::AaModificationP pappso::specglob::PeptideModel::m_nterModification

private

Definition at line 222 of file peptidemodel.h.

Referenced by PeptideModel(), PeptideModel(), generateTheoreticalPeaks(), getMass(), and operator=().

## m_theoreticalPeakList

std::vector<TheoreticalPeakDataPoint> pappso::specglob::PeptideModel::m_theoreticalPeakList

private

Definition at line 216 of file peptidemodel.h.

Referenced by copyDeep(), generateTheoreticalPeaks(), getTheoreticalIonMassList(), getTheoreticalPeakDataPointList(), getTheoreticalPeakDataPointListToString(), matchExperimentalPeaks(), operator=(), and removeBracketsForAlignedAA().

## mcsp_peakList

pappso::MassSpectrumCstSPtr pappso::specglob::PeptideModel::mcsp_peakList = nullptr

private

Definition at line 220 of file peptidemodel.h.

Referenced by PeptideModel(), PeptideModel(), generateTheoreticalPeaks(), getTheoreticalPeakDataPointListToString(), matchExperimentalPeaks(), operator=(), and removeBracketsForAlignedAA().

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

- pappsomspp/processing/specglob/peptidemodel.h
- pappsomspp/processing/specglob/peptidemodel.cpp