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

`#include <posttreatment.h>`

## Public Member Functions

| PostTreatment (pappso::PrecisionPtr precision, const PeptideModel &peptide_model)
virtual | ~PostTreatment ()
const PeptideModel & | getBetterPeptideModel () const
const PeptideModel & | getOriginalPeptideModel () const
bool | findReplaceMutations ()

## Private Member Functions

void | findBetterPeptideModel ()
| whole processus to find a better peptide model
void | tryBetterPositionOffsets ()
| try to move offset (mass difference)
void | tryToRemoveOffsets ()
| try to remove offset (mass difference)
void | tryToCumulateOffSets ()
| try to assign residual mass delta to non aligned elements

## Private Attributes

PeptideModel | m_originalPeptideModel
PeptideModel | m_betterPeptideModel
pappso::PrecisionPtr | m_precision

## Detailed Description

Todo
  write docs

Definition at line 52 of file posttreatment.h.

## Constructor & Destructor Documentation

## PostTreatment()

pappso::specglob::PostTreatment::PostTreatment | ( | pappso::PrecisionPtr | precision,
|  | const PeptideModel & | peptide_model )

Default constructor

Definition at line 45 of file posttreatment.cpp.

: m_originalPeptideModel(peptide_model), m_betterPeptideModel(peptide_model)
{
m_precision = precision;
m_originalPeptideModel.matchExperimentalPeaks(m_precision);
findBetterPeptideModel();
}
pappso::specglob::PostTreatment::m_precision
pappso::PrecisionPtr m_precision
Definition posttreatment.h:114
pappso::specglob::PostTreatment::findBetterPeptideModel
void findBetterPeptideModel()
whole processus to find a better peptide model
Definition posttreatment.cpp:65
pappso::specglob::PostTreatment::m_betterPeptideModel
PeptideModel m_betterPeptideModel
Definition posttreatment.h:113
pappso::specglob::PostTreatment::m_originalPeptideModel
PeptideModel m_originalPeptideModel
Definition posttreatment.h:112

References findBetterPeptideModel(), m_betterPeptideModel, m_originalPeptideModel, and m_precision.

## ~PostTreatment()

pappso::specglob::PostTreatment::~PostTreatment | ( |  | ) |

virtual

Destructor

Definition at line 54 of file posttreatment.cpp.

{
}

## Member Function Documentation

## findBetterPeptideModel()

void pappso::specglob::PostTreatment::findBetterPeptideModel | ( |  | ) |

private

whole processus to find a better peptide model

assign residual mass to Cter remove complementary mass delta eliminate negative offsets (perhaps neutral loss) check negative offsets for amino acid mass sums to remove try better positions for mass delta

Definition at line 65 of file posttreatment.cpp.

{
if(std::abs(m_originalPeptideModel.getMassDelta()) > m_precision->getNominal())
{
// calculate the number of shared peaks with the deltaM on the last aa
m_betterPeptideModel.assignResidualMass2Cter();
m_betterPeptideModel.matchExperimentalPeaks(m_precision);
if(m_betterPeptideModel.getCountSharedPeaks() > m_originalPeptideModel.getCountSharedPeaks())
{
}
else
{
// not better, get back to original peptide
m_betterPeptideModel.copyDeep(m_originalPeptideModel);
}
}
else
{
m_betterPeptideModel.matchExperimentalPeaks(m_precision);
}
// Try to remove complementary mass offset
// Not done if the number of peaks is increased by more than two peaks
// If the number of peaks > +2, it is considered as an information that must
// be kept in the alignment Could be modified...the information is in the
// preAligned column
PeptideModel test_peptide_model_remove_complementary(m_betterPeptideModel);
if(test_peptide_model_remove_complementary.eliminateComplementaryDelta(m_precision))
{
test_peptide_model_remove_complementary.matchExperimentalPeaks(m_precision);
qDebug() << "test_peptide_model_remove_complementary.getCountSharedPeaks()="
<< test_peptide_model_remove_complementary.getCountSharedPeaks()
<< " m_betterPeptideModel.getCountSharedPeaks()="
<< m_betterPeptideModel.getCountSharedPeaks();
if(test_peptide_model_remove_complementary.getCountSharedPeaks() <
m_betterPeptideModel.getCountSharedPeaks() + 2)
{
qDebug() << "replace with " << test_peptide_model_remove_complementary.toString();
m_betterPeptideModel.copyDeep(test_peptide_model_remove_complementary);
}
}
// if bestModified contains negative offSet, try to remove amino acids to
// explain it
PeptideModel test_peptide_model_remove_negative = m_betterPeptideModel;
if(test_peptide_model_remove_negative.eliminateNegativeOffset(m_precision))
{
test_peptide_model_remove_negative.matchExperimentalPeaks(m_precision);
if(test_peptide_model_remove_negative.getCountSharedPeaks() >=
m_betterPeptideModel.getCountSharedPeaks())
{
qDebug() << "replace with " << test_peptide_model_remove_negative.toString();
m_betterPeptideModel.copyDeep(test_peptide_model_remove_negative);
}
}
// findBetterMassDifferencePosition
tryToRemoveOffsets();
tryBetterPositionOffsets();
if(m_betterPeptideModel.getMassDelta() < -m_precision->getNominal())
{
tryToCumulateOffSets();
}
m_betterPeptideModel.removeBracketsForAlignedAA();
}
pappso::specglob::PostTreatment::tryToCumulateOffSets
void tryToCumulateOffSets()
try to assign residual mass delta to non aligned elements
Definition posttreatment.cpp:240
pappso::specglob::PostTreatment::tryToRemoveOffsets
void tryToRemoveOffsets()
try to remove offset (mass difference)
Definition posttreatment.cpp:201
pappso::specglob::PostTreatment::tryBetterPositionOffsets
void tryBetterPositionOffsets()
try to move offset (mass difference)
Definition posttreatment.cpp:138

References pappso::specglob::PeptideModel::eliminateComplementaryDelta(), pappso::specglob::PeptideModel::eliminateNegativeOffset(), pappso::specglob::PeptideModel::getCountSharedPeaks(), m_betterPeptideModel, m_originalPeptideModel, m_precision, pappso::specglob::PeptideModel::matchExperimentalPeaks(), pappso::specglob::PeptideModel::toString(), tryBetterPositionOffsets(), tryToCumulateOffSets(), and tryToRemoveOffsets().

Referenced by PostTreatment().

## findReplaceMutations()

bool pappso::specglob::PostTreatment::findReplaceMutations | ( |  | ) |

Definition at line 281 of file posttreatment.cpp.

{
auto peptide_model = m_betterPeptideModel;
bool modif = false;
std::vector<Enums::AminoAcidChar> aa_list = {Enums::AminoAcidChar::alanine,
Enums::AminoAcidChar::aspartic_acid,
Enums::AminoAcidChar::glutamic_acid,
Enums::AminoAcidChar::phenylalanine,
Enums::AminoAcidChar::glycine,
Enums::AminoAcidChar::histidine,
Enums::AminoAcidChar::isoleucine,
Enums::AminoAcidChar::lysine,
Enums::AminoAcidChar::leucine,
Enums::AminoAcidChar::methionine,
Enums::AminoAcidChar::asparagine,
Enums::AminoAcidChar::proline,
Enums::AminoAcidChar::glutamine,
Enums::AminoAcidChar::arginine,
Enums::AminoAcidChar::serine,
Enums::AminoAcidChar::threonine,
Enums::AminoAcidChar::valine,
Enums::AminoAcidChar::tryptophan,
Enums::AminoAcidChar::tyrosine};
if(peptide_model.checkForMutations(aa_list, m_precision))
{
modif = true;
}
pappso::Aa cysteine('C');
cysteine.addAaModification(pappso::AaModification::getInstance("MOD:00397")); // carbamido
if(peptide_model.checkForMutation(cysteine, m_precision))
{
modif = true;
}
pappso::Aa methionine('M');
methionine.addAaModification(pappso::AaModification::getInstance("MOD:00719")); // oxydation
if(peptide_model.checkForMutation(methionine, m_precision))
{
modif = true;
}
if(modif)
{
m_betterPeptideModel = peptide_model;
}
return modif;
}
pappso::AaModification::getInstance
static AaModificationP getInstance(const QString &accession)
Definition aamodification.cpp:368
pappso::Enums::AminoAcidChar::lysine
@ lysine
Definition types.h:205
pappso::Enums::AminoAcidChar::tyrosine
@ tyrosine
Definition types.h:216
pappso::Enums::AminoAcidChar::glycine
@ glycine
Definition types.h:202
pappso::Enums::AminoAcidChar::methionine
@ methionine
Definition types.h:207
pappso::Enums::AminoAcidChar::cysteine
@ cysteine
Definition types.h:198
pappso::Enums::AminoAcidChar::proline
@ proline
Definition types.h:209
pappso::Enums::AminoAcidChar::asparagine
@ asparagine
Definition types.h:208
pappso::Enums::AminoAcidChar::histidine
@ histidine
Definition types.h:203
pappso::Enums::AminoAcidChar::alanine
@ alanine
Definition types.h:197
pappso::Enums::AminoAcidChar::glutamic_acid
@ glutamic_acid
Definition types.h:200
pappso::Enums::AminoAcidChar::leucine
@ leucine
Definition types.h:206
pappso::Enums::AminoAcidChar::arginine
@ arginine
Definition types.h:211
pappso::Enums::AminoAcidChar::threonine
@ threonine
Definition types.h:213
pappso::Enums::AminoAcidChar::serine
@ serine
Definition types.h:212
pappso::Enums::AminoAcidChar::phenylalanine
@ phenylalanine
Definition types.h:201
pappso::Enums::AminoAcidChar::valine
@ valine
Definition types.h:214
pappso::Enums::AminoAcidChar::aspartic_acid
@ aspartic_acid
Definition types.h:199
pappso::Enums::AminoAcidChar::tryptophan
@ tryptophan
Definition types.h:215
pappso::Enums::AminoAcidChar::isoleucine
@ isoleucine
Definition types.h:204
pappso::Enums::AminoAcidChar::glutamine
@ glutamine
Definition types.h:210

References pappso::Enums::alanine, pappso::Enums::arginine, pappso::Enums::asparagine, pappso::Enums::aspartic_acid, pappso::AaModification::getInstance(), pappso::Enums::glutamic_acid, pappso::Enums::glutamine, pappso::Enums::glycine, pappso::Enums::histidine, pappso::Enums::isoleucine, pappso::Enums::leucine, pappso::Enums::lysine, m_betterPeptideModel, m_precision, pappso::Enums::methionine, pappso::Enums::phenylalanine, pappso::Enums::proline, pappso::Enums::serine, pappso::Enums::threonine, pappso::Enums::tryptophan, pappso::Enums::tyrosine, and pappso::Enums::valine.

Referenced by pappso::cbor::psm::PsmSpecGlobScan::process().

## getBetterPeptideModel()

const PeptideModel & pappso::specglob::PostTreatment::getBetterPeptideModel | ( |  | ) | const

Definition at line 59 of file posttreatment.cpp.

{
return m_betterPeptideModel;
}

References m_betterPeptideModel.

Referenced by pappso::cbor::psm::PsmSpecGlobScan::process().

## getOriginalPeptideModel()

const PeptideModel & pappso::specglob::PostTreatment::getOriginalPeptideModel | ( |  | ) | const

Definition at line 275 of file posttreatment.cpp.

{
return m_originalPeptideModel;
}

References m_originalPeptideModel.

## tryBetterPositionOffsets()

void pappso::specglob::PostTreatment::tryBetterPositionOffsets | ( |  | ) |

private

try to move offset (mass difference)

for each mass difference position, try to move to other position if the amino acid is not aligned, count matched peaks and compare to the previous solution. Keep only the better position

Definition at line 138 of file posttreatment.cpp.

{
PeptideModel better_peptide_model_move_offset = m_betterPeptideModel;
std::size_t best_count_shared_peaks = m_betterPeptideModel.getCountSharedPeaks();
qDebug() << best_count_shared_peaks;
qDebug() << m_betterPeptideModel.toString();
bool move = false;
for(std::size_t i = 0; i < m_betterPeptideModel.size(); i++)
{
qDebug() << "i =" << i;
if(m_betterPeptideModel.at(i).remove == true)
continue;
if(m_betterPeptideModel.at(i).mass_difference == 0.0)
continue;
if(m_betterPeptideModel.at(i).bracket == true)
{
// try to move if
double mass_diff = m_betterPeptideModel.at(i).mass_difference;
PeptideModel test_peptide_model_move_offset = better_peptide_model_move_offset;
test_peptide_model_move_offset.at(i).mass_difference = 0;
qDebug() << test_peptide_model_move_offset.toString();
std::size_t j = i;
while(j > 0)
{
j -= 1;
if(test_peptide_model_move_offset.at(j).bracket == false)
break;
if(test_peptide_model_move_offset.at(j).mass_difference != 0.0)
break;
test_peptide_model_move_offset.at(j).mass_difference = mass_diff;
test_peptide_model_move_offset.matchExperimentalPeaks(m_precision);
qDebug() << test_peptide_model_move_offset.toString() << " "
<< test_peptide_model_move_offset.getCountSharedPeaks() << " "
<< best_count_shared_peaks;
if(test_peptide_model_move_offset.getCountSharedPeaks() > best_count_shared_peaks)
{
best_count_shared_peaks = test_peptide_model_move_offset.getCountSharedPeaks();
better_peptide_model_move_offset.copyDeep(test_peptide_model_move_offset);
move = true;
}
else
{
test_peptide_model_move_offset = better_peptide_model_move_offset;
}
}
}
}
if(move)
{
m_betterPeptideModel.copyDeep(better_peptide_model_move_offset);
}
qDebug() << m_betterPeptideModel.toString();
}

References pappso::specglob::PeptideModel::copyDeep(), pappso::specglob::PeptideModel::getCountSharedPeaks(), m_betterPeptideModel, m_precision, pappso::specglob::PeptideModel::matchExperimentalPeaks(), and pappso::specglob::PeptideModel::toString().

Referenced by findBetterPeptideModel().

## tryToCumulateOffSets()

void pappso::specglob::PostTreatment::tryToCumulateOffSets | ( |  | ) |

private

try to assign residual mass delta to non aligned elements

This method is run only if there is not-aligned offSets. It may be explained by an inadequate alignment at the start because we give some advance to non-tryptic peptides. But, at the end of the alignment, we can consider it was not the best choice Trying to improve this alignment by adding not-aligned offSet with another one

Definition at line 240 of file posttreatment.cpp.

{
double mass_delta = m_betterPeptideModel.getMassDelta();
std::size_t best_count_shared_peaks = m_betterPeptideModel.getCountSharedPeaks();
PeptideModel better_peptide_model_cumulating_residual_mass_delta;
for(std::size_t i = 0; i < m_betterPeptideModel.size(); i++)
{
if(m_betterPeptideModel.at(i).remove == true)
continue;
if(m_betterPeptideModel.at(i).mass_difference == 0.0)
continue;
PeptideModel test_peptide_model_cumulating_residual_mass_delta = m_betterPeptideModel;
// try to cumulate the current mass difference with unexplained mass delta
// :
test_peptide_model_cumulating_residual_mass_delta.at(i).mass_difference += mass_delta;
test_peptide_model_cumulating_residual_mass_delta.matchExperimentalPeaks(m_precision);
if(test_peptide_model_cumulating_residual_mass_delta.getCountSharedPeaks() >=
best_count_shared_peaks)
{
best_count_shared_peaks =
test_peptide_model_cumulating_residual_mass_delta.getCountSharedPeaks();
better_peptide_model_cumulating_residual_mass_delta.copyDeep(
test_peptide_model_cumulating_residual_mass_delta);
}
}
if(better_peptide_model_cumulating_residual_mass_delta.size() > 0)
{
m_betterPeptideModel.copyDeep(better_peptide_model_cumulating_residual_mass_delta);
}
}

References pappso::specglob::PeptideModel::copyDeep(), pappso::specglob::PeptideModel::getCountSharedPeaks(), m_betterPeptideModel, m_precision, and pappso::specglob::PeptideModel::matchExperimentalPeaks().

Referenced by findBetterPeptideModel().

## tryToRemoveOffsets()

void pappso::specglob::PostTreatment::tryToRemoveOffsets | ( |  | ) |

private

try to remove offset (mass difference)

for each mass difference position, count matched peaks and compare to the previous solution. Removes mass difference if it does not degrade the number of matched peaks

Definition at line 201 of file posttreatment.cpp.

{
// We'll try to evaluate for each deltaM if it can be a neutral loss or not
// For this, we compare the number of shared peaks with and without the shift
PeptideModel better_peptide_model_for_neutral_loss;
std::size_t best_count_shared_peaks = m_betterPeptideModel.getCountSharedPeaks();
qDebug() << best_count_shared_peaks;
for(std::size_t i = 0; i < m_betterPeptideModel.size(); i++)
{
if(m_betterPeptideModel.at(i).remove == true)
continue;
if(m_betterPeptideModel.at(i).mass_difference == 0.0)
continue;
// try in the case we remove the offset
PeptideModel test_peptide_model_for_neutral_loss = m_betterPeptideModel;
test_peptide_model_for_neutral_loss.at(i).mass_difference = 0;
test_peptide_model_for_neutral_loss.matchExperimentalPeaks(m_precision);
qDebug() << test_peptide_model_for_neutral_loss.toString() << " "
<< test_peptide_model_for_neutral_loss.getCountSharedPeaks() << " "
<< best_count_shared_peaks;
if(test_peptide_model_for_neutral_loss.getCountSharedPeaks() >= best_count_shared_peaks)
{
best_count_shared_peaks = test_peptide_model_for_neutral_loss.getCountSharedPeaks();
better_peptide_model_for_neutral_loss.copyDeep(test_peptide_model_for_neutral_loss);
}
}
if(better_peptide_model_for_neutral_loss.size() > 0)
{
m_betterPeptideModel.copyDeep(better_peptide_model_for_neutral_loss);
}
}

References pappso::specglob::PeptideModel::copyDeep(), pappso::specglob::PeptideModel::getCountSharedPeaks(), m_betterPeptideModel, m_precision, pappso::specglob::PeptideModel::matchExperimentalPeaks(), and pappso::specglob::PeptideModel::toString().

Referenced by findBetterPeptideModel().

## Member Data Documentation

## m_betterPeptideModel

PeptideModel pappso::specglob::PostTreatment::m_betterPeptideModel

private

Definition at line 113 of file posttreatment.h.

Referenced by PostTreatment(), findBetterPeptideModel(), findReplaceMutations(), getBetterPeptideModel(), tryBetterPositionOffsets(), tryToCumulateOffSets(), and tryToRemoveOffsets().

## m_originalPeptideModel

PeptideModel pappso::specglob::PostTreatment::m_originalPeptideModel

private

Definition at line 112 of file posttreatment.h.

Referenced by PostTreatment(), findBetterPeptideModel(), and getOriginalPeptideModel().

## m_precision

pappso::PrecisionPtr pappso::specglob::PostTreatment::m_precision

private

Definition at line 114 of file posttreatment.h.

Referenced by PostTreatment(), findBetterPeptideModel(), findReplaceMutations(), tryBetterPositionOffsets(), tryToCumulateOffSets(), and tryToRemoveOffsets().

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

- pappsomspp/core/processing/specglob/posttreatment.h
- pappsomspp/core/processing/specglob/posttreatment.cpp