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
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 99 of file peptide.h.

Constructor & Destructor Documentation

◆ Peptide() [1/3]

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

Definition at line 104 of file peptide.cpp.

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

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 124 of file peptide.cpp.

125{
126}

◆ Peptide() [2/3]

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

Definition at line 128 of file peptide.cpp.

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

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 143 of file peptide.cpp.

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

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 220 of file peptide.cpp.

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

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 235 of file peptide.cpp.

237{
238
239 for(auto &aa : *this)
240 {
241 if(aa.getAminoAcidChar() == amino_acid)
242 {
243 aa.addAaModification(aaModification);
244 }
245 }
246
247
248 m_proxyMass = -1;
249 getMass();
250}
@ 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 171 of file peptide.cpp.

172{
173 return m_aaVec.begin();
174}

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 183 of file peptide.cpp.

184{
185 return m_aaVec.begin();
186}

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 405 of file peptide.cpp.

406{
407 unsigned int number = 0;
408 std::vector<Aa>::const_iterator it(m_aaVec.begin());
409 while(it != m_aaVec.end())
410 {
411 if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) != aa_list.end())
412 {
413 number += it->getNumberOfModification(mod);
414 }
415 it++;
416 }
417 // qDebug() << "Aa::getMass() end " << mass;
418 return number;
419}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ end() [1/2]

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

Definition at line 177 of file peptide.cpp.

178{
179 return m_aaVec.end();
180}

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 189 of file peptide.cpp.

190{
191 return m_aaVec.end();
192}

References m_aaVec.

◆ getAa()

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

Definition at line 668 of file peptide.cpp.

669{
670 if(position >= m_aaVec.size())
671 {
672 throw ExceptionOutOfRange(QObject::tr("no AA at position %1").arg(position));
673 }
674 return m_aaVec.at(position);
675}

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 515 of file peptide.cpp.

516{
517 std::vector<unsigned int> position_list;
518 unsigned int number = 0;
519 std::vector<Aa>::const_iterator it(m_aaVec.begin());
520 while(it != m_aaVec.end())
521 {
522 if(it->getLetter() == aa)
523 position_list.push_back(number);
524 number++;
525 it++;
526 }
527 // qDebug() << "Aa::getMass() end " << mass;
528 return position_list;
529}

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 532 of file peptide.cpp.

533{
534 std::vector<unsigned int> position_list;
535 unsigned int number = 0;
536 std::vector<Aa>::const_iterator it(m_aaVec.begin());
537 while(it != m_aaVec.end())
538 {
539
540 bool found = (std::find(list_aa.begin(), list_aa.end(), it->getLetter()) != list_aa.end());
541 if(found)
542 {
543 position_list.push_back(number);
544 }
545 number++;
546 it++;
547 }
548 // qDebug() << "Aa::getMass() end " << mass;
549 return position_list;
550}

References m_aaVec.

◆ getChemicalFormula()

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

Reimplemented from pappso::AtomNumberInterface.

Definition at line 786 of file peptide.cpp.

787{
788 return getChemicalFormulaCharge(0);
789}
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override
Definition peptide.cpp:793

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 793 of file peptide.cpp.

794{
795 ChemicalFormula formula = PeptideInterface::getChemicalFormulaCharge(charge);
796
797 qDebug() << formula.toString();
798 if(m_fullC13)
799 {
800 formula.setFullIsotope(Enums::Isotope::C13);
801 qDebug() << formula.toString();
802 }
803 if(m_fullN15)
804 {
805 formula.setFullIsotope(Enums::Isotope::N15);
806 qDebug() << formula.toString();
807 }
808 if(m_fullH2)
809 {
810 formula.setFullIsotope(Enums::Isotope::H2);
811 qDebug() << formula.toString();
812 }
813 return formula;
814}
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 591 of file peptide.cpp.

592{
593 return m_cleavageCterMod;
594}

References m_cleavageCterMod.

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

◆ getCleavageNterModification()

AaModificationP pappso::Peptide::getCleavageNterModification ( ) const

Definition at line 586 of file peptide.cpp.

587{
588 return m_cleavageNterMod;
589}

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 677 of file peptide.cpp.

678{
679 if(position >= m_aaVec.size())
680 {
681 throw ExceptionOutOfRange(QObject::tr("no AA at position %1").arg(position));
682 }
683 return m_aaVec.at(position);
684}

References m_aaVec.

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

◆ getCterModification()

AaModificationP pappso::Peptide::getCterModification ( ) const

Definition at line 628 of file peptide.cpp.

629{
630 return m_CterMod;
631}

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 296 of file peptide.cpp.

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

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ getMass() [1/2]

pappso_double pappso::Peptide::getMass ( )

Definition at line 323 of file peptide.cpp.

324{
325 qDebug() << "begin";
326 if(m_proxyMass < 0)
327 {
329 {
330 ChemicalFormula formula = getChemicalFormula();
331 m_proxyMass = formula.getMass();
332 }
333 else
334 {
335 m_proxyMass = m_cleavageNterMod->getMass() + m_cleavageCterMod->getMass();
336 if(m_NterMod != nullptr)
337 m_proxyMass += m_NterMod->getMass();
338 if(m_CterMod != nullptr)
339 m_proxyMass += m_CterMod->getMass();
340 for(auto aa : m_aaVec)
341 {
342 m_proxyMass += aa.getMass();
343 }
344 }
345 }
346 qDebug() << "end " << m_proxyMass;
347 return m_proxyMass;
348}
virtual const ChemicalFormula getChemicalFormula() const override
Definition peptide.cpp:786

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 208 of file peptide.cpp.

209{
210 return m_proxyMass;
211}

References m_proxyMass.

◆ 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 470 of file peptide.cpp.

471{
472 std::vector<unsigned int> position_list;
473 unsigned int position = 0;
474 std::vector<Aa>::const_iterator it(m_aaVec.begin());
475 while(it != m_aaVec.end())
476 {
477 unsigned int number = 0;
478 number += it->getNumberOfModification(mod);
479 for(unsigned int j = 0; j < number; j++)
480 {
481 position_list.push_back(position);
482 }
483 it++;
484 position++;
485 }
486 // qDebug() << "Aa::getMass() end " << mass;
487 return position_list;
488}

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 491 of file peptide.cpp.

492{
493 std::vector<unsigned int> position_list;
494 unsigned int position = 0;
495 std::vector<Aa>::const_iterator it(m_aaVec.begin());
496 while(it != m_aaVec.end())
497 {
498 if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) != aa_list.end())
499 {
500 unsigned int number = 0;
501 number += it->getNumberOfModification(mod);
502 for(unsigned int j = 0; j < number; j++)
503 {
504 position_list.push_back(position);
505 }
506 }
507 it++;
508 position++;
509 }
510 // qDebug() << "Aa::getMass() end " << mass;
511 return position_list;
512}

References m_aaVec.

◆ getNterModification()

AaModificationP pappso::Peptide::getNterModification ( ) const

Definition at line 634 of file peptide.cpp.

635{
636 return m_NterMod;
637}

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 351 of file peptide.cpp.

352{
353 int number = m_cleavageNterMod->getNumberOfAtom(atom);
354 number += m_cleavageCterMod->getNumberOfAtom(atom);
355
356 if(m_NterMod != nullptr)
357 number += m_NterMod->getNumberOfAtom(atom);
358 if(m_CterMod != nullptr)
359 number += m_CterMod->getNumberOfAtom(atom);
360 std::vector<Aa>::const_iterator it(m_aaVec.begin());
361 while(it != m_aaVec.end())
362 {
363 number += it->getNumberOfAtom(atom);
364 it++;
365 }
366 // qDebug() << "Aa::getMass() end " << mass;
367 return number;
368}

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 371 of file peptide.cpp.

372{
373 int number = m_cleavageNterMod->getNumberOfIsotope(isotope);
374 number += m_cleavageCterMod->getNumberOfIsotope(isotope);
375 if(m_NterMod != nullptr)
376 number += m_NterMod->getNumberOfIsotope(isotope);
377 if(m_CterMod != nullptr)
378 number += m_CterMod->getNumberOfIsotope(isotope);
379 std::vector<Aa>::const_iterator it(m_aaVec.begin());
380 while(it != m_aaVec.end())
381 {
382 number += it->getNumberOfIsotope(isotope);
383 it++;
384 }
385 // qDebug() << "Aa::getMass() end " << mass;
386 return number;
387}

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 391 of file peptide.cpp.

392{
393 unsigned int number = 0;
394 std::vector<Aa>::const_iterator it(m_aaVec.begin());
395 while(it != m_aaVec.end())
396 {
397 number += it->getNumberOfModification(mod);
398 it++;
399 }
400 // qDebug() << "Aa::getMass() end " << mass;
401 return number;
402}

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 253 of file peptide.cpp.

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

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 653 of file peptide.cpp.

654{
655 std::size_t size = m_aaVec.size();
656 std::size_t k = (size - 1);
657 for(std::size_t i = 0; i < (size / 2); i++, k--)
658 {
659 if(m_aaVec[i].getLetter() != m_aaVec[k].getLetter())
660 {
661 return false;
662 }
663 }
664 return true;
665}

References m_aaVec, and size().

Referenced by PeptideProFormaParser.

◆ makeNoConstPeptideSp()

NoConstPeptideSp pappso::Peptide::makeNoConstPeptideSp ( ) const

Definition at line 164 of file peptide.cpp.

165{
166 return std::make_shared<Peptide>(*this);
167}

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 195 of file peptide.cpp.

196{
197 return m_aaVec.rbegin();
198}

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 456 of file peptide.cpp.

457{
458 std::vector<Aa>::iterator it(m_aaVec.begin());
459 while(it != m_aaVec.end())
460 {
461 it->removeAaModification(mod);
462 qDebug() << it->toString() << " " << toAbsoluteString();
463 it++;
464 }
465 m_proxyMass = -1;
466 getMass();
467 // qDebug() << "Aa::getMass() end " << mass;
468}
const QString toAbsoluteString() const
print all modifications
Definition peptide.cpp:265

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

Referenced by PeptideProFormaParser.

◆ removeCterAminoAcid()

void pappso::Peptide::removeCterAminoAcid ( )

Definition at line 718 of file peptide.cpp.

719{
720 std::vector<Aa>::iterator it(m_aaVec.end());
721 it--;
722 if(it != m_aaVec.end())
723 {
724 m_aaVec.erase(it);
725 m_proxyMass = -1;
726 getMass();
727 }
728 else
729 {
730 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
731 }
732}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ removeNterAminoAcid()

void pappso::Peptide::removeNterAminoAcid ( )

Definition at line 701 of file peptide.cpp.

702{
703 std::vector<Aa>::iterator it(m_aaVec.begin());
704 if(it != m_aaVec.end())
705 {
706 m_aaVec.erase(it);
707 m_proxyMass = -1;
708 getMass();
709 }
710 else
711 {
712 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
713 }
714}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ rend()

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

Definition at line 201 of file peptide.cpp.

202{
203 return m_aaVec.rend();
204}

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 422 of file peptide.cpp.

423{
424 if(oldmod == newmod)
425 return;
426 std::vector<Aa>::iterator it(m_aaVec.begin());
427 while(it != m_aaVec.end())
428 {
429 it->replaceAaModification(oldmod, newmod);
430 it++;
431 }
432 m_proxyMass = -1;
433 getMass();
434}

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 437 of file peptide.cpp.

440{
441 if(oldmod == newmod)
442 return;
443 std::vector<Aa>::iterator it(m_aaVec.begin());
444 while(it != m_aaVec.end())
445 {
446 if(it->getAminoAcidChar() == aa)
447 {
448 it->replaceAaModification(oldmod, newmod);
449 }
450 it++;
451 }
452 m_proxyMass = -1;
453 getMass();
454}

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ replaceLeucineIsoleucine()

void pappso::Peptide::replaceLeucineIsoleucine ( )

Definition at line 688 of file peptide.cpp.

689{
690
691 std::vector<Aa>::iterator it(m_aaVec.begin());
692 std::vector<Aa>::iterator itend(m_aaVec.end());
693 for(; it != itend; it++)
694 {
695 it->replaceLeucineIsoleucine();
696 }
697}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ reverse()

void pappso::Peptide::reverse ( )

Definition at line 646 of file peptide.cpp.

647{
648 std::reverse(m_aaVec.begin(), m_aaVec.end());
649}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ rotate()

void pappso::Peptide::rotate ( )

Definition at line 640 of file peptide.cpp.

641{
642 std::rotate(m_aaVec.begin(), m_aaVec.begin() + 1, m_aaVec.end());
643}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ setCleavageCterModification()

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

Definition at line 569 of file peptide.cpp.

570{
571 if(mod->getAccession().startsWith("internal:Cter_"))
572 {
573 m_proxyMass = -1;
574 m_cleavageNterMod = mod;
575 getMass();
576 }
577 else
578 {
579 throw ExceptionNotPossible(
580 QObject::tr("modification is not a cleavage Cter modification : %1")
581 .arg(mod->getAccession()));
582 }
583}

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 553 of file peptide.cpp.

554{
555 if(mod->getAccession().startsWith("internal:Nter_"))
556 {
557 m_proxyMass = -1;
558 m_cleavageNterMod = mod;
559 getMass();
560 }
561 else
562 {
563 throw ExceptionNotPossible(
564 QObject::tr("modification is not a cleavage Nter modification : %1")
565 .arg(mod->getAccession()));
566 }
567}

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 612 of file peptide.cpp.

613{
614 if(mod != nullptr)
615 {
616 m_proxyMass = -1;
617 m_CterMod = mod;
618 getMass();
619 }
620 else
621 {
622 throw ExceptionNotPossible(
623 QObject::tr("modification is not a peptide Cter modification : mod == nulptr"));
624 }
625}

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 774 of file peptide.cpp.

775{
776 if(isotope_kind == Enums::Isotope::C13)
777 m_fullC13 = true;
778 else if(isotope_kind == Enums::Isotope::N15)
779 m_fullN15 = true;
780 else if(isotope_kind == Enums::Isotope::H2)
781 m_fullH2 = true;
782}

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 597 of file peptide.cpp.

598{
599 if(mod != nullptr)
600 {
601 m_proxyMass = -1;
602 m_NterMod = mod;
603 getMass();
604 }
605 else
606 {
607 throw ExceptionNotPossible(
608 QObject::tr("modification is not a peptide Nter modification : mod == nulptr"));
609 }
610}

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 265 of file peptide.cpp.

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

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 735 of file peptide.cpp.

736{
737
738 QString seq = "";
739 if(m_fullC13)
740 {
741 seq += "<13C>";
742 }
743 if(m_fullN15)
744 {
745 seq += "<15N>";
746 }
747 if(m_fullH2)
748 {
749 seq += "<D>";
750 }
751
752 if(m_NterMod != nullptr)
753 {
754 QString nter_accession = m_NterMod->getAccession();
755 seq = QString("[%1]-").arg(nter_accession);
756 }
757 std::vector<Aa>::const_iterator it(m_aaVec.begin());
758 while(it != m_aaVec.end())
759 {
760 seq += it->toProForma();
761 it++;
762 }
763
764 if(m_CterMod != nullptr)
765 {
766 QString cter_accession = m_CterMod->getAccession();
767 seq += QString("-[%1]").arg(cter_accession);
768 }
769 return seq;
770}

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 310 of file peptide.cpp.

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

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ operator<

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

Definition at line 44 of file peptide.cpp.

46{
47 return (l.m_aaVec < r.m_aaVec);
48}

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ operator==

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

Definition at line 51 of file peptide.cpp.

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

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: