libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
spectralalignment.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/specglob/spectraalignment.cpp
3 * \date 08/11/2023
4 * \author Olivier Langella
5 * \brief petide to spectrum alignment
6 *
7 * C++ implementation of the SpecGlob algorithm described in :
8 * 1. Prunier, G. et al. Fast alignment of mass spectra in large proteomics
9 * datasets, capturing dissimilarities arising from multiple complex
10 * modifications of peptides. BMC Bioinformatics 24, 421 (2023).
11 *
12 * HAL Id : hal-04296170 , version 1
13 * Mot de passe : hxo20cl
14 * DOI : 10.1186/s12859-023-05555-y
15 */
16
17
18/*
19 * SpecGlobTool, Spectra to peptide alignment tool
20 * Copyright (C) 2023 Olivier Langella
21 * <olivier.langella@universite-paris-saclay.fr>
22 *
23 * This program is free software: you can redistribute it and/or modify
24 * it under the terms of the GNU General Public License as published by
25 * the Free Software Foundation, either version 3 of the License, or
26 * (at your option) any later version.
27 *
28 * This program is distributed in the hope that it will be useful,
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 * GNU General Public License for more details.
32 *
33 * You should have received a copy of the GNU General Public License
34 * along with this program. If not, see <http://www.gnu.org/licenses/>.
35 *
36 */
37
38#include "spectralalignment.h"
41
42
43namespace pappso
44{
45namespace specglob
46{
48{
49 m_precisionPtr = precision_ptr;
50 m_scoreValues = score_values;
51}
52
56
57
63
69void
71 ExperimentalSpectrumCsp experimental_spectrum)
72{
73 mcsp_experimentalSpectrum = experimental_spectrum;
74 mcsp_peptideSpectrum = peptide_spectrum;
75 m_maxScore = 0;
76 m_matrix.resize(mcsp_peptideSpectrum.get()->size(), mcsp_experimentalSpectrum.get()->size());
77
78 // set the value of difference between Precursor mass and theoretical mass of
79 // the proposed peptide
80 m_precursorMassDelta = mcsp_experimentalSpectrum.get()->getPrecursorMass() -
81 mcsp_peptideSpectrum.get()->getPeptideSp().get()->getMass();
82
84
85 m_itPosMax = m_matrix.end2();
86 // Make the alignment in filling the matrices
87
88 auto last_theoretical_peptide = std::prev(m_matrix.end1());
89 for(auto itmi = ++m_matrix.begin1(); itmi != m_matrix.end1(); ++itmi)
90 {
91 for(auto itmj = ++itmi.begin(); itmj != itmi.end(); itmj++)
92 {
93 // qDebug() << "i=" << itmj.index1() << " j=" << itmj.index2();
96 // keep the Max Score during matrixes filling
97 // the condition is to keep the max score in the last line (last
98 // theoretical amino acid) This is for try to keep all amino acids of
99 // the initial Theoretical sequence (but can modify alignment choice)
100 if(itmi == last_theoretical_peptide && (*itmj).score > m_maxScore)
101 {
102 m_maxScore = (*itmj).score;
103 m_itPosMax = itmj;
104 }
105 }
106 }
107}
108
111{
114
115 double precursor_mass = mcsp_experimentalSpectrum.get()->getPrecursorMass();
116 std::size_t start = 1;
117 int max_score = m_maxScore;
118 pappso::specglob::PeptideSpectraCsp ref_best_peptide = ref_peptide;
119
120 while(start < ref_peptide.get()->getPeptideSp().get()->size() - 5)
121 {
122 pappso::PeptideSp peptide_sp = std::make_shared<pappso::Peptide>(
123 ref_peptide.get()->getPeptideSp().get()->getSequence().mid(start));
124 std::size_t length = peptide_sp.get()->size();
125 while(peptide_sp.get()->getMass() > (precursor_mass * 1.1))
126 {
127 peptide_sp =
128 std::make_shared<pappso::Peptide>(peptide_sp.get()->getSequence().mid(0, length - 1));
129 if(length > 1)
130 length--;
131 }
133 std::make_shared<pappso::specglob::PeptideSpectrum>(peptide_sp);
134 align(peptide_spectra, mcsp_experimentalSpectrum);
135
136 if(max_score < m_maxScore)
137 {
138 if(m_maxScore > 0)
139 {
140 model = buildPeptideModel();
141 model.eliminateComplementaryDelta(precision_ptr);
142 model.ltrimOnRemoval();
143 max_score = m_maxScore;
144 ref_best_peptide = mcsp_peptideSpectrum;
145 }
146 }
147 start++;
148 }
149 align(ref_best_peptide, mcsp_experimentalSpectrum);
150 return model;
151}
152
153void
155 const boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2 &it_pos,
156 const PeptideSpectrum &peptide_spectrum,
157 const ExperimentalSpectrum &experimental_spectrum)
158{
159 // long theoIndiceI = it_pos.index1();
160 // long expeIndiceJ = it_pos.index2();
161 // in first time, we set score corresponding to type of peak (initial/mirror
162 // or both) we set initial score to peak mirror or initial
164 // experimental_spectrum.at(expeIndiceJ).type;
165
166 int alignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreAlignNative);
167 int reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignNative);
168 int reAlignScoreNOToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignNativeNO);
169
170 switch(expePeakType)
171 {
173 // this is a symmetric peak
174 alignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreAlignSym);
175 reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignSym);
176 reAlignScoreNOToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignSymNO);
177 if(m_BETTER_END_RA && it_pos.index1() == peptide_spectrum.getPeptideSp().get()->size())
178 {
179 reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreNonAlign) +
181 }
182 break;
184 // this is a native peak with a symmetric corresponding
185 alignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreAlignBoth);
186 reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignBoth);
187 reAlignScoreNOToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignBothNO);
188 if(m_BETTER_END_RA && it_pos.index1() == peptide_spectrum.getPeptideSp().get()->size())
189 {
190 reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreNonAlign) +
192 }
193 break;
194 default:
195 // this is a native or synthetic peak
196 alignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreAlignNative);
197 reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignNative);
198 reAlignScoreNOToAdd = m_scoreValues.get(ScoreValueType::scoreReAlignNativeNO);
199 if(m_BETTER_END_RA && it_pos.index1() == peptide_spectrum.getPeptideSp().get()->size())
200 {
201 reAlignScoreToAdd = m_scoreValues.get(ScoreValueType::scoreNonAlign) +
203 }
204 break;
205 }
206 SpectralAlignmentDataPoint &matrix_data_point_i_j = *it_pos;
207
208 /*
209 long k = getkValue(it_pos,
210 peptide_spectrum.at(it_pos.index1()).diff_mz,
211 experimental_spectrum);
212
213 if(it_pos.index1() == 15)
214 qDebug() << "position1" << it_pos.index1() << "position2" << it_pos.index1()
215 << " k=" << k << " " << peptide_spectrum.at(it_pos.index1()).diff_mz;
216 */
217 pappso::MzRange aaMassRange(peptide_spectrum.at(it_pos.index1()).diff_mz, m_precisionPtr);
218 qDebug();
219 // long k = -1;
220 auto itKpeak = experimental_spectrum.reverseFindDiffMz(it_pos.index2(), aaMassRange);
221 // if(itKpeak != experimental_spectrum.rend())
222 // k = itKpeak->indice;
223
224 if(itKpeak == experimental_spectrum.rend())
225 {
226 matrix_data_point_i_j.score = m_matrix(it_pos.index1() - 1, it_pos.index2()).score +
228 matrix_data_point_i_j.origin_column_indices = it_pos.index2();
229 matrix_data_point_i_j.alignment_type = SpectralAlignmentType::nonAlign;
230 }
231 else
232 {
233 SpectralAlignmentDataPoint &matrix_data_point_previ_k =
234 m_matrix(it_pos.index1() - 1, itKpeak->indice);
235 int scoreAlignK = matrix_data_point_previ_k.score + alignScoreToAdd;
236 // if it come from non align, we must verify that there is no offset from
237 // previous align
238 if(matrix_data_point_previ_k.alignment_type == SpectralAlignmentType::nonAlign)
239 {
240 int l;
241 for(l = it_pos.index1() - 1; l > 0; l--)
242 {
243 if(m_matrix(l, itKpeak->indice).origin_column_indices != itKpeak->indice)
244 break;
245 }
246 if(std::abs(m_matrix(l, itKpeak->indice).mass_difference - (*it_pos).mass_difference) >
247 m_precisionPtr->getNominal())
248 scoreAlignK = matrix_data_point_previ_k.score + reAlignScoreToAdd;
249 }
250
251 // int[0] = the j value m and int[1] = the score value
252 SpectralAlignmentDataPoint reAlignBestScore =
253 getBestRealignScore(it_pos, itKpeak->indice, reAlignScoreToAdd, reAlignScoreNOToAdd);
254
255 // For debug to see value for any match
256 // System.out.println("score k = " + scoreAlignK + " - score m = " +
257 // reAlignBestScore[1] + " - origin m = "
258 // + reAlignBestScore[0]);
259
260 if(scoreAlignK >= reAlignBestScore.score)
261 {
262 // setMatricesData(theoIndiceI, expeIndiceJ, scoreAlignK, k, 2);
263 matrix_data_point_i_j.score = scoreAlignK;
264 matrix_data_point_i_j.origin_column_indices = itKpeak->indice;
265 matrix_data_point_i_j.alignment_type = SpectralAlignmentType::align;
266 }
267 else
268 {
269 /*setMatricesData(theoIndiceI,
270 expeIndiceJ,
271 reAlignBestScore[1],
272 reAlignBestScore[0],
273 reAlignBestScore[2]);*/
274
275 matrix_data_point_i_j = reAlignBestScore;
276 }
277 }
278}
279
280
283 const boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2 &it_pos,
284 std::size_t expeIndicesK,
285 int reAlignScore,
286 int alignScoreToAdd)
287{
288
289 std::size_t previous_peptide_row = it_pos.index1() - 1;
290 SpectralAlignmentDataPoint return_data_point = *it_pos;
291 int bestScore = -10000;
292 int origin = -1;
293
294 // find the best score column indice on previous row, walking back from
295 // expeIndicesK m is a j value between 0 and k where a realign can be do if we
296 // accept mass offset
297 for(long m = expeIndicesK; m > -1; m--)
298 {
299 // the >= here is for keep the highest S value if there is multiple S with
300 // the same best score
301 if(m_matrix(previous_peptide_row, m).score > bestScore)
302 {
303 bestScore = m_matrix(previous_peptide_row, m).score;
304 origin = m;
305 }
306 }
307
308 return_data_point.origin_column_indices = origin;
309 return_data_point.score = bestScore + reAlignScore;
310 return_data_point.alignment_type = SpectralAlignmentType::reAlign; // [2] = 1;
311
312 if(origin == -1)
313 return return_data_point;
314
315 // We check for the last alignment if we have chain of Non Alignment to
316 // compare the last mass offset found
317 std::size_t lastAlignIndiceI = previous_peptide_row;
318 for(long l = previous_peptide_row; l > 0; l--)
319 {
320 if(m_matrix(l, origin).origin_column_indices != 0)
321 {
322 lastAlignIndiceI = l;
323 break;
324 }
325 }
326
327 // if the difference of mass offset between actual state and last align (or
328 // realign) is null, we consider that to an alignment
329 if((lastAlignIndiceI != (previous_peptide_row)) && (it_pos.index1() > 1) &&
330 (std::abs(m_matrix(previous_peptide_row, expeIndicesK).mass_difference -
331 m_matrix(lastAlignIndiceI, origin).mass_difference) < m_precisionPtr->getNominal()))
332 {
333 return_data_point.score = bestScore + alignScoreToAdd;
334 return_data_point.alignment_type = SpectralAlignmentType::align; //[2] = 2;
335 }
336
337 // we return the origin (value of m) and the associate calculated score and
338 // the type of Alignment
339 return return_data_point;
340}
341
342
343void
345 const ExperimentalSpectrum &experimental_spectrum)
346{
347
348 auto it_peptide = peptide_spectrum.begin();
349 auto it_spectrum = experimental_spectrum.begin();
350 for(auto itr1 = m_matrix.begin1(); itr1 != m_matrix.end1(); ++itr1, it_peptide++)
351 {
352 it_spectrum = experimental_spectrum.begin();
353 for(auto itr2 = itr1.begin(); itr2 != itr1.end(); itr2++, it_spectrum++)
354 {
355 (*itr2).alignment_type = SpectralAlignmentType::nonAlign;
356 if(it_peptide == peptide_spectrum.begin())
357 (*itr2).alignment_type = SpectralAlignmentType::nonAlign;
358 (*itr2).origin_column_indices = 0;
359 (*itr2).score = 0;
360 (*itr2).mass_difference = it_spectrum->peak_mz - it_peptide->mz;
361 // qDebug() << " i=" << itr2.index1() << " j=" << itr2.index2()
362 // << " mass_difference=" << (*itr2).mass_difference;
363 }
364 }
365}
366
367const matrix<SpectralAlignmentDataPoint> &
369{
370 return m_matrix;
371}
372
373std::vector<int>
374SpectralAlignment::getScoreRow(std::size_t row_indice) const
375{
376 std::vector<int> score;
377
378 auto itr1 = m_matrix.begin1() + row_indice;
379 for(auto itr2 = itr1.begin(); itr2 != itr1.end(); itr2++)
380 {
381 score.push_back((*itr2).score);
382 }
383
384 return score;
385}
386
387int
389{
390 return m_maxScore;
391}
392
393boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2
398
401 const boost::numeric::ublas::matrix<SpectralAlignmentDataPoint>::iterator2 &itpos) const
402{
403 return mcsp_experimentalSpectrum.get()->at(itpos.index2());
404}
405
406double
411
412
413QString
415{
416 if(m_maxScore < 1)
417 {
418 throw pappso::PappsoException("no backtrack");
419 }
420 QString pepModified = "";
421 QString theoSequence = mcsp_peptideSpectrum.get()->getPeptideSp().get()->getSequence();
422 int actualI = m_itPosMax.index1();
423 int prevI;
424 int actualJ = m_itPosMax.index2();
425 int prevJ;
426 double actualDelMass;
427 double prevDelMass;
428 int modifCount = 0;
429 double totExplainMass = 0.0;
430
431 // System.out.println(theoSequence);
432 // System.out.println("actualI is : " + actualI + " and actualJ is : " +
433 // actualJ);
434
435 while(actualI > 0)
436 {
437 // System.out.println(actualI);
438 // define the actual mass delta to the actual i and j
439 QString tempPepSeq = "";
440 QString tempAA = "";
441 QString aminoAcid = "";
442 actualDelMass = m_matrix(actualI, actualJ).mass_difference;
443 prevI = actualI - 1;
444 prevJ = m_matrix(actualI, actualJ).origin_column_indices;
445 prevDelMass = m_matrix(prevI, prevJ).mass_difference;
446
447 // We checking first if last Amino acid are not aligned
448
449 if(m_matrix(actualI, actualJ).alignment_type == SpectralAlignmentType::nonAlign)
450 {
451 // System.out.println("I'm NON ALIGN");
452 tempPepSeq = QString("[%1]").arg(theoSequence.at(actualI - 1));
453
454 while(m_matrix(prevI, prevJ).alignment_type == SpectralAlignmentType::nonAlign &&
455 prevI > 0)
456 {
457 tempPepSeq = QString("[%1]").arg(theoSequence.at(prevI - 1)) + tempPepSeq;
458 prevI--;
459 }
460 // modifCount++;
461 actualI = prevI;
462 actualJ = prevJ;
463
464 pepModified = tempPepSeq + pepModified;
465
466 qDebug() << "a1 pepModified=" << pepModified;
467 // if not, we are in the case where there is an alignment or a
468 // realignment if there is Align or a re-align, put the letter of
469 // Amino Acid and check what we get before to see if we have a mass
470 // change
471 }
472 else
473 {
474 // we put the actual amino acid because he is found, and in function
475 // of alignment type, we can have a mass offset
476 tempPepSeq = QString("%1").arg(theoSequence.at(actualI - 1));
477 aminoAcid = tempPepSeq;
478
479 // we check if there is a deletion before the founded aminoAcid
480 if(prevI > 0 && m_matrix(prevI, prevJ).alignment_type == SpectralAlignmentType::nonAlign)
481 {
482
483 // modifCount++;
484
485 // we continue to check if this is a deletion bloc to keep the
486 // mass difference due to the deletion of the block
487 while(prevI > 0 &&
488 m_matrix(prevI, prevJ).alignment_type == SpectralAlignmentType::nonAlign)
489 {
490
491 tempPepSeq = QString("[%1]").arg(theoSequence.at(prevI - 1)) + tempPepSeq;
492 tempAA = QString("%1").arg(theoSequence.at(prevI - 1)) + tempAA;
493
494 prevI--;
495 prevDelMass = m_matrix(prevI, prevJ).mass_difference;
496 if(prevI == 0)
497 {
498 prevDelMass = 0.0;
499 }
500 }
501
502 // check the mass delta to avoid showing a null mass delta
503 if(std::abs(actualDelMass - prevDelMass) > m_precisionPtr->getNominal())
504 {
505
506 tempPepSeq = tempPepSeq.mid(0, tempPepSeq.length() - 1);
507
508 tempPepSeq += QString("[%1]").arg(actualDelMass - prevDelMass) + aminoAcid;
509 totExplainMass += (actualDelMass - prevDelMass);
510 modifCount++;
511 qDebug() << "a2a1 tempPepSeq=" << tempPepSeq;
512 }
513
514 // if there this is just a re-align, we need to indicate the mass
515 // offset
516 }
517 else if(m_matrix(actualI, actualJ).alignment_type == SpectralAlignmentType::reAlign)
518 {
519
520 tempPepSeq = QString("[%1]").arg(actualDelMass - prevDelMass) + tempPepSeq;
521 modifCount++;
522 totExplainMass += (actualDelMass - prevDelMass);
523
524 // the fact when you align the first amino acid, but there is a
525 // leak of Amino acid in OMS solution before
526 }
527 else if(actualI == 1 &&
528 m_matrix(actualI, actualJ).alignment_type == SpectralAlignmentType::align &&
529 (std::abs(actualDelMass) > m_precisionPtr->getNominal()))
530 {
531 tempPepSeq = QString("[%1]").arg(actualDelMass) + tempPepSeq;
532 totExplainMass += actualDelMass;
533 modifCount++;
534 }
535
536 pepModified = tempPepSeq + pepModified;
537 qDebug() << "a2 pepModified=" << pepModified;
538 // System.out.println(pepModified);
539
540 actualI = prevI;
541 actualJ = prevJ;
542 }
543 }
544
545 // setModificationNumber(modifCount);
546
547 return QString("%1_[%2]").arg(pepModified).arg(m_precursorMassDelta - totExplainMass);
548}
549
550
553{
554 if(m_maxScore < 1)
555 {
557 QObject::tr("building peptide model failed m_maxScore == %1").arg(m_maxScore));
558 }
559 PeptideModel sg_peptide_model(mcsp_experimentalSpectrum.get()->getQualifiedMassSpectrum(),
560 *(mcsp_peptideSpectrum.get()->getPeptideSp().get()));
561 int actualI = m_itPosMax.index1();
562 int prevI;
563 int actualJ = m_itPosMax.index2();
564 int prevJ;
565 double actualDelMass;
566 double prevDelMass;
567
568 // System.out.println(theoSequence);
569 // System.out.println("actualI is : " + actualI + " and actualJ is : " +
570 // actualJ);
571
572 while(actualI > 0)
573 {
574 // System.out.println(actualI);
575 // define the actual mass delta to the actual i and j
576 QString aminoAcid = "";
577 actualDelMass = m_matrix(actualI, actualJ).mass_difference;
578 prevI = actualI - 1;
579 prevJ = m_matrix(actualI, actualJ).origin_column_indices;
580 prevDelMass = m_matrix(prevI, prevJ).mass_difference;
581
582 // We checking first if last Amino acid are not aligned
583
584 if(m_matrix(actualI, actualJ).alignment_type == SpectralAlignmentType::nonAlign)
585 {
586 // System.out.println("I'm NON ALIGN");
587
588 while(m_matrix(prevI, prevJ).alignment_type == SpectralAlignmentType::nonAlign &&
589 prevI > 0)
590 {
591 if(prevI > 0)
592 sg_peptide_model[prevI - 1].bracket = true;
593 prevI--;
594 }
595 // modifCount++;
596 actualI = prevI;
597 actualJ = prevJ;
598
599 // if not, we are in the case where there is an alignment or a
600 // realignment if there is Align or a re-align, put the letter of
601 // Amino Acid and check what we get before to see if we have a mass
602 // change
603 }
604 else
605 {
606 // we put the actual amino acid because he is found, and in function
607 // of alignment type, we can have a mass offset
608
609 // we check if there is a deletion before the founded aminoAcid
610 if(prevI > 0 && m_matrix(prevI, prevJ).alignment_type == SpectralAlignmentType::nonAlign)
611 {
612
613 // modifCount++;
614
615 // we continue to check if this is a deletion bloc to keep the
616 // mass difference due to the deletion of the block
617 while(prevI > 0 &&
618 m_matrix(prevI, prevJ).alignment_type == SpectralAlignmentType::nonAlign)
619 {
620
621
622 if(prevI > 0)
623 sg_peptide_model[prevI - 1].bracket = true;
624 prevI--;
625 prevDelMass = m_matrix(prevI, prevJ).mass_difference;
626 if(prevI == 0)
627 {
628 prevDelMass = 0.0;
629 }
630 }
631
632 // check the mass delta to avoid showing a null mass delta
633 if(std::abs(actualDelMass - prevDelMass) > m_precisionPtr->getNominal())
634 {
635
636 int mass_i = actualI - 1;
637 if(mass_i == 0)
638 {
639 sg_peptide_model.setBeginMassDelta(actualDelMass - prevDelMass);
640 }
641 else
642 {
643 sg_peptide_model[mass_i - 1].mass_difference = actualDelMass - prevDelMass;
644 }
645 }
646
647 // if there this is just a re-align, we need to indicate the mass
648 // offset
649 }
650 else if(m_matrix(actualI, actualJ).alignment_type == SpectralAlignmentType::reAlign)
651 {
652
653 int mass_i = actualI - 1;
654 if(mass_i == 0)
655 {
656 sg_peptide_model.setBeginMassDelta(actualDelMass - prevDelMass);
657 }
658 else
659 {
660 sg_peptide_model[mass_i - 1].mass_difference = actualDelMass - prevDelMass;
661 }
662 // the fact when you align the first amino acid, but there is a
663 // leak of Amino acid in OMS solution before
664 }
665 else if(actualI == 1 &&
666 m_matrix(actualI, actualJ).alignment_type == SpectralAlignmentType::align &&
667 (std::abs(actualDelMass) > m_precisionPtr->getNominal()))
668 {
669 sg_peptide_model.setBeginMassDelta(actualDelMass);
670 }
671
672 actualI = prevI;
673 actualJ = prevJ;
674 }
675 }
676
677 // setModificationNumber(modifCount);
678
679 // return QString("%1_[%2]")
680 // .arg(pepModified)
681 // .arg(m_precursorMassDelta - totExplainMass);
682 return sg_peptide_model;
683}
684} // namespace specglob
685} // namespace pappso
std::vector< ExperimentalSpectrumDataPoint >::const_reverse_iterator reverseFindDiffMz(std::size_t start_position, const pappso::MzRange &targeted_mass_range) const
find the peak for wich mass difference from rbegin corresponds to aaTheoMass Find if a peak back in t...
bool ltrimOnRemoval()
try to remove left amino acid if there is a removal
bool eliminateComplementaryDelta(pappso::PrecisionPtr precision)
pappso::PeptideSp getPeptideSp() const
SpectralAlignment(ScoreValues score_values, pappso::PrecisionPtr precision_ptr)
SpectralAlignmentDataPoint getBestRealignScore(const boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 &it_pos, std::size_t expeIndicesK, int reAlignScore, int alignScoreToAdd)
boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 getMaxPosIterator() const
std::vector< int > getScoreRow(std::size_t row_indice) const
void fillMassDelta(const PeptideSpectrum &peptide_spectrum, const ExperimentalSpectrum &experimental_spectrum)
const ExperimentalSpectrumDataPoint & getExperimentalSpectrumDataPoint(const boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 &itpos) const
ExperimentalSpectrumCsp mcsp_experimentalSpectrum
PeptideSpectraCsp getPeptideSpectraCsp() const
PeptideModel rtrim(PrecisionPtr precision_ptr)
trim the current peptide to get a minimal alignment score
ExperimentalSpectrumCsp getExperimentalSpectrumCsp() const
const matrix< SpectralAlignmentDataPoint > & getMatrix() const
boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 m_itPosMax
matrix< SpectralAlignmentDataPoint > m_matrix
void fillMatricesWithScores(const boost::numeric::ublas::matrix< SpectralAlignmentDataPoint >::iterator2 &it_pos, const PeptideSpectrum &peptide_spectrum, const ExperimentalSpectrum &experimental_spectrum)
void align(PeptideSpectraCsp peptide_spectrum, ExperimentalSpectrumCsp experimental_spectrum)
build the alignment matrix between a peptide sequence and an experimental spectrum
std::shared_ptr< const PeptideSpectrum > PeptideSpectraCsp
@ scoreAlignNative
Score for good alignment native (int).
Definition types.h:65
@ scoreReAlignSymNO
Score for re-alignment without offset symmetric (int).
Definition types.h:71
@ scoreNonAlign
Score for non alignment (int).
Definition types.h:58
@ scoreAlignBoth
Score for good alignment both (int).
Definition types.h:67
@ scoreReAlignBoth
Score for re-alignment both (int).
Definition types.h:62
@ scoreReAlignBothNO
Score for re-alignment without offset both (int).
Definition types.h:73
@ scoreReAlignSym
Score for re-alignment symmetric (int).
Definition types.h:61
@ scoreAlignSym
Score for good alignment symmetric (int).
Definition types.h:66
@ scoreReAlignNativeNO
Score for re-alignment without offset native (int).
Definition types.h:69
std::shared_ptr< const ExperimentalSpectrum > ExperimentalSpectrumCsp
@ nonAlign
the type of alignment to put in origin matrix NON Alignment (0 - NA)
Definition types.h:49
@ reAlign
Re Alignment (1 - RE).
Definition types.h:51
ExperimentalSpectrumDataPointType
Definition types.h:78
@ both
both, the ion and the complement exists in the original spectrum
Definition types.h:83
@ symmetric
new peak : computed symmetric mass from a corresponding native peak
Definition types.h:81
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const Peptide > PeptideSp
const PrecisionBase * PrecisionPtr
Definition precision.h:122