libpappsomspp
Library for mass spectrometry
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
 
pappso_double getMz (unsigned int charge) const
 get the m/z peptide model mass
 
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< Enums::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
 
PeptideModeloperator= (const PeptideModel &other)
 
PeptideModelcopyDeep (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
 
bool hasRemoval () const
 
bool ltrimOnRemoval ()
 try to remove left amino acid if there is a removal
 

Private Member Functions

void generateTheoreticalPeaks (pappso::PrecisionPtr precision)
 

Private Attributes

std::vector< TheoreticalPeakDataPointm_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.

55 : std::vector<AminoAcidModel>()
56{
58 mcsp_peakList = qmass_spectrum.getMassSpectrumCstSPtr();
61 for(auto aa_pep : peptide)
62 {
63
64 push_back({aa_pep, SpectralAlignmentType::nonAlign, false, 0.0});
65 }
66
67 // internal:Nter_hydrolytic_cleavage_H
68
69 // internal:Cter_hydrolytic_cleavage_HO
70 //
71}
AaModificationP getCleavageCterModification() const
Definition peptide.cpp:590
AaModificationP getCleavageNterModification() const
Definition peptide.cpp:585
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
double getPrecursorMass(bool *ok_p=nullptr) const
get precursor mass given the charge stats and precursor mz
pappso::AaModificationP m_nterModification
pappso::AaModificationP m_cterModification
pappso::MassSpectrumCstSPtr mcsp_peakList
@ nonAlign
the type of alignment to put in origin matrix NON Alignment (0 - NA)
Definition types.h:49

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

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

◆ PeptideModel() [2/3]

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

Definition at line 48 of file peptidemodel.cpp.

49{
50 // not valid
51}

◆ PeptideModel() [3/3]

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

Copy constructor

Parameters
otherTODO

Definition at line 73 of file peptidemodel.cpp.

73 : std::vector<AminoAcidModel>(other)
74{
75 m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
76 mcsp_peakList = other.mcsp_peakList;
77
78 m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
79 m_beginMassDelta = other.m_beginMassDelta;
80
81 m_nterModification = other.m_nterModification;
82 m_cterModification = other.m_cterModification;
83 m_countSharedPeaks = other.m_countSharedPeaks;
84 m_intensitySharedPeaks = other.m_intensitySharedPeaks;
85 m_intensityExperimentalPeaks = other.m_intensityExperimentalPeaks;
86}

References PeptideModel(), 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 117 of file peptidemodel.cpp.

118{
119}

Member Function Documentation

◆ assignResidualMass2Cter()

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

Definition at line 458 of file peptidemodel.cpp.

459{
460 back().mass_difference = getMassDelta();
461}
double getMassDelta() const
mass delta between experimental and theoretical mass

References getMassDelta().

◆ 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_modifiedthe modified amino acid
precisionThe mass spectrometer precision
Returns
true if model is modified

Definition at line 769 of file peptidemodel.cpp.

770{
771
772 bool modif = false;
773
774 double mass_difference = m_beginMassDelta;
775 for(auto &aa_model : *this)
776 {
777 mass_difference += aa_model.mass_difference;
778 auto aa_ref = aa_model.amino_acid;
779 if(aa_ref.getLetter() == aa_modified.getLetter())
780 {
781 if(mass_difference != 0.0)
782 {
783 double mass_modification = aa_modified.getTotalModificationMass();
784 if(std::abs(mass_modification - mass_difference) < precision->getNominal())
785 {
786 aa_model.mass_difference = 0;
787 for(auto &modification : aa_modified.getModificationList())
788 {
789 aa_model.amino_acid.addAaModification(modification);
790 }
791 modif = true;
792 }
793 }
794 }
795 mass_difference = 0;
796 }
797 return modif;
798}
virtual const char & getLetter() const
Definition aabase.cpp:403
double getTotalModificationMass() const
get the sum of mass modifications
Definition aa.cpp:79
const std::vector< AaModificationP > & getModificationList() const
Definition aa.cpp:73
virtual pappso_double getNominal() const final
Definition precision.cpp:72

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 742 of file peptidemodel.cpp.

744{
745
746 bool modif = false;
747
748 double mass_difference = m_beginMassDelta;
749 for(auto &aa_model : *this)
750 {
751 mass_difference += aa_model.mass_difference;
752 auto aa_ref = aa_model.amino_acid;
753 if(mass_difference != 0.0)
754 {
755 if(std::abs(modification->getMass() - mass_difference) < precision->getNominal())
756 {
757 aa_model.mass_difference = 0;
758 aa_model.amino_acid.addAaModification(modification);
759 modif = true;
760 }
761 }
762 mass_difference = 0;
763 }
764 return modif;
765}
pappso_double getMass() const

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 643 of file peptidemodel.cpp.

645{
646 bool modif = false;
647 double total_mass_to_insert = amino_acid_candidate.getMass();
648 auto insert_aa_modification =
650
651 double mass_difference = m_beginMassDelta;
652 for(auto &aa_model : *this)
653 {
654 mass_difference += aa_model.mass_difference;
655 auto aa_ref = aa_model.amino_acid;
656 if(mass_difference != 0.0)
657 {
658 mass_difference += aa_ref.getTotalModificationMass();
659 AaModificationP aa_ref_remove =
660 AaModification::getInstanceRemovalAccessionByAaLetter(aa_model.amino_acid.getLetter());
661 // check for possible mutation
662 double current_diff = (aa_ref_remove->getMass() - mass_difference) + total_mass_to_insert;
663
664
665 qDebug() << "current_diff=" << current_diff;
666 if(std::abs(current_diff) < precision->getNominal())
667 {
668 qDebug() << "modif = true=";
669 aa_model.mass_difference = 0;
670 aa_model.amino_acid.removeAllButInternalModification();
671 aa_model.amino_acid.addAaModification(aa_ref_remove);
672 aa_model.amino_acid.addAaModification(insert_aa_modification);
673 for(auto &mod : amino_acid_candidate.getModificationList())
674 {
675 aa_model.amino_acid.addAaModification(mod);
676 }
677 modif = true;
678 }
679 }
680 mass_difference = 0;
681 }
682 return modif;
683}
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...
static AaModificationP getInstanceInsertionAccessionByAaLetter(const QChar &amino_acid)
get a PSI MOD instance corresponding to the insertion of the given amino acid find the modifications.
pappso_double getMass() const override
Definition aa.cpp:90
const AaModification * AaModificationP

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

◆ checkForMutations()

bool pappso::specglob::PeptideModel::checkForMutations ( const std::vector< Enums::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_listamno acid list to test (beware of cysteine + carbamidomethyl)
precision: The mass spectrometer precision
Returns
true if model is modified

Definition at line 686 of file peptidemodel.cpp.

688{
689 bool modif = false;
690 // AaModificationP carbamido = AaModification::getInstance("MOD:00397");
691 // AaModificationP metox = AaModification::getInstance("MOD:00719");
692
693 std::vector<AaModificationP> modificationInsertList;
694 for(const auto aa : aa_list)
695 {
696 modificationInsertList.push_back(
698 }
699 double mass_difference = m_beginMassDelta;
700 for(auto &aa_model : *this)
701 {
702 mass_difference += aa_model.mass_difference;
703 auto aa_ref = aa_model.amino_acid;
704 if(mass_difference != 0.0)
705 {
706 mass_difference += aa_ref.getTotalModificationMass();
707 AaModificationP aa_ref_remove =
708 AaModification::getInstanceRemovalAccessionByAaLetter(aa_model.amino_acid.getLetter());
709 AaModificationP aa_ref_insert = nullptr;
710 double better_diff = 10;
711 // check for possible mutation
712 for(const auto aaInsertion : modificationInsertList)
713 {
714 double current_diff =
715 (aa_ref_remove->getMass() - mass_difference) + aaInsertion->getMass();
716 qDebug() << aa_model.amino_acid.getLetter() << " " << aaInsertion->getName() << " "
717 << aaInsertion->getMass() << " " << current_diff;
718 if(std::abs(current_diff) < std::abs(better_diff))
719 {
720 aa_ref_insert = aaInsertion;
721 better_diff = current_diff;
722 }
723 }
724 qDebug() << "better_diff=" << better_diff;
725 if((aa_ref_insert != nullptr) && (std::abs(better_diff) < precision->getNominal()))
726 {
727
728 qDebug() << "modif = true=";
729 aa_model.mass_difference = 0;
730 aa_model.amino_acid.removeAllButInternalModification();
731 aa_model.amino_acid.addAaModification(aa_ref_remove);
732 aa_model.amino_acid.addAaModification(aa_ref_insert);
733 modif = true;
734 }
735 }
736 mass_difference = 0;
737 }
738 return modif;
739}

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 109 of file peptidemodel.cpp.

110{
111 operator=(other);
112
113 m_theoreticalPeakList = other.m_theoreticalPeakList;
114 return *this;
115}
std::vector< TheoreticalPeakDataPoint > m_theoreticalPeakList
PeptideModel & operator=(const PeptideModel &other)

References PeptideModel(), m_theoreticalPeakList, and operator=().

Referenced by 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 464 of file peptidemodel.cpp.

465{
466 double precision_ref = precision->getNominal();
467 double offset = 0;
468 bool modified = false;
469 std::vector<AminoAcidModel>::iterator it_begin_block = end();
470 if(std::abs(m_beginMassDelta) > precision_ref)
471 {
472 it_begin_block = begin();
473 offset = m_beginMassDelta;
474
475 qDebug() << " new block offset=" << offset;
476 }
477 qDebug() << offset;
478 for(auto it = begin(); it != end(); it++)
479 {
480 qDebug() << " it->mass_difference=" << it->mass_difference;
481 if(it_begin_block == end())
482 {
483
484 if(std::abs(it->mass_difference) > precision_ref)
485 {
486 // new block
487 it_begin_block = it;
488 offset = it->mass_difference;
489 }
490 qDebug() << " new block offset=" << offset;
491 }
492 if(it_begin_block != end())
493 {
494 // existing block
495 qDebug() << " existing block offset=" << offset;
496 if(it == begin())
497 {
498 offset += it->mass_difference;
499 }
500 else
501 {
502 // where is the end of the block ?
503 qDebug() << " where is the end of the block ? offset=" << offset;
504 auto it_end_block =
505 std::find_if(it, end(), [offset, precision_ref](const AminoAcidModel &point) {
506 qDebug() << point.mass_difference << " " << offset + point.mass_difference;
507 if(std::abs(offset + point.mass_difference) <= precision_ref)
508 return true;
509 return false;
510 });
511
512 if(it_end_block != end())
513 {
514 // eliminate mass mass_difference
515 modified = true;
516 if(it_begin_block == begin())
518 it_begin_block->mass_difference = 0.0;
519 it_end_block->mass_difference = 0.0;
520 // start new block search
521 it_begin_block = end();
522 offset = 0;
523 qDebug() << " existing block end block found";
524 }
525 else
526 {
527 qDebug() << " existing block end block not found offset=" << offset;
528 // close block
529 it_begin_block = end();
530 offset = 0;
531 }
532 }
533 }
534 }
535 qDebug() << toString();
536 return modified;
537}

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

Referenced by pappso::specglob::PostTreatment::findBetterPeptideModel(), and pappso::specglob::SpectralAlignment::rtrim().

◆ 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 541 of file peptidemodel.cpp.

542{ // System.out.println("Elimination des neg offsets");
543 double precision_ref = precision->getNominal();
544 auto it_reverse = rbegin();
545 bool modified = false;
546
547 while(it_reverse != rend())
548 {
549 if(it_reverse->remove)
550 {
551 // this is a part of already removed block
552 }
553 else
554 {
555 double mass_difference = it_reverse->mass_difference;
556 if(mass_difference < 0)
557 {
558 // try to find an amino acid blocl of that mass
559 double cumul_mass_aa = 0;
560 auto it_block_end = it_reverse;
561 while(it_block_end != rend())
562 {
563 cumul_mass_aa += it_block_end->amino_acid.getMass();
564 it_block_end++;
565 if(std::abs(mass_difference + cumul_mass_aa) < precision_ref)
566 {
567 modified = true;
568 // block found -> remove this range
569 for(auto it_block = it_reverse; it_block != it_block_end; it_block++)
570 {
571 it_block->remove = true;
572 }
573 }
574 else
575 {
576 if((it_block_end != rend()) && (it_block_end->mass_difference != 0.0))
577 {
578 // interrupted block
579 break;
580 }
581 }
582 }
583 }
584 }
585 it_reverse++;
586 }
587
588 return modified;
589}

References pappso::PrecisionBase::getNominal().

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

◆ generateTheoreticalPeaks()

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

Definition at line 387 of file peptidemodel.cpp.

388{
389 m_theoreticalPeakList.clear();
390 double cumul_mass =
392
393
394 auto it_expe_peaks_end = mcsp_peakList.get()->end();
395 std::size_t i = 0;
396 for(auto aa_model : *this)
397 {
398 // compute B ions
399 cumul_mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
400
401 qDebug() << cumul_mass;
402 m_theoreticalPeakList.push_back(
403 {pappso::MzRange(cumul_mass, precision), it_expe_peaks_end, i});
404 i++;
405 }
406 // remove the complete ion B (entire peptide, no fragment):
407 m_theoreticalPeakList.pop_back();
408
409 std::size_t bmaxindice = m_theoreticalPeakList.size();
411 cumul_mass += yion_delta + pappso::MHPLUS;
412 for(std::size_t i = 0; i < bmaxindice; i++)
413 {
414 m_theoreticalPeakList.push_back(
415 {pappso::MzRange(cumul_mass - m_theoreticalPeakList[i].mz_range.getMz(), precision),
416 it_expe_peaks_end,
417 i + 1});
418 qDebug() << m_theoreticalPeakList.back().mz_range.getMz();
419 }
420
421 std::sort(m_theoreticalPeakList.begin(),
423 [](const TheoreticalPeakDataPoint &a, const TheoreticalPeakDataPoint &b) {
424 return a.mz_range.getMz() < b.mz_range.getMz();
425 });
426}
static pappso_double getDeltaMass(Enums::PeptideIon ion_type)
@ y
Cter amino ions.
Definition types.h:295
const pappso_double MHPLUS(1.007276466879)
const pappso_double MPROTIUM(1.007825032241)

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

Referenced by matchExperimentalPeaks().

◆ getCountSharedPeaks()

◆ getIntensityExperimentalPeaks()

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

Definition at line 452 of file peptidemodel.cpp.

453{
455}

References m_intensityExperimentalPeaks.

◆ getIntensitySharedPeaks()

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

Definition at line 446 of file peptidemodel.cpp.

447{
449}

References m_intensitySharedPeaks.

◆ getMass()

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

Definition at line 277 of file peptidemodel.cpp.

278{
279 double mass = m_beginMassDelta;
280 if(m_cterModification != nullptr)
281 mass += m_cterModification->getMass();
282 if(m_nterModification != nullptr)
283 mass += m_nterModification->getMass();
284
285 for(auto aa_model : *this)
286 {
287 mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
288 }
289 return mass;
290}

References m_beginMassDelta, m_cterModification, and m_nterModification.

Referenced by getMassDelta(), and getMz().

◆ getMassDelta()

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

mass delta between experimental and theoretical mass

Definition at line 293 of file peptidemodel.cpp.

294{
296}

References getMass(), and m_experimentalPrecursorMass.

Referenced by assignResidualMass2Cter(), toProForma(), and toString().

◆ getMz()

double pappso::specglob::PeptideModel::getMz ( unsigned int charge) const

get the m/z peptide model mass

Definition at line 122 of file peptidemodel.cpp.

123{
124 return ((getMass() + (pappso::MHPLUS * charge)) / (double)charge);
125}

References getMass(), and pappso::MHPLUS().

◆ getTheoreticalIonMassList()

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

Definition at line 429 of file peptidemodel.cpp.

430{
431 std::vector<double> mass_list;
432 for(auto &datapoint : m_theoreticalPeakList)
433 {
434 mass_list.push_back(datapoint.mz_range.getMz());
435 }
436 return mass_list;
437}

References m_theoreticalPeakList.

◆ getTheoreticalPeakDataPointList()

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

Definition at line 615 of file peptidemodel.cpp.

616{
618}

References m_theoreticalPeakList.

◆ getTheoreticalPeakDataPointListToString()

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

Definition at line 621 of file peptidemodel.cpp.

622{
623
624 auto it_expe_peaks_end = mcsp_peakList.get()->end();
625 QString str;
626 for(auto &theo_peak : m_theoreticalPeakList)
627 {
628 double intensity = 0;
629 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
630 {
631 intensity = theo_peak.it_experimental_peak_match->y;
632 }
633 str.append(QString("{%1,%2,%3,%4}")
634 .arg(theo_peak.mz_range.getMz())
635 .arg(intensity)
636 .arg(theo_peak.aa_indice)
637 .arg(at(theo_peak.aa_indice).amino_acid.toString()));
638 }
639 return str;
640}

References m_theoreticalPeakList, and mcsp_peakList.

◆ hasRemoval()

bool pappso::specglob::PeptideModel::hasRemoval ( ) const

Definition at line 173 of file peptidemodel.cpp.

174{
175 for(auto aa_model : *this)
176 {
177 if(std::abs(aa_model.amino_acid.getMass() + aa_model.mass_difference) < 0.001)
178 return true;
179 }
180 return false;
181}

◆ ltrimOnRemoval()

bool pappso::specglob::PeptideModel::ltrimOnRemoval ( )

try to remove left amino acid if there is a removal

Returns
true if peptide model is modified

Definition at line 184 of file peptidemodel.cpp.

185{
186 AminoAcidModel *amino_acid_to_remove = nullptr;
187 int pos = -1;
188 for(auto aa_model : *this)
189 {
190 pos++;
191 if(std::abs(aa_model.amino_acid.getMass() + aa_model.mass_difference) < 0.001)
192 {
193 amino_acid_to_remove = &aa_model;
194 break;
195 }
196 }
197 if(amino_acid_to_remove != nullptr)
198 {
199 if(std::abs(front().amino_acid.getMass() - amino_acid_to_remove->amino_acid.getMass()) <
200 0.001)
201 {
202 erase(begin());
203 if(pos > 0)
204 at(pos - 1).mass_difference = 0;
205 return true;
206 }
207 }
208 return false;
209}

References pappso::specglob::AminoAcidModel::amino_acid, and pappso::Aa::getMass().

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

◆ matchExperimentalPeaks()

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

Definition at line 319 of file peptidemodel.cpp.

320{
321 if(m_theoreticalPeakList.size() == 0)
322 {
323 m_intensityExperimentalPeaks = mcsp_peakList.get()->totalIonCurrent();
324 generateTheoreticalPeaks(precision);
325 }
326 auto it_expe_peaks_end = mcsp_peakList.get()->end();
327 auto it_expe_peaks = mcsp_peakList.get()->begin();
328 auto it_theo_peaks = m_theoreticalPeakList.begin();
329 while((it_expe_peaks != mcsp_peakList.get()->end()) &&
330 (it_theo_peaks != m_theoreticalPeakList.end()))
331 {
332 while((it_expe_peaks != mcsp_peakList.get()->end()) &&
333 (it_expe_peaks->x < it_theo_peaks->mz_range.lower()))
334 { // find the first possible ion hit
335 it_expe_peaks++;
336 }
337 if(it_expe_peaks == mcsp_peakList.get()->end())
338 continue;
339
340 if(it_expe_peaks->x < it_theo_peaks->mz_range.upper())
341 {
342 // ok, we've got a hit
343 auto it_theo_peaks_loop = it_theo_peaks;
344 while((it_theo_peaks_loop != m_theoreticalPeakList.end()) &&
345 (it_theo_peaks_loop->mz_range.contains(it_expe_peaks->x)))
346 {
347 if((it_theo_peaks_loop->it_experimental_peak_match == it_expe_peaks_end) ||
348 (it_theo_peaks_loop->it_experimental_peak_match->y < it_expe_peaks->y))
349 {
350 it_theo_peaks_loop->it_experimental_peak_match = it_expe_peaks;
351 qDebug() << "match: mz=" << it_expe_peaks->x << " intensity=" << it_expe_peaks->y;
352 break;
353 }
354 it_theo_peaks_loop++;
355 }
356 it_expe_peaks++;
357 }
358 else
359 {
360 it_theo_peaks++;
361 }
362 // it_expe_peaks++;
363 }
364
365 // get number of shared peaks
368 std::vector<std::vector<pappso::DataPoint>::const_iterator> matched_experimental_peaks;
369 for(auto &theo_peak : m_theoreticalPeakList)
370 {
371 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
372 {
373 matched_experimental_peaks.push_back(theo_peak.it_experimental_peak_match);
374 // m_countSharedPeaks++;
375 }
376 }
377 auto it_end = std::unique(matched_experimental_peaks.begin(), matched_experimental_peaks.end());
378 m_countSharedPeaks = std::distance(matched_experimental_peaks.begin(), it_end);
379 m_intensitySharedPeaks = std::accumulate(
380 matched_experimental_peaks.begin(),
381 it_end,
382 0.0,
383 [](double k, const std::vector<pappso::DataPoint>::const_iterator &l) { return (k + l->y); });
384}
void generateTheoreticalPeaks(pappso::PrecisionPtr precision)

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

Referenced by 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 299 of file peptidemodel.cpp.

300{
301 std::size_t count = 0;
302 if(m_beginMassDelta != 0.0)
303 count++;
304 for(auto aa_model : *this)
305 {
306 if(aa_model.mass_difference != 0.0)
307 count++;
308 }
309 return count;
310}

References m_beginMassDelta.

◆ operator=()

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

Definition at line 89 of file peptidemodel.cpp.

90{
91
92 assign(other.begin(), other.end());
93 m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
94 mcsp_peakList = other.mcsp_peakList;
95
96 m_experimentalPrecursorMass = other.m_experimentalPrecursorMass;
97 m_beginMassDelta = other.m_beginMassDelta;
98
99 m_nterModification = other.m_nterModification;
100 m_cterModification = other.m_cterModification;
101 m_countSharedPeaks = other.m_countSharedPeaks;
102 m_intensitySharedPeaks = other.m_intensitySharedPeaks;
103 m_intensityExperimentalPeaks = other.m_intensityExperimentalPeaks;
104 m_theoreticalPeakList.clear();
105 return *this;
106}

References PeptideModel(), 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 592 of file peptidemodel.cpp.

593{
594 if(m_theoreticalPeakList.size() == 0)
595 {
596 throw pappso::PappsoException("missing peak matching");
597 }
598 bool modified = false;
599 auto it_expe_peaks_end = mcsp_peakList.get()->end();
600 for(auto &theo_peak : m_theoreticalPeakList)
601 {
602 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
603 {
604 if(at(theo_peak.aa_indice).bracket == true)
605 {
606 modified = true;
607 at(theo_peak.aa_indice).bracket = false;
608 }
609 }
610 }
611 return modified;
612}

References m_theoreticalPeakList, and mcsp_peakList.

◆ setBeginMassDelta()

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

Definition at line 313 of file peptidemodel.cpp.

314{
315 m_beginMassDelta = delta;
316}

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 213 of file peptidemodel.cpp.

214{
215 QString peptide_str("[");
216
217 // if(m_beginMassDelta != 0.0)
218 // peptide_str.append(
219 // QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
220 // ProForma version 2 unexplained mass delta :
221 // peptide_str.append(
222 // QString("_[%1]").arg(QString::number(getMassDelta(), 'f', 2)));
223
224 if(getMassDelta() > 0)
225 {
226 peptide_str.append("+");
227 }
228 peptide_str.append(QString("%1]?").arg(QString::number(getMassDelta(), 'f', 4)));
229 peptide_str.replace("[+0.0000]?", "");
230 peptide_str.replace("[-0.0000]?", "");
231
232
233 double mass_diff = m_beginMassDelta;
234 for(auto aa_model : *this)
235 {
236 qDebug() << " aa_model.amino_acid.toString()=" << aa_model.amino_acid.toAbsoluteString()
237 << " aa_model.alignment_type=" << Utils::toString(aa_model.alignment_type)
238 << " aa_model.mass_difference=" << aa_model.mass_difference
239 << " aa_model.bracket=" << aa_model.bracket;
240
241 if(aa_model.bracket)
242 {
243 }
244
245 if(aa_model.remove)
246 {
247 peptide_str.append(aa_model.amino_acid.getLetter());
248
249 peptide_str.append(
250 "[" +
251 AaModification::getInstanceRemovalAccessionByAaLetter(aa_model.amino_acid.getLetter())
252 ->getAccession() +
253 "]");
254 }
255 else
256 {
257 peptide_str.append(aa_model.amino_acid.toProForma());
258
259 mass_diff += aa_model.mass_difference;
260 if(mass_diff != 0.0)
261 {
262 if(mass_diff > 0)
263 {
264 peptide_str.append(QString("[+%1]").arg(QString::number(mass_diff, 'f', 4)));
265 }
266 else
267 {
268 peptide_str.append(QString("[%1]").arg(QString::number(mass_diff, 'f', 4)));
269 }
270 }
271 }
272 mass_diff = 0.0;
273 }
274 return peptide_str;
275}
const QString & getAccession() const
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:517

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

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

◆ toString()

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

Definition at line 128 of file peptidemodel.cpp.

129{
130 QString peptide_str;
131
132 if(m_beginMassDelta != 0.0)
133 peptide_str.append(QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
134
135 for(auto aa_model : *this)
136 {
137 qDebug() << " aa_model.amino_acid.toString()=" << aa_model.amino_acid.toAbsoluteString()
138 << " aa_model.alignment_type=" << Utils::toString(aa_model.alignment_type)
139 << " aa_model.mass_difference=" << aa_model.mass_difference
140 << " aa_model.bracket=" << aa_model.bracket;
141
142 if(aa_model.remove)
143 peptide_str.append("-(");
144 if(aa_model.bracket)
145 {
146 peptide_str.append(QString("[%1]").arg(aa_model.amino_acid.toString()));
147 }
148 else
149 {
150 peptide_str.append(aa_model.amino_acid.toString());
151 }
152
153
154 if(aa_model.mass_difference != 0.0)
155 {
156 peptide_str.append(
157 QString("[%1]").arg(QString::number(aa_model.mass_difference, 'f', 2)));
158 }
159
160 if(aa_model.remove)
161 peptide_str.append(")");
162 }
163
164 peptide_str.replace(")-(", "");
165 peptide_str.append(QString("_[%1]").arg(QString::number(getMassDelta(), 'f', 2)));
166 peptide_str.replace("_[0.00]", "");
167 peptide_str.replace("_[-0.00]", "");
168 return peptide_str;
169}

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

Referenced by eliminateComplementaryDelta(), pappso::specglob::PostTreatment::findBetterPeptideModel(), pappso::cbor::psm::PsmSpecGlobScan::process(), pappso::specglob::PostTreatment::tryBetterPositionOffsets(), and pappso::specglob::PostTreatment::tryToRemoveOffsets().

Member Data Documentation

◆ m_beginMassDelta

◆ m_countSharedPeaks

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

◆ m_cterModification

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

Definition at line 228 of file peptidemodel.h.

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

◆ m_experimentalPrecursorMass

double pappso::specglob::PeptideModel::m_experimentalPrecursorMass
private

Definition at line 223 of file peptidemodel.h.

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

◆ m_intensityExperimentalPeaks

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

◆ m_intensitySharedPeaks

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

◆ m_nterModification

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

◆ m_theoreticalPeakList

◆ mcsp_peakList


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