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
 
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
 

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:467
AaModificationP getInternalCterModification() const
Definition peptide.cpp:478
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 426 of file peptidemodel.cpp.

427{
428 back().mass_difference = getMassDelta();
429}
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 751 of file peptidemodel.cpp.

753{
754
755 bool modif = false;
756
757 double mass_difference = m_beginMassDelta;
758 for(auto &aa_model : *this)
759 {
760 mass_difference += aa_model.mass_difference;
761 auto aa_ref = aa_model.amino_acid;
762 if(aa_ref.getLetter() == aa_modified.getLetter())
763 {
764 if(mass_difference != 0.0)
765 {
766 double mass_modification = aa_modified.getTotalModificationMass();
767 if(std::abs(mass_modification - mass_difference) <
768 precision->getNominal())
769 {
770 aa_model.mass_difference = 0;
771 for(auto &modification : aa_modified.getModificationList())
772 {
773 aa_model.amino_acid.addAaModification(modification);
774 }
775 modif = true;
776 }
777 }
778 }
779 mass_difference = 0;
780 }
781 return modif;
782}
virtual const char & getLetter() const
Definition aabase.cpp:433
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 723 of file peptidemodel.cpp.

725{
726
727 bool modif = false;
728
729 double mass_difference = m_beginMassDelta;
730 for(auto &aa_model : *this)
731 {
732 mass_difference += aa_model.mass_difference;
733 auto aa_ref = aa_model.amino_acid;
734 if(mass_difference != 0.0)
735 {
736 if(std::abs(modification->getMass() - mass_difference) <
737 precision->getNominal())
738 {
739 aa_model.mass_difference = 0;
740 aa_model.amino_acid.addAaModification(modification);
741 modif = true;
742 }
743 }
744 mass_difference = 0;
745 }
746 return modif;
747}
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 617 of file peptidemodel.cpp.

619{
620 bool modif = false;
621 double total_mass_to_insert = amino_acid_candidate.getMass();
622 auto insert_aa_modification =
624 amino_acid_candidate.getLetter());
625
626 double mass_difference = m_beginMassDelta;
627 for(auto &aa_model : *this)
628 {
629 mass_difference += aa_model.mass_difference;
630 auto aa_ref = aa_model.amino_acid;
631 if(mass_difference != 0.0)
632 {
633 mass_difference += aa_ref.getTotalModificationMass();
634 AaModificationP aa_ref_remove =
636 aa_model.amino_acid.getLetter());
637 // check for possible mutation
638 double current_diff =
639 (aa_ref_remove->getMass() - mass_difference) + total_mass_to_insert;
640
641
642 qDebug() << "current_diff=" << current_diff;
643 if(std::abs(current_diff) < precision->getNominal())
644 {
645 qDebug() << "modif = true=";
646 aa_model.mass_difference = 0;
647 aa_model.amino_acid.removeAllButInternalModification();
648 aa_model.amino_acid.addAaModification(aa_ref_remove);
649 aa_model.amino_acid.addAaModification(insert_aa_modification);
650 for(auto &mod : amino_acid_candidate.getModificationList())
651 {
652 aa_model.amino_acid.addAaModification(mod);
653 }
654 modif = true;
655 }
656 }
657 mass_difference = 0;
658 }
659 return modif;
660}
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 663 of file peptidemodel.cpp.

665{
666 bool modif = false;
667 // AaModificationP carbamido = AaModification::getInstance("MOD:00397");
668 // AaModificationP metox = AaModification::getInstance("MOD:00719");
669
670 std::vector<AaModificationP> modificationInsertList;
671 for(const auto aa : aa_list)
672 {
673 modificationInsertList.push_back(
675 }
676 double mass_difference = m_beginMassDelta;
677 for(auto &aa_model : *this)
678 {
679 mass_difference += aa_model.mass_difference;
680 auto aa_ref = aa_model.amino_acid;
681 if(mass_difference != 0.0)
682 {
683 mass_difference += aa_ref.getTotalModificationMass();
684 AaModificationP aa_ref_remove =
686 aa_model.amino_acid.getLetter());
687 AaModificationP aa_ref_insert = nullptr;
688 double better_diff = 10;
689 // check for possible mutation
690 for(const auto aaInsertion : modificationInsertList)
691 {
692 double current_diff =
693 (aa_ref_remove->getMass() - mass_difference) +
694 aaInsertion->getMass();
695 qDebug() << aa_model.amino_acid.getLetter() << " "
696 << aaInsertion->getName() << " "
697 << aaInsertion->getMass() << " " << current_diff;
698 if(std::abs(current_diff) < std::abs(better_diff))
699 {
700 aa_ref_insert = aaInsertion;
701 better_diff = current_diff;
702 }
703 }
704 qDebug() << "better_diff=" << better_diff;
705 if((aa_ref_insert != nullptr) &&
706 (std::abs(better_diff) < precision->getNominal()))
707 {
708
709 qDebug() << "modif = true=";
710 aa_model.mass_difference = 0;
711 aa_model.amino_acid.removeAllButInternalModification();
712 aa_model.amino_acid.addAaModification(aa_ref_remove);
713 aa_model.amino_acid.addAaModification(aa_ref_insert);
714 modif = true;
715 }
716 }
717 mass_difference = 0;
718 }
719 return modif;
720}

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

433{
434 double precision_ref = precision->getNominal();
435 double offset = 0;
436 bool modified = false;
437 std::vector<AminoAcidModel>::iterator it_begin_block = end();
438 if(std::abs(m_beginMassDelta) > precision_ref)
439 {
440 it_begin_block = begin();
441 offset = m_beginMassDelta;
442
443 qDebug() << " new block offset=" << offset;
444 }
445 qDebug() << offset;
446 for(auto it = begin(); it != end(); it++)
447 {
448 qDebug() << " it->mass_difference=" << it->mass_difference;
449 if(it_begin_block == end())
450 {
451
452 if(std::abs(it->mass_difference) > precision_ref)
453 {
454 // new block
455 it_begin_block = it;
456 offset = it->mass_difference;
457 }
458 qDebug() << " new block offset=" << offset;
459 }
460 if(it_begin_block != end())
461 {
462 // existing block
463 qDebug() << " existing block offset=" << offset;
464 if(it == begin())
465 {
466 offset += it->mass_difference;
467 }
468 else
469 {
470 // where is the end of the block ?
471 qDebug() << " where is the end of the block ? offset=" << offset;
472 auto it_end_block = std::find_if(
473 it,
474 end(),
475 [offset, precision_ref](const AminoAcidModel &point) {
476 qDebug() << point.mass_difference << " "
477 << offset + point.mass_difference;
478 if(std::abs(offset + point.mass_difference) <= precision_ref)
479 return true;
480 return false;
481 });
482
483 if(it_end_block != end())
484 {
485 // eliminate mass mass_difference
486 modified = true;
487 if(it_begin_block == begin())
489 it_begin_block->mass_difference = 0.0;
490 it_end_block->mass_difference = 0.0;
491 // start new block search
492 it_begin_block = end();
493 offset = 0;
494 qDebug() << " existing block end block found";
495 }
496 else
497 {
498 qDebug() << " existing block end block not found offset="
499 << offset;
500 // close block
501 it_begin_block = end();
502 offset = 0;
503 }
504 }
505 }
506 }
507 qDebug() << toString();
508 return modified;
509}

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

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

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

514{ // System.out.println("Elimination des neg offsets");
515 double precision_ref = precision->getNominal();
516 auto it_reverse = rbegin();
517 bool modified = false;
518
519 while(it_reverse != rend())
520 {
521 if(it_reverse->remove)
522 {
523 // this is a part of already removed block
524 }
525 else
526 {
527 double mass_difference = it_reverse->mass_difference;
528 if(mass_difference < 0)
529 {
530 // try to find an amino acid blocl of that mass
531 double cumul_mass_aa = 0;
532 auto it_block_end = it_reverse;
533 while(it_block_end != rend())
534 {
535 cumul_mass_aa += it_block_end->amino_acid.getMass();
536 it_block_end++;
537 if(std::abs(mass_difference + cumul_mass_aa) < precision_ref)
538 {
539 modified = true;
540 // block found -> remove this range
541 for(auto it_block = it_reverse; it_block != it_block_end;
542 it_block++)
543 {
544 it_block->remove = true;
545 }
546 }
547 else
548 {
549 if((it_block_end != rend()) &&
550 (it_block_end->mass_difference != 0.0))
551 {
552 // interrupted block
553 break;
554 }
555 }
556 }
557 }
558 }
559 it_reverse++;
560 }
561
562 return modified;
563}

References pappso::PrecisionBase::getNominal().

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

◆ generateTheoreticalPeaks()

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

Definition at line 352 of file peptidemodel.cpp.

353{
354 m_theoreticalPeakList.clear();
355 double cumul_mass = m_beginMassDelta + m_nterModification->getMass() -
357
358
359 auto it_expe_peaks_end = mcsp_peakList.get()->end();
360 std::size_t i = 0;
361 for(auto aa_model : *this)
362 {
363 // compute B ions
364 cumul_mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
365
366 qDebug() << cumul_mass;
367 m_theoreticalPeakList.push_back(
368 {pappso::MzRange(cumul_mass, precision), it_expe_peaks_end, i});
369 i++;
370 }
371 // remove the complete ion B (entire peptide, no fragment):
372 m_theoreticalPeakList.pop_back();
373
374 std::size_t bmaxindice = m_theoreticalPeakList.size();
375 double yion_delta =
377 cumul_mass += yion_delta + pappso::MHPLUS;
378 for(std::size_t i = 0; i < bmaxindice; i++)
379 {
380 m_theoreticalPeakList.push_back(
381 {pappso::MzRange(cumul_mass - m_theoreticalPeakList[i].mz_range.getMz(),
382 precision),
383 it_expe_peaks_end,
384 i + 1});
385 qDebug() << m_theoreticalPeakList.back().mz_range.getMz();
386 }
387
388 std::sort(
389 m_theoreticalPeakList.begin(),
391 [](const TheoreticalPeakDataPoint &a, const TheoreticalPeakDataPoint &b) {
392 return a.mz_range.getMz() < b.mz_range.getMz();
393 });
394}
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 420 of file peptidemodel.cpp.

421{
423}

References m_intensityExperimentalPeaks.

◆ getIntensitySharedPeaks()

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

Definition at line 414 of file peptidemodel.cpp.

415{
417}

References m_intensitySharedPeaks.

◆ getMass()

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

Definition at line 232 of file peptidemodel.cpp.

233{
234 double mass = m_beginMassDelta;
235 if(m_cterModification != nullptr)
236 mass += m_cterModification->getMass();
237 if(m_nterModification != nullptr)
238 mass += m_nterModification->getMass();
239
240 for(auto aa_model : *this)
241 {
242 mass += aa_model.amino_acid.getMass() + aa_model.mass_difference;
243 }
244 return mass;
245}

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

Referenced by getMassDelta().

◆ getMassDelta()

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

◆ getTheoreticalIonMassList()

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

Definition at line 397 of file peptidemodel.cpp.

398{
399 std::vector<double> mass_list;
400 for(auto &datapoint : m_theoreticalPeakList)
401 {
402 mass_list.push_back(datapoint.mz_range.getMz());
403 }
404 return mass_list;
405}

References m_theoreticalPeakList.

◆ getTheoreticalPeakDataPointList()

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

Definition at line 589 of file peptidemodel.cpp.

590{
592}

References m_theoreticalPeakList.

◆ getTheoreticalPeakDataPointListToString()

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

Definition at line 595 of file peptidemodel.cpp.

596{
597
598 auto it_expe_peaks_end = mcsp_peakList.get()->end();
599 QString str;
600 for(auto &theo_peak : m_theoreticalPeakList)
601 {
602 double intensity = 0;
603 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
604 {
605 intensity = theo_peak.it_experimental_peak_match->y;
606 }
607 str.append(QString("{%1,%2,%3,%4}")
608 .arg(theo_peak.mz_range.getMz())
609 .arg(intensity)
610 .arg(theo_peak.aa_indice)
611 .arg(at(theo_peak.aa_indice).amino_acid.toString()));
612 }
613 return str;
614}

References m_theoreticalPeakList, and mcsp_peakList.

◆ matchExperimentalPeaks()

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

Definition at line 274 of file peptidemodel.cpp.

275{
276 if(m_theoreticalPeakList.size() == 0)
277 {
278 m_intensityExperimentalPeaks = mcsp_peakList.get()->totalIonCurrent();
279 generateTheoreticalPeaks(precision);
280 }
281 auto it_expe_peaks_end = mcsp_peakList.get()->end();
282 auto it_expe_peaks = mcsp_peakList.get()->begin();
283 auto it_theo_peaks = m_theoreticalPeakList.begin();
284 while((it_expe_peaks != mcsp_peakList.get()->end()) &&
285 (it_theo_peaks != m_theoreticalPeakList.end()))
286 {
287 while((it_expe_peaks != mcsp_peakList.get()->end()) &&
288 (it_expe_peaks->x < it_theo_peaks->mz_range.lower()))
289 { // find the first possible ion hit
290 it_expe_peaks++;
291 }
292 if(it_expe_peaks == mcsp_peakList.get()->end())
293 continue;
294
295 if(it_expe_peaks->x < it_theo_peaks->mz_range.upper())
296 {
297 // ok, we've got a hit
298 auto it_theo_peaks_loop = it_theo_peaks;
299 while((it_theo_peaks_loop != m_theoreticalPeakList.end()) &&
300 (it_theo_peaks_loop->mz_range.contains(it_expe_peaks->x)))
301 {
302 if((it_theo_peaks_loop->it_experimental_peak_match ==
303 it_expe_peaks_end) ||
304 (it_theo_peaks_loop->it_experimental_peak_match->y <
305 it_expe_peaks->y))
306 {
307 it_theo_peaks_loop->it_experimental_peak_match =
308 it_expe_peaks;
309 qDebug() << "match: mz=" << it_expe_peaks->x
310 << " intensity=" << it_expe_peaks->y;
311 break;
312 }
313 it_theo_peaks_loop++;
314 }
315 it_expe_peaks++;
316 }
317 else
318 {
319 it_theo_peaks++;
320 }
321 // it_expe_peaks++;
322 }
323
324 // get number of shared peaks
327 std::vector<std::vector<pappso::DataPoint>::const_iterator>
328 matched_experimental_peaks;
329 for(auto &theo_peak : m_theoreticalPeakList)
330 {
331 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
332 {
333 matched_experimental_peaks.push_back(
334 theo_peak.it_experimental_peak_match);
335 // m_countSharedPeaks++;
336 }
337 }
338 auto it_end = std::unique(matched_experimental_peaks.begin(),
339 matched_experimental_peaks.end());
341 std::distance(matched_experimental_peaks.begin(), it_end);
342 m_intensitySharedPeaks = std::accumulate(
343 matched_experimental_peaks.begin(),
344 it_end,
345 0.0,
346 [](double k, const std::vector<pappso::DataPoint>::const_iterator &l) {
347 return (k + l->y);
348 });
349}
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 254 of file peptidemodel.cpp.

255{
256 std::size_t count = 0;
257 if(m_beginMassDelta != 0.0)
258 count++;
259 for(auto aa_model : *this)
260 {
261 if(aa_model.mass_difference != 0.0)
262 count++;
263 }
264 return count;
265}

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

567{
568 if(m_theoreticalPeakList.size() == 0)
569 {
570 throw pappso::PappsoException("missing peak matching");
571 }
572 bool modified = false;
573 auto it_expe_peaks_end = mcsp_peakList.get()->end();
574 for(auto &theo_peak : m_theoreticalPeakList)
575 {
576 if(theo_peak.it_experimental_peak_match != it_expe_peaks_end)
577 {
578 if(at(theo_peak.aa_indice).bracket == true)
579 {
580 modified = true;
581 at(theo_peak.aa_indice).bracket = false;
582 }
583 }
584 }
585 return modified;
586}

References m_theoreticalPeakList, and mcsp_peakList.

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

◆ setBeginMassDelta()

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

Definition at line 268 of file peptidemodel.cpp.

269{
270 m_beginMassDelta = delta;
271}

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

176{
177 QString peptide_str;
178
179 // if(m_beginMassDelta != 0.0)
180 // peptide_str.append(
181 // QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
182
183 double mass_diff = m_beginMassDelta;
184 for(auto aa_model : *this)
185 {
186 qDebug() << " aa_model.amino_acid.toString()="
187 << aa_model.amino_acid.toAbsoluteString()
188 << " aa_model.alignment_type="
189 << Utils::toString(aa_model.alignment_type)
190 << " aa_model.mass_difference=" << aa_model.mass_difference
191 << " aa_model.bracket=" << aa_model.bracket;
192
193 if(aa_model.bracket)
194 {
195 }
196
197 if(aa_model.remove)
198 {
199 peptide_str.append(aa_model.amino_acid.getLetter());
200
201 peptide_str.append(
202 "[" +
204 aa_model.amino_acid.getLetter())
205 ->getAccession() +
206 "]");
207 }
208 else
209 {
210 peptide_str.append(aa_model.amino_acid.toProForma());
211
212 mass_diff += aa_model.mass_difference;
213 if(mass_diff != 0.0)
214 {
215 if(mass_diff > 0)
216 {
217 peptide_str.append(
218 QString("[+%1]").arg(QString::number(mass_diff, 'f', 4)));
219 }
220 else
221 {
222 peptide_str.append(
223 QString("[%1]").arg(QString::number(mass_diff, 'f', 4)));
224 }
225 }
226 }
227 mass_diff = 0.0;
228 }
229 return peptide_str;
230}
const QString & getAccession() const
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:489

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

◆ toString()

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

Definition at line 125 of file peptidemodel.cpp.

126{
127 QString peptide_str;
128
129 if(m_beginMassDelta != 0.0)
130 peptide_str.append(
131 QString("[%1]").arg(QString::number(m_beginMassDelta, 'f', 2)));
132
133 for(auto aa_model : *this)
134 {
135 qDebug() << " aa_model.amino_acid.toString()="
136 << aa_model.amino_acid.toAbsoluteString()
137 << " aa_model.alignment_type="
138 << 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(
147 QString("[%1]").arg(aa_model.amino_acid.toString()));
148 }
149 else
150 {
151 peptide_str.append(aa_model.amino_acid.toString());
152 }
153
154
155 if(aa_model.mass_difference != 0.0)
156 {
157 peptide_str.append(QString("[%1]").arg(
158 QString::number(aa_model.mass_difference, 'f', 2)));
159 }
160
161 if(aa_model.remove)
162 peptide_str.append(")");
163 }
164
165 peptide_str.replace(")-(", "");
166 peptide_str.append(
167 QString("_[%1]").arg(QString::number(getMassDelta(), 'f', 2)));
168 peptide_str.replace("_[0.00]", "");
169 peptide_str.replace("_[-0.00]", "");
170 return peptide_str;
171}

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

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

◆ m_experimentalPrecursorMass

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

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