libpappsomspp
Library for mass spectrometry
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 PeptideModelgetBetterPeptideModel () const
 
const PeptideModelgetOriginalPeptideModel () 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.

47 : m_originalPeptideModel(peptide_model), m_betterPeptideModel(peptide_model)
48{
49 m_precision = precision;
51
53}
void matchExperimentalPeaks(pappso::PrecisionPtr precision)
pappso::PrecisionPtr m_precision
void findBetterPeptideModel()
whole processus to find a better peptide model

References findBetterPeptideModel(), m_originalPeptideModel, m_precision, and pappso::specglob::PeptideModel::matchExperimentalPeaks().

◆ ~PostTreatment()

pappso::specglob::PostTreatment::~PostTreatment ( )
virtual

Destructor

Definition at line 55 of file posttreatment.cpp.

56{
57}

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 66 of file posttreatment.cpp.

67{
70 {
71 // calculate the number of shared peaks with the deltaM on the last aa
76 {
77 }
78 else
79 {
80 // not better, get back to original peptide
82 }
83 }
84 else
85 {
87 }
88
89
90 // Try to remove complementary mass offset
91 // Not done if the number of peaks is increased by more than two peaks
92 // If the number of peaks > +2, it is considered as an information that must
93 // be kept in the alignment Could be modified...the information is in the
94 // preAligned column
95 PeptideModel test_peptide_model_remove_complementary(m_betterPeptideModel);
96 if(test_peptide_model_remove_complementary.eliminateComplementaryDelta(
98 {
99
100 test_peptide_model_remove_complementary.matchExperimentalPeaks(
102
103 qDebug()
104 << "test_peptide_model_remove_complementary.getCountSharedPeaks()="
105 << test_peptide_model_remove_complementary.getCountSharedPeaks()
106 << " m_betterPeptideModel.getCountSharedPeaks()="
108 if(test_peptide_model_remove_complementary.getCountSharedPeaks() <
110 {
111 qDebug() << "replace with "
112 << test_peptide_model_remove_complementary.toString();
114 test_peptide_model_remove_complementary);
115 }
116 }
117
118 // if bestModified contains negative offSet, try to remove amino acids to
119 // explain it
120 PeptideModel test_peptide_model_remove_negative = m_betterPeptideModel;
121 if(test_peptide_model_remove_negative.eliminateNegativeOffset(m_precision))
122 {
123 test_peptide_model_remove_negative.matchExperimentalPeaks(m_precision);
124 if(test_peptide_model_remove_negative.getCountSharedPeaks() >=
126 {
127 qDebug() << "replace with "
128 << test_peptide_model_remove_negative.toString();
129 m_betterPeptideModel.copyDeep(test_peptide_model_remove_negative);
130 }
131 }
132
133 // findBetterMassDifferencePosition
136
137
139 {
141 }
142
144}
virtual pappso_double getNominal() const final
Definition precision.cpp:65
std::size_t getCountSharedPeaks() const
double getMassDelta() const
mass delta between experimental and theoretical mass
PeptideModel & copyDeep(const PeptideModel &other)
void tryToCumulateOffSets()
try to assign residual mass delta to non aligned elements
void tryToRemoveOffsets()
try to remove offset (mass difference)
void tryBetterPositionOffsets()
try to move offset (mass difference)

References pappso::specglob::PeptideModel::assignResidualMass2Cter(), pappso::specglob::PeptideModel::copyDeep(), pappso::specglob::PeptideModel::eliminateComplementaryDelta(), pappso::specglob::PeptideModel::eliminateNegativeOffset(), pappso::specglob::PeptideModel::getCountSharedPeaks(), pappso::specglob::PeptideModel::getMassDelta(), pappso::PrecisionBase::getNominal(), m_betterPeptideModel, m_originalPeptideModel, m_precision, pappso::specglob::PeptideModel::matchExperimentalPeaks(), pappso::specglob::PeptideModel::removeBracketsForAlignedAA(), pappso::specglob::PeptideModel::toString(), tryBetterPositionOffsets(), tryToCumulateOffSets(), and tryToRemoveOffsets().

Referenced by PostTreatment().

◆ findReplaceMutations()

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

Definition at line 307 of file posttreatment.cpp.

308{
309 auto peptide_model = m_betterPeptideModel;
310
311 bool modif = false;
312 std::vector<pappso::AminoAcidChar> aa_list = {
332 if(peptide_model.checkForMutations(aa_list, m_precision))
333 {
334 modif = true;
335 }
336 pappso::Aa cysteine('C');
337 cysteine.addAaModification(
338 pappso::AaModification::getInstance("MOD:00397")); // carbamido
339 if(peptide_model.checkForMutation(cysteine, m_precision))
340 {
341 modif = true;
342 }
344 methionine.addAaModification(
345 pappso::AaModification::getInstance("MOD:00719")); // oxydation
346 if(peptide_model.checkForMutation(methionine, m_precision))
347 {
348 modif = true;
349 }
350 if(modif)
351 {
352 m_betterPeptideModel = peptide_model;
353 }
354 return modif;
355}
static AaModificationP getInstance(const QString &accession)

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

◆ getBetterPeptideModel()

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

Definition at line 60 of file posttreatment.cpp.

61{
63}

References m_betterPeptideModel.

◆ getOriginalPeptideModel()

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

Definition at line 301 of file posttreatment.cpp.

302{
304}

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 147 of file posttreatment.cpp.

148{
149
150 PeptideModel better_peptide_model_move_offset = m_betterPeptideModel;
151 std::size_t best_count_shared_peaks =
153 qDebug() << best_count_shared_peaks;
154
155 qDebug() << m_betterPeptideModel.toString();
156 bool move = false;
157 for(std::size_t i = 0; i < m_betterPeptideModel.size(); i++)
158 {
159
160 qDebug() << "i =" << i;
161 if(m_betterPeptideModel.at(i).remove == true)
162 continue;
163 if(m_betterPeptideModel.at(i).mass_difference == 0.0)
164 continue;
165 if(m_betterPeptideModel.at(i).bracket == true)
166 {
167 // try to move if
168 double mass_diff = m_betterPeptideModel.at(i).mass_difference;
169 PeptideModel test_peptide_model_move_offset =
170 better_peptide_model_move_offset;
171 test_peptide_model_move_offset.at(i).mass_difference = 0;
172 qDebug() << test_peptide_model_move_offset.toString();
173
174 std::size_t j = i;
175 while(j > 0)
176 {
177 j -= 1;
178 if(test_peptide_model_move_offset.at(j).bracket == false)
179 break;
180 if(test_peptide_model_move_offset.at(j).mass_difference != 0.0)
181 break;
182
183 test_peptide_model_move_offset.at(j).mass_difference = mass_diff;
184 test_peptide_model_move_offset.matchExperimentalPeaks(
186
187 qDebug() << test_peptide_model_move_offset.toString() << " "
188 << test_peptide_model_move_offset.getCountSharedPeaks()
189 << " " << best_count_shared_peaks;
190 if(test_peptide_model_move_offset.getCountSharedPeaks() >
191 best_count_shared_peaks)
192 {
193 best_count_shared_peaks =
194 test_peptide_model_move_offset.getCountSharedPeaks();
195 better_peptide_model_move_offset.copyDeep(
196 test_peptide_model_move_offset);
197 move = true;
198 }
199 else
200 {
201 test_peptide_model_move_offset =
202 better_peptide_model_move_offset;
203 }
204 }
205 }
206 }
207
208 if(move)
209 {
210 m_betterPeptideModel.copyDeep(better_peptide_model_move_offset);
211 }
212 qDebug() << m_betterPeptideModel.toString();
213}

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 260 of file posttreatment.cpp.

261{
262 double mass_delta = m_betterPeptideModel.getMassDelta();
263 std::size_t best_count_shared_peaks =
265 PeptideModel better_peptide_model_cumulating_residual_mass_delta;
266 for(std::size_t i = 0; i < m_betterPeptideModel.size(); i++)
267 {
268 if(m_betterPeptideModel.at(i).remove == true)
269 continue;
270 if(m_betterPeptideModel.at(i).mass_difference == 0.0)
271 continue;
272
273 PeptideModel test_peptide_model_cumulating_residual_mass_delta =
275 // try to cumulate the current mass difference with unexplained mass delta
276 // :
277 test_peptide_model_cumulating_residual_mass_delta.at(i).mass_difference +=
278 mass_delta;
279 test_peptide_model_cumulating_residual_mass_delta.matchExperimentalPeaks(
281 if(test_peptide_model_cumulating_residual_mass_delta
282 .getCountSharedPeaks() >= best_count_shared_peaks)
283 {
284 best_count_shared_peaks =
285 test_peptide_model_cumulating_residual_mass_delta
286 .getCountSharedPeaks();
287 better_peptide_model_cumulating_residual_mass_delta.copyDeep(
288 test_peptide_model_cumulating_residual_mass_delta);
289 }
290 }
291
292 if(better_peptide_model_cumulating_residual_mass_delta.size() > 0)
293 {
295 better_peptide_model_cumulating_residual_mass_delta);
296 }
297}

References pappso::specglob::PeptideModel::copyDeep(), pappso::specglob::PeptideModel::getCountSharedPeaks(), pappso::specglob::PeptideModel::getMassDelta(), 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 217 of file posttreatment.cpp.

218{
219
220 // We'll try to evaluate for each deltaM if it can be a neutral loss or not
221 // For this, we compare the number of shared peaks with and without the shift
222
223 PeptideModel better_peptide_model_for_neutral_loss;
224 std::size_t best_count_shared_peaks =
226 qDebug() << best_count_shared_peaks;
227 for(std::size_t i = 0; i < m_betterPeptideModel.size(); i++)
228 {
229 if(m_betterPeptideModel.at(i).remove == true)
230 continue;
231 if(m_betterPeptideModel.at(i).mass_difference == 0.0)
232 continue;
233
234
235 // try in the case we remove the offset
236 PeptideModel test_peptide_model_for_neutral_loss = m_betterPeptideModel;
237 test_peptide_model_for_neutral_loss.at(i).mass_difference = 0;
238 test_peptide_model_for_neutral_loss.matchExperimentalPeaks(m_precision);
239
240 qDebug() << test_peptide_model_for_neutral_loss.toString() << " "
241 << test_peptide_model_for_neutral_loss.getCountSharedPeaks()
242 << " " << best_count_shared_peaks;
243 if(test_peptide_model_for_neutral_loss.getCountSharedPeaks() >=
244 best_count_shared_peaks)
245 {
246 best_count_shared_peaks =
247 test_peptide_model_for_neutral_loss.getCountSharedPeaks();
248 better_peptide_model_for_neutral_loss.copyDeep(
249 test_peptide_model_for_neutral_loss);
250 }
251 }
252
253 if(better_peptide_model_for_neutral_loss.size() > 0)
254 {
255 m_betterPeptideModel.copyDeep(better_peptide_model_for_neutral_loss);
256 }
257}

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

◆ 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

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