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< 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 aa_pep.removeInternalCterModification();
64 aa_pep.removeInternalNterModification();
65
66 push_back({aa_pep, SpectralAlignmentType::nonAlign, false, 0.0});
67 }
68
69 // internal:Nter_hydrolytic_cleavage_H
70
71 // internal:Cter_hydrolytic_cleavage_HO
72 //
73}
AaModificationP getInternalNterModification() const
Definition peptide.cpp:468
AaModificationP getInternalCterModification() const
Definition peptide.cpp:479
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)

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.

49{
50 // not valid
51}

◆ PeptideModel() [3/3]

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

Copy constructor

Parameters
otherTODO

Definition at line 75 of file peptidemodel.cpp.

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

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.

121{
122}

Member Function Documentation

◆ assignResidualMass2Cter()

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

Definition at line 473 of file peptidemodel.cpp.

474{
475 back().mass_difference = getMassDelta();
476}
double getMassDelta() const
mass delta between experimental and theoretical mass

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

Definition at line 798 of file peptidemodel.cpp.

800{
801
802 bool modif = false;
803
804 double mass_difference = m_beginMassDelta;
805 for(auto &aa_model : *this)
806 {
807 mass_difference += aa_model.mass_difference;
808 auto aa_ref = aa_model.amino_acid;
809 if(aa_ref.getLetter() == aa_modified.getLetter())
810 {
811 if(mass_difference != 0.0)
812 {
813 double mass_modification = aa_modified.getTotalModificationMass();
814 if(std::abs(mass_modification - mass_difference) <
815 precision->getNominal())
816 {
817 aa_model.mass_difference = 0;
818 for(auto &modification : aa_modified.getModificationList())
819 {
820 aa_model.amino_acid.addAaModification(modification);
821 }
822 modif = true;
823 }
824 }
825 }
826 mass_difference = 0;
827 }
828 return modif;
829}
virtual const char & getLetter() const
Definition aabase.cpp:436
double getTotalModificationMass() const
get the sum of mass modifications
Definition aa.cpp:79
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 770 of file peptidemodel.cpp.

772{
773
774 bool modif = false;
775
776 double mass_difference = m_beginMassDelta;
777 for(auto &aa_model : *this)
778 {
779 mass_difference += aa_model.mass_difference;
780 auto aa_ref = aa_model.amino_acid;
781 if(mass_difference != 0.0)
782 {
783 if(std::abs(modification->getMass() - mass_difference) <
784 precision->getNominal())
785 {
786 aa_model.mass_difference = 0;
787 aa_model.amino_acid.addAaModification(modification);
788 modif = true;
789 }
790 }
791 mass_difference = 0;
792 }
793 return modif;
794}
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 664 of file peptidemodel.cpp.

666{
667 bool modif = false;
668 double total_mass_to_insert = amino_acid_candidate.getMass();
669 auto insert_aa_modification =
671 amino_acid_candidate.getLetter());
672
673 double mass_difference = m_beginMassDelta;
674 for(auto &aa_model : *this)
675 {
676 mass_difference += aa_model.mass_difference;
677 auto aa_ref = aa_model.amino_acid;
678 if(mass_difference != 0.0)
679 {
680 mass_difference += aa_ref.getTotalModificationMass();
681 AaModificationP aa_ref_remove =
683 aa_model.amino_acid.getLetter());
684 // check for possible mutation
685 double current_diff =
686 (aa_ref_remove->getMass() - mass_difference) + total_mass_to_insert;
687
688
689 qDebug() << "current_diff=" << current_diff;
690 if(std::abs(current_diff) < precision->getNominal())
691 {
692 qDebug() << "modif = true=";
693 aa_model.mass_difference = 0;
694 aa_model.amino_acid.removeAllButInternalModification();
695 aa_model.amino_acid.addAaModification(aa_ref_remove);
696 aa_model.amino_acid.addAaModification(insert_aa_modification);
697 for(auto &mod : amino_acid_candidate.getModificationList())
698 {
699 aa_model.amino_acid.addAaModification(mod);
700 }
701 modif = true;
702 }
703 }
704 mass_difference = 0;
705 }
706 return modif;
707}
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::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_listamno acid list to test (beware of cysteine + carbamidomethyl)
precision: The mass spectrometer precision
Returns
true if model is modified

Definition at line 710 of file peptidemodel.cpp.

712{
713 bool modif = false;
714 // AaModificationP carbamido = AaModification::getInstance("MOD:00397");
715 // AaModificationP metox = AaModification::getInstance("MOD:00719");
716
717 std::vector<AaModificationP> modificationInsertList;
718 for(const auto aa : aa_list)
719 {
720 modificationInsertList.push_back(
722 }
723 double mass_difference = m_beginMassDelta;
724 for(auto &aa_model : *this)
725 {
726 mass_difference += aa_model.mass_difference;
727 auto aa_ref = aa_model.amino_acid;
728 if(mass_difference != 0.0)
729 {
730 mass_difference += aa_ref.getTotalModificationMass();
731 AaModificationP aa_ref_remove =
733 aa_model.amino_acid.getLetter());
734 AaModificationP aa_ref_insert = nullptr;
735 double better_diff = 10;
736 // check for possible mutation
737 for(const auto aaInsertion : modificationInsertList)
738 {
739 double current_diff =
740 (aa_ref_remove->getMass() - mass_difference) +
741 aaInsertion->getMass();
742 qDebug() << aa_model.amino_acid.getLetter() << " "
743 << aaInsertion->getName() << " "
744 << aaInsertion->getMass() << " " << current_diff;
745 if(std::abs(current_diff) < std::abs(better_diff))
746 {
747 aa_ref_insert = aaInsertion;
748 better_diff = current_diff;
749 }
750 }
751 qDebug() << "better_diff=" << better_diff;
752 if((aa_ref_insert != nullptr) &&
753 (std::abs(better_diff) < precision->getNominal()))
754 {
755
756 qDebug() << "modif = true=";
757 aa_model.mass_difference = 0;
758 aa_model.amino_acid.removeAllButInternalModification();
759 aa_model.amino_acid.addAaModification(aa_ref_remove);
760 aa_model.amino_acid.addAaModification(aa_ref_insert);
761 modif = true;
762 }
763 }
764 mass_difference = 0;
765 }
766 return modif;
767}

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.

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

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

480{
481 double precision_ref = precision->getNominal();
482 double offset = 0;
483 bool modified = false;
484 std::vector<AminoAcidModel>::iterator it_begin_block = end();
485 if(std::abs(m_beginMassDelta) > precision_ref)
486 {
487 it_begin_block = begin();
488 offset = m_beginMassDelta;
489
490 qDebug() << " new block offset=" << offset;
491 }
492 qDebug() << offset;
493 for(auto it = begin(); it != end(); it++)
494 {
495 qDebug() << " it->mass_difference=" << it->mass_difference;
496 if(it_begin_block == end())
497 {
498
499 if(std::abs(it->mass_difference) > precision_ref)
500 {
501 // new block
502 it_begin_block = it;
503 offset = it->mass_difference;
504 }
505 qDebug() << " new block offset=" << offset;
506 }
507 if(it_begin_block != end())
508 {
509 // existing block
510 qDebug() << " existing block offset=" << offset;
511 if(it == begin())
512 {
513 offset += it->mass_difference;
514 }
515 else
516 {
517 // where is the end of the block ?
518 qDebug() << " where is the end of the block ? offset=" << offset;
519 auto it_end_block = std::find_if(
520 it,
521 end(),
522 [offset, precision_ref](const AminoAcidModel &point) {
523 qDebug() << point.mass_difference << " "
524 << offset + point.mass_difference;
525 if(std::abs(offset + point.mass_difference) <= precision_ref)
526 return true;
527 return false;
528 });
529
530 if(it_end_block != end())
531 {
532 // eliminate mass mass_difference
533 modified = true;
534 if(it_begin_block == begin())
536 it_begin_block->mass_difference = 0.0;
537 it_end_block->mass_difference = 0.0;
538 // start new block search
539 it_begin_block = end();
540 offset = 0;
541 qDebug() << " existing block end block found";
542 }
543 else
544 {
545 qDebug() << " existing block end block not found offset="
546 << offset;
547 // close block
548 it_begin_block = end();
549 offset = 0;
550 }
551 }
552 }
553 }
554 qDebug() << toString();
555 return modified;
556}

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

561{ // System.out.println("Elimination des neg offsets");
562 double precision_ref = precision->getNominal();
563 auto it_reverse = rbegin();
564 bool modified = false;
565
566 while(it_reverse != rend())
567 {
568 if(it_reverse->remove)
569 {
570 // this is a part of already removed block
571 }
572 else
573 {
574 double mass_difference = it_reverse->mass_difference;
575 if(mass_difference < 0)
576 {
577 // try to find an amino acid blocl of that mass
578 double cumul_mass_aa = 0;
579 auto it_block_end = it_reverse;
580 while(it_block_end != rend())
581 {
582 cumul_mass_aa += it_block_end->amino_acid.getMass();
583 it_block_end++;
584 if(std::abs(mass_difference + cumul_mass_aa) < precision_ref)
585 {
586 modified = true;
587 // block found -> remove this range
588 for(auto it_block = it_reverse; it_block != it_block_end;
589 it_block++)
590 {
591 it_block->remove = true;
592 }
593 }
594 else
595 {
596 if((it_block_end != rend()) &&
597 (it_block_end->mass_difference != 0.0))
598 {
599 // interrupted block
600 break;
601 }
602 }
603 }
604 }
605 }
606 it_reverse++;
607 }
608
609 return modified;
610}

References pappso::PrecisionBase::getNominal().

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

◆ generateTheoreticalPeaks()

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

Definition at line 399 of file peptidemodel.cpp.

400{
401 m_theoreticalPeakList.clear();
402 double cumul_mass = m_beginMassDelta + m_nterModification->getMass() -
404
405
406 auto it_expe_peaks_end = mcsp_peakList.get()->end();
407 std::size_t i = 0;
408 for(auto aa_model : *this)
409 {
410 // compute B ions
411 cumul_mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
412
413 qDebug() << cumul_mass;
414 m_theoreticalPeakList.push_back(
415 {pappso::MzRange(cumul_mass, precision), it_expe_peaks_end, i});
416 i++;
417 }
418 // remove the complete ion B (entire peptide, no fragment):
419 m_theoreticalPeakList.pop_back();
420
421 std::size_t bmaxindice = m_theoreticalPeakList.size();
422 double yion_delta =
424 cumul_mass += yion_delta + pappso::MHPLUS;
425 for(std::size_t i = 0; i < bmaxindice; i++)
426 {
427 m_theoreticalPeakList.push_back(
428 {pappso::MzRange(cumul_mass - m_theoreticalPeakList[i].mz_range.getMz(),
429 precision),
430 it_expe_peaks_end,
431 i + 1});
432 qDebug() << m_theoreticalPeakList.back().mz_range.getMz();
433 }
434
435 std::sort(
436 m_theoreticalPeakList.begin(),
438 [](const TheoreticalPeakDataPoint &a, const TheoreticalPeakDataPoint &b) {
439 return a.mz_range.getMz() < b.mz_range.getMz();
440 });
441}
static pappso_double getDeltaMass(PeptideIon ion_type)
@ y
Cter amino ions.
const pappso_double MHPLUS(1.007276466879)
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()

◆ getIntensityExperimentalPeaks()

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

Definition at line 467 of file peptidemodel.cpp.

468{
470}

References m_intensityExperimentalPeaks.

◆ getIntensitySharedPeaks()

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

Definition at line 461 of file peptidemodel.cpp.

462{
464}

References m_intensitySharedPeaks.

◆ getMass()

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

Definition at line 279 of file peptidemodel.cpp.

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

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

Referenced by getMassDelta(), and getMz().

◆ getMassDelta()

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

◆ getMz()

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

get the m/z peptide model mass

Definition at line 125 of file peptidemodel.cpp.

126{
127 return ((getMass() + (pappso::MHPLUS * charge)) / (double)charge);
128}

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

◆ getTheoreticalIonMassList()

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

Definition at line 444 of file peptidemodel.cpp.

445{
446 std::vector<double> mass_list;
447 for(auto &datapoint : m_theoreticalPeakList)
448 {
449 mass_list.push_back(datapoint.mz_range.getMz());
450 }
451 return mass_list;
452}

References m_theoreticalPeakList.

◆ getTheoreticalPeakDataPointList()

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

Definition at line 636 of file peptidemodel.cpp.

637{
639}

References m_theoreticalPeakList.

◆ getTheoreticalPeakDataPointListToString()

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

Definition at line 642 of file peptidemodel.cpp.

643{
644
645 auto it_expe_peaks_end = mcsp_peakList.get()->end();
646 QString str;
647 for(auto &theo_peak : m_theoreticalPeakList)
648 {
649 double intensity = 0;
650 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
651 {
652 intensity = theo_peak.it_experimental_peak_match->y;
653 }
654 str.append(QString("{%1,%2,%3,%4}")
655 .arg(theo_peak.mz_range.getMz())
656 .arg(intensity)
657 .arg(theo_peak.aa_indice)
658 .arg(at(theo_peak.aa_indice).amino_acid.toString()));
659 }
660 return str;
661}

References m_theoreticalPeakList, and mcsp_peakList.

◆ hasRemoval()

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

Definition at line 181 of file peptidemodel.cpp.

182{
183 for(auto aa_model : *this)
184 {
185 if(std::abs(aa_model.amino_acid.getMass() + aa_model.mass_difference) <
186 0.001)
187 return true;
188 }
189 return false;
190}

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

194{
195 AminoAcidModel *amino_acid_to_remove = nullptr;
196 int pos = -1;
197 for(auto aa_model : *this)
198 {
199 pos++;
200 if(std::abs(aa_model.amino_acid.getMass() + aa_model.mass_difference) <
201 0.001)
202 {
203 amino_acid_to_remove = &aa_model;
204 break;
205 }
206 }
207 if(amino_acid_to_remove != nullptr)
208 {
209 if(std::abs(front().amino_acid.getMass() -
210 amino_acid_to_remove->amino_acid.getMass()) < 0.001)
211 {
212 erase(begin());
213 if(pos > 0)
214 at(pos - 1).mass_difference = 0;
215 return true;
216 }
217 }
218 return false;
219}

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

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

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

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

References m_beginMassDelta.

◆ operator=()

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

Definition at line 92 of file peptidemodel.cpp.

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

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

614{
615 if(m_theoreticalPeakList.size() == 0)
616 {
617 throw pappso::PappsoException("missing peak matching");
618 }
619 bool modified = false;
620 auto it_expe_peaks_end = mcsp_peakList.get()->end();
621 for(auto &theo_peak : m_theoreticalPeakList)
622 {
623 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
624 {
625 if(at(theo_peak.aa_indice).bracket == true)
626 {
627 modified = true;
628 at(theo_peak.aa_indice).bracket = false;
629 }
630 }
631 }
632 return modified;
633}

References m_theoreticalPeakList, and mcsp_peakList.

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

◆ setBeginMassDelta()

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

Definition at line 315 of file peptidemodel.cpp.

316{
317 m_beginMassDelta = delta;
318}

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

223{
224 QString peptide_str;
225
226 // if(m_beginMassDelta != 0.0)
227 // peptide_str.append(
228 // QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
229
230 double mass_diff = m_beginMassDelta;
231 for(auto aa_model : *this)
232 {
233 qDebug() << " aa_model.amino_acid.toString()="
234 << aa_model.amino_acid.toAbsoluteString()
235 << " aa_model.alignment_type="
236 << Utils::toString(aa_model.alignment_type)
237 << " aa_model.mass_difference=" << aa_model.mass_difference
238 << " aa_model.bracket=" << aa_model.bracket;
239
240 if(aa_model.bracket)
241 {
242 }
243
244 if(aa_model.remove)
245 {
246 peptide_str.append(aa_model.amino_acid.getLetter());
247
248 peptide_str.append(
249 "[" +
251 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(
265 QString("[+%1]").arg(QString::number(mass_diff, 'f', 4)));
266 }
267 else
268 {
269 peptide_str.append(
270 QString("[%1]").arg(QString::number(mass_diff, 'f', 4)));
271 }
272 }
273 }
274 mass_diff = 0.0;
275 }
276 return peptide_str;
277}
const QString & getAccession() const
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:535

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

◆ toString()

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

Definition at line 131 of file peptidemodel.cpp.

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

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

◆ 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 233 of file peptidemodel.h.

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

◆ m_experimentalPrecursorMass

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

Definition at line 228 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: