libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::Peptide Class Reference

#include <peptide.h>

Inheritance diagram for pappso::Peptide:
pappso::PeptideInterface pappso::Ion pappso::AtomNumberInterface

Public Member Functions

 Peptide (const QString &pepstr)
virtual ~Peptide ()
 Peptide (const Peptide &peptide)
 Peptide (Peptide &&toCopy)
PeptideSp makePeptideSp () const
NoConstPeptideSp makeNoConstPeptideSp () const
void addAaModification (AaModificationP aaModification, unsigned int position)
 adds a modification to amino acid sequence
void addAaModificationOnAllAminoAcid (AaModificationP aaModification, Enums::AminoAcidChar amino_acid)
 adds a modification to all amino acid of the sequence
std::vector< Aa >::iterator begin ()
std::vector< Aa >::iterator end ()
std::vector< Aa >::const_iterator begin () const
std::vector< Aa >::const_iterator end () const
std::vector< Aa >::const_reverse_iterator rbegin () const
std::vector< Aa >::const_reverse_iterator rend () const
AagetAa (unsigned int position)
const AagetConstAa (unsigned int position) const
std::vector< double > getRawMassArray () const
 get raw mass array of the amino acid sequence
std::vector< double > getMassIonSerie (unsigned int charge, pappso::Enums::PeptideIon ion_type) const
 get complete serie of product masses for a given charge and ion type
pappso_double getMass ()
pappso_double getMass () const override
virtual int getNumberOfAtom (Enums::AtomIsotopeSurvey atom) const override
 get the number of atom C, O, N, H in the molecule
virtual int getNumberOfIsotope (Enums::Isotope isotope) const override
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
const QString getSequence () const override
 print amino acid sequence without modifications
unsigned int size () const override
unsigned int getNumberOfModification (AaModificationP mod) const
 count modification occurence
unsigned int countModificationOnAa (AaModificationP mod, const std::vector< char > &aa_list) const
 count modification occurence
void replaceAaModification (AaModificationP oldmod, AaModificationP newmod)
 replaces all occurences of a modification by a new one
void replaceAaModificationOnAminoAcid (Enums::AminoAcidChar aa, pappso::AaModificationP oldmod, pappso::AaModificationP newmod)
 replaces all occurences of a modification by a new one on a specific amino acid
void removeAaModification (AaModificationP mod)
 removes all occurences of a modification
std::vector< unsigned int > getModificationPositionList (AaModificationP mod) const
 get modification positions
std::vector< unsigned int > getModificationPositionList (AaModificationP mod, const std::vector< char > &aa_list) const
 get modification positions
std::vector< unsigned int > getAaPositionList (char aa) const
 get positions of one amino acid in peptide
std::vector< unsigned int > getAaPositionList (std::list< char > list_aa) const
const QString toString () const
 print modification except internal modifications
const QString toAbsoluteString () const
 print all modifications
const QString getLiAbsoluteString () const
 get all sequence string with modifications and converting Leucine to Isoleucine
void setCleavageNterModification (AaModificationP mod)
void setCleavageCterModification (AaModificationP mod)
AaModificationP getCleavageNterModification () const
AaModificationP getCleavageCterModification () const
void setNterModification (AaModificationP mod)
void setCterModification (AaModificationP mod)
AaModificationP getNterModification () const
AaModificationP getCterModification () const
void setGlobalModification (Enums::Isotope isotope_kind)
 apply 100% isotope replacement
void rotate ()
void reverse ()
virtual bool isPalindrome () const override
 tells if the peptide sequence is a palindrome
void replaceLeucineIsoleucine ()
void removeNterAminoAcid ()
void removeCterAminoAcid ()
QString toProForma () const
 get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README.md
virtual const ChemicalFormula getChemicalFormula () const override
virtual const ChemicalFormula getChemicalFormulaCharge (unsigned int charge) const override
Public Member Functions inherited from pappso::PeptideInterface
virtual const QString getSequenceLi () const
 amino acid sequence without modification where L are replaced by I
virtual const QString getName () const
virtual const QString getFormula (unsigned int charge) const final
virtual bool matchPeak (PrecisionPtr precision, pappso_double peak_mz, unsigned int charge) const final
 tells if the peptide m/z matches a given experimental mass
Public Member Functions inherited from pappso::Ion
 Ion ()
 ~Ion ()
virtual pappso_double getMz (unsigned int charge) const final

Protected Attributes

std::vector< Aam_aaVec
bool m_fullC13 = false
bool m_fullN15 = false
bool m_fullH2 = false
double m_proxyMass = -1
AaModificationP m_cleavageNterMod = nullptr
AaModificationP m_cleavageCterMod = nullptr
AaModificationP m_NterMod = nullptr
AaModificationP m_CterMod = nullptr

Friends

class PeptideProFormaParser
bool operator< (const Peptide &l, const Peptide &r)
bool operator== (const Peptide &l, const Peptide &r)

Detailed Description

Definition at line 101 of file peptide.h.

Constructor & Destructor Documentation

◆ Peptide() [1/3]

pappso::Peptide::Peptide ( const QString & pepstr)

Definition at line 106 of file peptide.cpp.

107{
108 qDebug();
109 m_cleavageNterMod = AaModification::getInstance("internal:Nter_hydrolytic_cleavage_H");
110 m_cleavageCterMod = AaModification::getInstance("internal:Cter_hydrolytic_cleavage_HO");
111
112 m_NterMod = nullptr;
113 m_CterMod = nullptr;
114 QString::const_iterator it(pepstr.begin());
115
116 while(it != pepstr.end())
117 {
118 qDebug() << it->toLatin1();
119 m_aaVec.push_back(Aa(it->toLatin1()));
120 it++;
121 }
122 qDebug();
123 getMass();
124}
static AaModificationP getInstance(const QString &accession)
AaModificationP m_cleavageCterMod
Definition peptide.h:274
AaModificationP m_NterMod
Definition peptide.h:275
AaModificationP m_cleavageNterMod
Definition peptide.h:272
pappso_double getMass()
Definition peptide.cpp:375
AaModificationP m_CterMod
Definition peptide.h:276
std::vector< Aa > m_aaVec
Definition peptide.h:266

References pappso::AaModification::getInstance(), getMass(), m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, and m_NterMod.

Referenced by Peptide(), Peptide(), and PeptideProFormaParser.

◆ ~Peptide()

pappso::Peptide::~Peptide ( )
virtual

Definition at line 126 of file peptide.cpp.

127{
128}

◆ Peptide() [2/3]

pappso::Peptide::Peptide ( const Peptide & peptide)

Definition at line 130 of file peptide.cpp.

131 : m_aaVec(peptide.m_aaVec),
132 m_fullC13(peptide.m_fullC13),
133 m_fullN15(peptide.m_fullN15),
134 m_fullH2(peptide.m_fullH2),
135 m_proxyMass(peptide.m_proxyMass),
136 m_cleavageNterMod(peptide.m_cleavageNterMod),
137 m_cleavageCterMod(peptide.m_cleavageCterMod),
138 m_NterMod(peptide.m_NterMod),
139 m_CterMod(peptide.m_CterMod)
140{
141 qDebug();
142}
double m_proxyMass
Definition peptide.h:270

References Peptide(), m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, m_fullC13, m_fullH2, m_fullN15, m_NterMod, and m_proxyMass.

◆ Peptide() [3/3]

pappso::Peptide::Peptide ( Peptide && toCopy)

Definition at line 145 of file peptide.cpp.

146 : m_aaVec(std::move(toCopy.m_aaVec)),
147 m_fullC13(toCopy.m_fullC13),
148 m_fullN15(toCopy.m_fullN15),
149 m_fullH2(toCopy.m_fullH2),
150 m_proxyMass(toCopy.m_proxyMass),
151 m_cleavageNterMod(toCopy.m_cleavageNterMod),
152 m_cleavageCterMod(toCopy.m_cleavageCterMod),
153 m_NterMod(toCopy.m_NterMod),
154 m_CterMod(toCopy.m_CterMod)
155{
156}

References Peptide(), m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, m_fullC13, m_fullH2, m_fullN15, m_NterMod, and m_proxyMass.

Member Function Documentation

◆ addAaModification()

void pappso::Peptide::addAaModification ( AaModificationP aaModification,
unsigned int position )

adds a modification to amino acid sequence

Parameters
aaModificationpointer on modification to add
positionposition in the amino acid sequence (starts at 0)

Definition at line 222 of file peptide.cpp.

223{
224 if(position >= size())
225 {
226 throw ExceptionOutOfRange(QObject::tr("position (%1) > size (%2)").arg(position).arg(size()));
227 }
228 m_proxyMass = -1;
229 qDebug() << "Peptide::addAaModification begin " << position;
230 std::vector<Aa>::iterator it = m_aaVec.begin() + position;
231 it->addAaModification(aaModification);
232 getMass();
233 qDebug() << "Peptide::addAaModification end";
234}
unsigned int size() const override
Definition peptide.cpp:217

References getMass(), m_aaVec, m_proxyMass, and size().

Referenced by pappso::PeptideStrParser::parseStringToPeptide(), PeptideProFormaParser, pappso::PeptideBuilder::setPeptide(), pappso::PeptideFixedModificationBuilder::setPeptideSp(), and pappso::PeptideVariableModificationBuilder::setPeptideSp().

◆ addAaModificationOnAllAminoAcid()

void pappso::Peptide::addAaModificationOnAllAminoAcid ( AaModificationP aaModification,
Enums::AminoAcidChar amino_acid )

adds a modification to all amino acid of the sequence

Parameters
aaModificationpointer on modification to add
Enums::AminoAcidCharamino_acid to apply the modification

Definition at line 237 of file peptide.cpp.

239{
240
241 for(auto &aa : *this)
242 {
243 if(aa.getAminoAcidChar() == amino_acid)
244 {
245 aa.addAaModification(aaModification);
246 }
247 }
248
249
250 m_proxyMass = -1;
251 getMass();
252}
@ aa
best possible : more than one direct MS2 fragmentation in same MSRUN
Definition types.h:45

References getMass(), and m_proxyMass.

Referenced by pappso::PeptideProFormaParser::parseStringToPeptide(), and PeptideProFormaParser.

◆ begin() [1/2]

std::vector< Aa >::iterator pappso::Peptide::begin ( )

Definition at line 173 of file peptide.cpp.

174{
175 return m_aaVec.begin();
176}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), and PeptideProFormaParser.

◆ begin() [2/2]

std::vector< Aa >::const_iterator pappso::Peptide::begin ( ) const

Definition at line 185 of file peptide.cpp.

186{
187 return m_aaVec.begin();
188}

References m_aaVec.

◆ countModificationOnAa()

unsigned int pappso::Peptide::countModificationOnAa ( AaModificationP mod,
const std::vector< char > & aa_list ) const

count modification occurence

Parameters
modmodification to look for
aa_listamino acid list targets (one letter code)
Returns
number of occurences

Definition at line 457 of file peptide.cpp.

458{
459 unsigned int number = 0;
460 std::vector<Aa>::const_iterator it(m_aaVec.begin());
461 while(it != m_aaVec.end())
462 {
463 if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) != aa_list.end())
464 {
465 number += it->getNumberOfModification(mod);
466 }
467 it++;
468 }
469 // qDebug() << "Aa::getMass() end " << mass;
470 return number;
471}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ end() [1/2]

std::vector< Aa >::iterator pappso::Peptide::end ( )

Definition at line 179 of file peptide.cpp.

180{
181 return m_aaVec.end();
182}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), and PeptideProFormaParser.

◆ end() [2/2]

std::vector< Aa >::const_iterator pappso::Peptide::end ( ) const

Definition at line 191 of file peptide.cpp.

192{
193 return m_aaVec.end();
194}

References m_aaVec.

◆ getAa()

Aa & pappso::Peptide::getAa ( unsigned int position)

Definition at line 720 of file peptide.cpp.

721{
722 if(position >= m_aaVec.size())
723 {
724 throw ExceptionOutOfRange(QObject::tr("no AA at position %1").arg(position));
725 }
726 return m_aaVec.at(position);
727}

References m_aaVec.

Referenced by PeptideProFormaParser, and pappso::PeptideVariableModificationReplacement::replaceModificationsAtPosition().

◆ getAaPositionList() [1/2]

std::vector< unsigned int > pappso::Peptide::getAaPositionList ( char aa) const

get positions of one amino acid in peptide

Parameters
aathe one letter code of the amino acid
Returns
vector containing positions (from 0 to size-1)

Definition at line 567 of file peptide.cpp.

568{
569 std::vector<unsigned int> position_list;
570 unsigned int number = 0;
571 std::vector<Aa>::const_iterator it(m_aaVec.begin());
572 while(it != m_aaVec.end())
573 {
574 if(it->getLetter() == aa)
575 position_list.push_back(number);
576 number++;
577 it++;
578 }
579 // qDebug() << "Aa::getMass() end " << mass;
580 return position_list;
581}

References m_aaVec.

Referenced by PeptideProFormaParser, and pappso::PeptideBuilder::setPeptide().

◆ getAaPositionList() [2/2]

std::vector< unsigned int > pappso::Peptide::getAaPositionList ( std::list< char > list_aa) const

Definition at line 584 of file peptide.cpp.

585{
586 std::vector<unsigned int> position_list;
587 unsigned int number = 0;
588 std::vector<Aa>::const_iterator it(m_aaVec.begin());
589 while(it != m_aaVec.end())
590 {
591
592 bool found = (std::find(list_aa.begin(), list_aa.end(), it->getLetter()) != list_aa.end());
593 if(found)
594 {
595 position_list.push_back(number);
596 }
597 number++;
598 it++;
599 }
600 // qDebug() << "Aa::getMass() end " << mass;
601 return position_list;
602}

References m_aaVec.

◆ getChemicalFormula()

const pappso::ChemicalFormula pappso::Peptide::getChemicalFormula ( ) const
overridevirtual

Reimplemented from pappso::AtomNumberInterface.

Definition at line 838 of file peptide.cpp.

839{
840 return getChemicalFormulaCharge(0);
841}
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override
Definition peptide.cpp:845

References getChemicalFormulaCharge().

Referenced by getMass(), and PeptideProFormaParser.

◆ getChemicalFormulaCharge()

const pappso::ChemicalFormula pappso::Peptide::getChemicalFormulaCharge ( unsigned int charge) const
overridevirtual

Reimplemented from pappso::PeptideInterface.

Definition at line 845 of file peptide.cpp.

846{
847 ChemicalFormula formula = PeptideInterface::getChemicalFormulaCharge(charge);
848
849 qDebug() << formula.toString();
850 if(m_fullC13)
851 {
852 formula.setFullIsotope(Enums::Isotope::C13);
853 qDebug() << formula.toString();
854 }
855 if(m_fullN15)
856 {
857 formula.setFullIsotope(Enums::Isotope::N15);
858 qDebug() << formula.toString();
859 }
860 if(m_fullH2)
861 {
862 formula.setFullIsotope(Enums::Isotope::H2);
863 qDebug() << formula.toString();
864 }
865 return formula;
866}
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const

References pappso::Enums::C13, pappso::PeptideInterface::getChemicalFormulaCharge(), pappso::Enums::H2, m_fullC13, m_fullH2, m_fullN15, pappso::Enums::N15, pappso::ChemicalFormula::setFullIsotope(), and pappso::ChemicalFormula::toString().

Referenced by getChemicalFormula(), and PeptideProFormaParser.

◆ getCleavageCterModification()

AaModificationP pappso::Peptide::getCleavageCterModification ( ) const

Definition at line 643 of file peptide.cpp.

644{
645 return m_cleavageCterMod;
646}

References m_cleavageCterMod.

Referenced by pappso::specglob::PeptideModel::PeptideModel(), operator==, and PeptideProFormaParser.

◆ getCleavageNterModification()

AaModificationP pappso::Peptide::getCleavageNterModification ( ) const

Definition at line 638 of file peptide.cpp.

639{
640 return m_cleavageNterMod;
641}

References m_cleavageNterMod.

Referenced by pappso::specglob::PeptideModel::PeptideModel(), operator==, and PeptideProFormaParser.

◆ getConstAa()

const Aa & pappso::Peptide::getConstAa ( unsigned int position) const

Definition at line 729 of file peptide.cpp.

730{
731 if(position >= m_aaVec.size())
732 {
733 throw ExceptionOutOfRange(QObject::tr("no AA at position %1").arg(position));
734 }
735 return m_aaVec.at(position);
736}

References m_aaVec.

Referenced by pappso::PeptideModificatorBase::getModificationPositionList(), and PeptideProFormaParser.

◆ getCterModification()

AaModificationP pappso::Peptide::getCterModification ( ) const

Definition at line 680 of file peptide.cpp.

681{
682 return m_CterMod;
683}

References m_CterMod.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), operator==, and PeptideProFormaParser.

◆ getLiAbsoluteString()

const QString pappso::Peptide::getLiAbsoluteString ( ) const

get all sequence string with modifications and converting Leucine to Isoleucine

Definition at line 298 of file peptide.cpp.

299{
300 QString seq = "";
301 std::vector<Aa>::const_iterator it(m_aaVec.begin());
302 while(it != m_aaVec.end())
303 {
304 seq += it->toAbsoluteString();
305 it++;
306 }
307 return seq.replace("L", "I");
308}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ getMass() [1/2]

pappso_double pappso::Peptide::getMass ( )

Definition at line 375 of file peptide.cpp.

376{
377 qDebug() << "begin";
378 if(m_proxyMass < 0)
379 {
381 {
382 ChemicalFormula formula = getChemicalFormula();
383 m_proxyMass = formula.getMass();
384 }
385 else
386 {
387 m_proxyMass = m_cleavageNterMod->getMass() + m_cleavageCterMod->getMass();
388 if(m_NterMod != nullptr)
389 m_proxyMass += m_NterMod->getMass();
390 if(m_CterMod != nullptr)
391 m_proxyMass += m_CterMod->getMass();
392 for(auto aa : m_aaVec)
393 {
394 m_proxyMass += aa.getMass();
395 }
396 }
397 }
398 qDebug() << "end " << m_proxyMass;
399 return m_proxyMass;
400}
virtual const ChemicalFormula getChemicalFormula() const override
Definition peptide.cpp:838

References getChemicalFormula(), pappso::ChemicalFormula::getMass(), m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, m_fullC13, m_fullH2, m_fullN15, m_NterMod, and m_proxyMass.

Referenced by Peptide(), addAaModification(), addAaModificationOnAllAminoAcid(), pappso::Protein::getMass(), pappso::PeptideProFormaParser::parseStringToPeptide(), PeptideProFormaParser, removeAaModification(), removeCterAminoAcid(), removeNterAminoAcid(), replaceAaModification(), replaceAaModificationOnAminoAcid(), setCleavageCterModification(), setCleavageNterModification(), setCterModification(), setNterModification(), and pappso::PsmFeatures::setPeptideSpectrumCharge().

◆ getMass() [2/2]

pappso_double pappso::Peptide::getMass ( ) const
overridevirtual

Implements pappso::Ion.

Definition at line 210 of file peptide.cpp.

211{
212 return m_proxyMass;
213}

References m_proxyMass.

◆ getMassIonSerie()

std::vector< double > pappso::Peptide::getMassIonSerie ( unsigned int charge,
pappso::Enums::PeptideIon ion_type ) const

get complete serie of product masses for a given charge and ion type

Definition at line 336 of file peptide.cpp.

337{
338 std::vector<double> mz_arr;
339 double mass_accumulator = 0;
340 double mass_shift = 0;
341 if(ion_type == pappso::Enums::PeptideIon::b)
342 {
343 for(const Aa &aa : m_aaVec)
344 {
345 mass_accumulator += aa.getMass();
346 mz_arr.push_back(mass_accumulator);
347 }
348 }
349 else if(ion_type == pappso::Enums::PeptideIon::y)
350 {
351 std::vector<Aa>::const_reverse_iterator it(m_aaVec.rbegin());
352 while(it != m_aaVec.rend())
353 {
354 mass_accumulator += it->getMass();
355 mz_arr.push_back(mass_accumulator);
356 it++;
357 }
358 mass_shift = MASSH2O;
359 }
360 else
361 {
362 throw pappso::ExceptionNotImplemented(
363 QObject::tr("Peptide::getMassIonSerie not implemented for ion type %1")
364 .arg(Utils::toString(ion_type)));
365 }
366 for(double &mass : mz_arr)
367 {
368 mass = (mass + mass_shift + (MHPLUS * (double)charge)) / (double)charge;
369 }
370
371 return mz_arr;
372}
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:544
@ y
Cter amino ions.
Definition types.h:295
@ b
Nter acylium ions.
Definition types.h:287
const pappso_double MHPLUS(1.007276466879)
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)

References pappso::Enums::b, m_aaVec, pappso::MASSH2O(), pappso::MHPLUS(), pappso::Utils::toString(), and pappso::Enums::y.

Referenced by PeptideProFormaParser.

◆ getModificationPositionList() [1/2]

std::vector< unsigned int > pappso::Peptide::getModificationPositionList ( AaModificationP mod) const

get modification positions

Parameters
modmodification to look for
Returns
vector containing positions (from 0 to size-1)

Definition at line 522 of file peptide.cpp.

523{
524 std::vector<unsigned int> position_list;
525 unsigned int position = 0;
526 std::vector<Aa>::const_iterator it(m_aaVec.begin());
527 while(it != m_aaVec.end())
528 {
529 unsigned int number = 0;
530 number += it->getNumberOfModification(mod);
531 for(unsigned int j = 0; j < number; j++)
532 {
533 position_list.push_back(position);
534 }
535 it++;
536 position++;
537 }
538 // qDebug() << "Aa::getMass() end " << mass;
539 return position_list;
540}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ getModificationPositionList() [2/2]

std::vector< unsigned int > pappso::Peptide::getModificationPositionList ( AaModificationP mod,
const std::vector< char > & aa_list ) const

get modification positions

Parameters
modmodification to look for
aa_listamino acid list targets (one letter code)
Returns
vector containing positions (from 0 to size-1)

Definition at line 543 of file peptide.cpp.

544{
545 std::vector<unsigned int> position_list;
546 unsigned int position = 0;
547 std::vector<Aa>::const_iterator it(m_aaVec.begin());
548 while(it != m_aaVec.end())
549 {
550 if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) != aa_list.end())
551 {
552 unsigned int number = 0;
553 number += it->getNumberOfModification(mod);
554 for(unsigned int j = 0; j < number; j++)
555 {
556 position_list.push_back(position);
557 }
558 }
559 it++;
560 position++;
561 }
562 // qDebug() << "Aa::getMass() end " << mass;
563 return position_list;
564}

References m_aaVec.

◆ getNterModification()

AaModificationP pappso::Peptide::getNterModification ( ) const

Definition at line 686 of file peptide.cpp.

687{
688 return m_NterMod;
689}

References m_NterMod.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), operator==, and PeptideProFormaParser.

◆ getNumberOfAtom()

int pappso::Peptide::getNumberOfAtom ( Enums::AtomIsotopeSurvey atom) const
overridevirtual

get the number of atom C, O, N, H in the molecule

Implements pappso::AtomNumberInterface.

Definition at line 403 of file peptide.cpp.

404{
405 int number = m_cleavageNterMod->getNumberOfAtom(atom);
406 number += m_cleavageCterMod->getNumberOfAtom(atom);
407
408 if(m_NterMod != nullptr)
409 number += m_NterMod->getNumberOfAtom(atom);
410 if(m_CterMod != nullptr)
411 number += m_CterMod->getNumberOfAtom(atom);
412 std::vector<Aa>::const_iterator it(m_aaVec.begin());
413 while(it != m_aaVec.end())
414 {
415 number += it->getNumberOfAtom(atom);
416 it++;
417 }
418 // qDebug() << "Aa::getMass() end " << mass;
419 return number;
420}

References m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, and m_NterMod.

Referenced by PeptideProFormaParser.

◆ getNumberOfIsotope()

int pappso::Peptide::getNumberOfIsotope ( Enums::Isotope isotope) const
overridevirtual

get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule

Implements pappso::AtomNumberInterface.

Definition at line 423 of file peptide.cpp.

424{
425 int number = m_cleavageNterMod->getNumberOfIsotope(isotope);
426 number += m_cleavageCterMod->getNumberOfIsotope(isotope);
427 if(m_NterMod != nullptr)
428 number += m_NterMod->getNumberOfIsotope(isotope);
429 if(m_CterMod != nullptr)
430 number += m_CterMod->getNumberOfIsotope(isotope);
431 std::vector<Aa>::const_iterator it(m_aaVec.begin());
432 while(it != m_aaVec.end())
433 {
434 number += it->getNumberOfIsotope(isotope);
435 it++;
436 }
437 // qDebug() << "Aa::getMass() end " << mass;
438 return number;
439}

References m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, and m_NterMod.

Referenced by PeptideProFormaParser.

◆ getNumberOfModification()

unsigned int pappso::Peptide::getNumberOfModification ( AaModificationP mod) const

count modification occurence

Parameters
modmodification to look for
Returns
number of occurences

Definition at line 443 of file peptide.cpp.

444{
445 unsigned int number = 0;
446 std::vector<Aa>::const_iterator it(m_aaVec.begin());
447 while(it != m_aaVec.end())
448 {
449 number += it->getNumberOfModification(mod);
450 it++;
451 }
452 // qDebug() << "Aa::getMass() end " << mass;
453 return number;
454}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ getRawMassArray()

std::vector< double > pappso::Peptide::getRawMassArray ( ) const

get raw mass array of the amino acid sequence

Definition at line 325 of file peptide.cpp.

326{
327 std::vector<double> raw_mass_arr;
328 for(const Aa &aa : m_aaVec)
329 {
330 raw_mass_arr.push_back(aa.getMass());
331 }
332 return raw_mass_arr;
333}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ getSequence()

const QString pappso::Peptide::getSequence ( ) const
overridevirtual

print amino acid sequence without modifications

Implements pappso::PeptideInterface.

Definition at line 255 of file peptide.cpp.

256{
257 QString seq = "";
258 std::vector<Aa>::const_iterator it(m_aaVec.begin());
259 while(it != m_aaVec.end())
260 {
261 seq += it->getLetter();
262 it++;
263 }
264 return seq;
265}

References m_aaVec.

Referenced by pappso::XtandemHyperscoreBis::computeXtandemHyperscore(), pappso::PeptideModificatorBase::getModificationPositionList(), PeptideProFormaParser, and pappso::PeptideFixedModificationBuilder::setPeptideSp().

◆ isPalindrome()

bool pappso::Peptide::isPalindrome ( ) const
overridevirtual

tells if the peptide sequence is a palindrome

Implements pappso::PeptideInterface.

Definition at line 705 of file peptide.cpp.

706{
707 std::size_t size = m_aaVec.size();
708 std::size_t k = (size - 1);
709 for(std::size_t i = 0; i < (size / 2); i++, k--)
710 {
711 if(m_aaVec[i].getLetter() != m_aaVec[k].getLetter())
712 {
713 return false;
714 }
715 }
716 return true;
717}

References m_aaVec, and size().

Referenced by PeptideProFormaParser.

◆ makeNoConstPeptideSp()

NoConstPeptideSp pappso::Peptide::makeNoConstPeptideSp ( ) const

Definition at line 166 of file peptide.cpp.

167{
168 return std::make_shared<Peptide>(*this);
169}

Referenced by pappso::PeptideProFormaParser::parseNoConstString(), pappso::PeptideStrParser::parseNoConstString(), and PeptideProFormaParser.

◆ makePeptideSp()

◆ rbegin()

std::vector< Aa >::const_reverse_iterator pappso::Peptide::rbegin ( ) const

Definition at line 197 of file peptide.cpp.

198{
199 return m_aaVec.rbegin();
200}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), and PeptideProFormaParser.

◆ removeAaModification()

void pappso::Peptide::removeAaModification ( AaModificationP mod)

removes all occurences of a modification

Parameters
modmodification to remove

Definition at line 508 of file peptide.cpp.

509{
510 std::vector<Aa>::iterator it(m_aaVec.begin());
511 while(it != m_aaVec.end())
512 {
513 it->removeAaModification(mod);
514 qDebug() << it->toString() << " " << toAbsoluteString();
515 it++;
516 }
517 m_proxyMass = -1;
518 getMass();
519 // qDebug() << "Aa::getMass() end " << mass;
520}
const QString toAbsoluteString() const
print all modifications
Definition peptide.cpp:267

References getMass(), m_aaVec, m_proxyMass, and toAbsoluteString().

Referenced by PeptideProFormaParser.

◆ removeCterAminoAcid()

void pappso::Peptide::removeCterAminoAcid ( )

Definition at line 770 of file peptide.cpp.

771{
772 std::vector<Aa>::iterator it(m_aaVec.end());
773 it--;
774 if(it != m_aaVec.end())
775 {
776 m_aaVec.erase(it);
777 m_proxyMass = -1;
778 getMass();
779 }
780 else
781 {
782 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
783 }
784}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ removeNterAminoAcid()

void pappso::Peptide::removeNterAminoAcid ( )

Definition at line 753 of file peptide.cpp.

754{
755 std::vector<Aa>::iterator it(m_aaVec.begin());
756 if(it != m_aaVec.end())
757 {
758 m_aaVec.erase(it);
759 m_proxyMass = -1;
760 getMass();
761 }
762 else
763 {
764 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
765 }
766}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ rend()

std::vector< Aa >::const_reverse_iterator pappso::Peptide::rend ( ) const

Definition at line 203 of file peptide.cpp.

204{
205 return m_aaVec.rend();
206}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), and PeptideProFormaParser.

◆ replaceAaModification()

void pappso::Peptide::replaceAaModification ( AaModificationP oldmod,
AaModificationP newmod )

replaces all occurences of a modification by a new one

Parameters
oldmodmodification to change
newmodnew modification

Definition at line 474 of file peptide.cpp.

475{
476 if(oldmod == newmod)
477 return;
478 std::vector<Aa>::iterator it(m_aaVec.begin());
479 while(it != m_aaVec.end())
480 {
481 it->replaceAaModification(oldmod, newmod);
482 it++;
483 }
484 m_proxyMass = -1;
485 getMass();
486}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ replaceAaModificationOnAminoAcid()

void pappso::Peptide::replaceAaModificationOnAminoAcid ( Enums::AminoAcidChar aa,
pappso::AaModificationP oldmod,
pappso::AaModificationP newmod )

replaces all occurences of a modification by a new one on a specific amino acid

Parameters
aathe amino acid to modify
oldmodmodification to change
newmodnew modification

Definition at line 489 of file peptide.cpp.

492{
493 if(oldmod == newmod)
494 return;
495 std::vector<Aa>::iterator it(m_aaVec.begin());
496 while(it != m_aaVec.end())
497 {
498 if(it->getAminoAcidChar() == aa)
499 {
500 it->replaceAaModification(oldmod, newmod);
501 }
502 it++;
503 }
504 m_proxyMass = -1;
505 getMass();
506}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ replaceLeucineIsoleucine()

void pappso::Peptide::replaceLeucineIsoleucine ( )

Definition at line 740 of file peptide.cpp.

741{
742
743 std::vector<Aa>::iterator it(m_aaVec.begin());
744 std::vector<Aa>::iterator itend(m_aaVec.end());
745 for(; it != itend; it++)
746 {
747 it->replaceLeucineIsoleucine();
748 }
749}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ reverse()

void pappso::Peptide::reverse ( )

Definition at line 698 of file peptide.cpp.

699{
700 std::reverse(m_aaVec.begin(), m_aaVec.end());
701}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ rotate()

void pappso::Peptide::rotate ( )

Definition at line 692 of file peptide.cpp.

693{
694 std::rotate(m_aaVec.begin(), m_aaVec.begin() + 1, m_aaVec.end());
695}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ setCleavageCterModification()

void pappso::Peptide::setCleavageCterModification ( AaModificationP mod)

Definition at line 621 of file peptide.cpp.

622{
623 if(mod->getAccession().startsWith("internal:Cter_"))
624 {
625 m_proxyMass = -1;
626 m_cleavageNterMod = mod;
627 getMass();
628 }
629 else
630 {
631 throw ExceptionNotPossible(
632 QObject::tr("modification is not a cleavage Cter modification : %1")
633 .arg(mod->getAccession()));
634 }
635}

References pappso::AaModification::getAccession(), getMass(), m_cleavageNterMod, and m_proxyMass.

Referenced by pappso::PeptideStrParser::parseStringToPeptide(), and PeptideProFormaParser.

◆ setCleavageNterModification()

void pappso::Peptide::setCleavageNterModification ( AaModificationP mod)

Definition at line 605 of file peptide.cpp.

606{
607 if(mod->getAccession().startsWith("internal:Nter_"))
608 {
609 m_proxyMass = -1;
610 m_cleavageNterMod = mod;
611 getMass();
612 }
613 else
614 {
615 throw ExceptionNotPossible(
616 QObject::tr("modification is not a cleavage Nter modification : %1")
617 .arg(mod->getAccession()));
618 }
619}

References pappso::AaModification::getAccession(), getMass(), m_cleavageNterMod, and m_proxyMass.

Referenced by pappso::PeptideStrParser::parseStringToPeptide(), and PeptideProFormaParser.

◆ setCterModification()

void pappso::Peptide::setCterModification ( AaModificationP mod)

Definition at line 664 of file peptide.cpp.

665{
666 if(mod != nullptr)
667 {
668 m_proxyMass = -1;
669 m_CterMod = mod;
670 getMass();
671 }
672 else
673 {
674 throw ExceptionNotPossible(
675 QObject::tr("modification is not a peptide Cter modification : mod == nulptr"));
676 }
677}

References getMass(), m_CterMod, and m_proxyMass.

Referenced by pappso::PeptideProFormaParser::parseStringToPeptide(), and PeptideProFormaParser.

◆ setGlobalModification()

void pappso::Peptide::setGlobalModification ( Enums::Isotope isotope_kind)

apply 100% isotope replacement

Todo

Definition at line 826 of file peptide.cpp.

827{
828 if(isotope_kind == Enums::Isotope::C13)
829 m_fullC13 = true;
830 else if(isotope_kind == Enums::Isotope::N15)
831 m_fullN15 = true;
832 else if(isotope_kind == Enums::Isotope::H2)
833 m_fullH2 = true;
834}

References pappso::Enums::C13, pappso::Enums::H2, m_fullC13, m_fullH2, m_fullN15, and pappso::Enums::N15.

Referenced by pappso::PeptideProFormaParser::parseStringToPeptide(), and PeptideProFormaParser.

◆ setNterModification()

void pappso::Peptide::setNterModification ( AaModificationP mod)

Definition at line 649 of file peptide.cpp.

650{
651 if(mod != nullptr)
652 {
653 m_proxyMass = -1;
654 m_NterMod = mod;
655 getMass();
656 }
657 else
658 {
659 throw ExceptionNotPossible(
660 QObject::tr("modification is not a peptide Nter modification : mod == nulptr"));
661 }
662}

References getMass(), m_NterMod, and m_proxyMass.

Referenced by pappso::PeptideProFormaParser::parseStringToPeptide(), and PeptideProFormaParser.

◆ size()

unsigned int pappso::Peptide::size ( ) const
overridevirtual

◆ toAbsoluteString()

const QString pappso::Peptide::toAbsoluteString ( ) const

print all modifications

Definition at line 267 of file peptide.cpp.

268{
269 QString seq = "";
270 std::vector<Aa>::const_iterator it(m_aaVec.begin());
271
272 QStringList modification_str_list;
273 modification_str_list << m_cleavageNterMod->getAccession();
274 if(m_NterMod != nullptr)
275 modification_str_list << m_NterMod->getAccession();
276 while(it != m_aaVec.end())
277 {
278 seq += it->getLetter();
279 if(it == m_aaVec.end() - 1)
280 {
281 modification_str_list << m_cleavageCterMod->getAccession();
282 if(m_CterMod != nullptr)
283 modification_str_list << m_CterMod->getAccession();
284 }
285 for(auto &pmod : it->getModificationList())
286 {
287 modification_str_list << pmod->getAccession();
288 }
289 if(modification_str_list.size() > 0)
290 seq += QString("(%1)").arg(modification_str_list.join(","));
291 modification_str_list.clear();
292 it++;
293 }
294 return seq;
295}

References m_aaVec, m_cleavageCterMod, m_cleavageNterMod, m_CterMod, and m_NterMod.

Referenced by PeptideProFormaParser, and removeAaModification().

◆ toProForma()

QString pappso::Peptide::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 787 of file peptide.cpp.

788{
789
790 QString seq = "";
791 if(m_fullC13)
792 {
793 seq += "<13C>";
794 }
795 if(m_fullN15)
796 {
797 seq += "<15N>";
798 }
799 if(m_fullH2)
800 {
801 seq += "<D>";
802 }
803
804 if(m_NterMod != nullptr)
805 {
806 QString nter_accession = m_NterMod->getAccession();
807 seq = QString("[%1]-").arg(nter_accession);
808 }
809 std::vector<Aa>::const_iterator it(m_aaVec.begin());
810 while(it != m_aaVec.end())
811 {
812 seq += it->toProForma();
813 it++;
814 }
815
816 if(m_CterMod != nullptr)
817 {
818 QString cter_accession = m_CterMod->getAccession();
819 seq += QString("-[%1]").arg(cter_accession);
820 }
821 return seq;
822}

References m_aaVec, m_CterMod, m_fullC13, m_fullH2, m_fullN15, and m_NterMod.

Referenced by PeptideProFormaParser.

◆ toString()

const QString pappso::Peptide::toString ( ) const

print modification except internal modifications

Definition at line 312 of file peptide.cpp.

313{
314 QString seq = "";
315 std::vector<Aa>::const_iterator it(m_aaVec.begin());
316 while(it != m_aaVec.end())
317 {
318 seq += it->toString();
319 it++;
320 }
321 return seq;
322}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ operator<

bool operator< ( const Peptide & l,
const Peptide & r )
friend

Definition at line 46 of file peptide.cpp.

48{
49 return (l.m_aaVec < r.m_aaVec);
50}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ operator==

bool operator== ( const Peptide & l,
const Peptide & r )
friend

Definition at line 53 of file peptide.cpp.

54{
55 if(l.getCleavageNterModification() != r.getCleavageNterModification())
56 return false;
57 if(l.getCleavageCterModification() != r.getCleavageCterModification())
58 return false;
59 if(l.getNterModification() && r.getNterModification() &&
60 (l.getNterModification() != r.getNterModification()))
61 return false;
62 if(l.getCterModification() && r.getCterModification() &&
63 (l.getCterModification() != r.getCterModification()))
64 return false;
65
66 return (l.m_aaVec == r.m_aaVec);
67}

References getCleavageCterModification(), getCleavageNterModification(), getCterModification(), getNterModification(), and m_aaVec.

Referenced by PeptideProFormaParser.

◆ PeptideProFormaParser

Member Data Documentation

◆ m_aaVec

◆ m_cleavageCterMod

AaModificationP pappso::Peptide::m_cleavageCterMod = nullptr
protected

◆ m_cleavageNterMod

◆ m_CterMod

AaModificationP pappso::Peptide::m_CterMod = nullptr
protected

◆ m_fullC13

bool pappso::Peptide::m_fullC13 = false
protected

◆ m_fullH2

bool pappso::Peptide::m_fullH2 = false
protected

◆ m_fullN15

bool pappso::Peptide::m_fullN15 = false
protected

◆ m_NterMod

AaModificationP pappso::Peptide::m_NterMod = nullptr
protected

◆ m_proxyMass


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