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:322
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.

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

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

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

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

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

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

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

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

References m_aaVec.

◆ getChemicalFormula()

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

Reimplemented from pappso::AtomNumberInterface.

Definition at line 785 of file peptide.cpp.

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

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

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

◆ getCleavageNterModification()

AaModificationP pappso::Peptide::getCleavageNterModification ( ) const

◆ getConstAa()

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

Definition at line 676 of file peptide.cpp.

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

References m_aaVec.

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

◆ getCterModification()

AaModificationP pappso::Peptide::getCterModification ( ) const

Definition at line 627 of file peptide.cpp.

628{
629 return m_CterMod;
630}

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

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

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ getMass() [1/2]

pappso_double pappso::Peptide::getMass ( )

Definition at line 322 of file peptide.cpp.

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

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

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

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

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

References m_aaVec.

◆ getNterModification()

AaModificationP pappso::Peptide::getNterModification ( ) const

Definition at line 633 of file peptide.cpp.

634{
635 return m_NterMod;
636}

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

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

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

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

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

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

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

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

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

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

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

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

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

Referenced by PeptideProFormaParser.

◆ removeCterAminoAcid()

void pappso::Peptide::removeCterAminoAcid ( )

Definition at line 717 of file peptide.cpp.

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

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ removeNterAminoAcid()

void pappso::Peptide::removeNterAminoAcid ( )

Definition at line 700 of file peptide.cpp.

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

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

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

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

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

References getMass(), m_aaVec, and m_proxyMass.

Referenced by PeptideProFormaParser.

◆ replaceLeucineIsoleucine()

void pappso::Peptide::replaceLeucineIsoleucine ( )

Definition at line 687 of file peptide.cpp.

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

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ reverse()

void pappso::Peptide::reverse ( )

Definition at line 645 of file peptide.cpp.

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

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ rotate()

void pappso::Peptide::rotate ( )

Definition at line 639 of file peptide.cpp.

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

References m_aaVec.

Referenced by PeptideProFormaParser.

◆ setCleavageCterModification()

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

Definition at line 568 of file peptide.cpp.

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

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

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

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

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

References pappso::AaModification::getAccession(), 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 773 of file peptide.cpp.

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

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

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

References pappso::AaModification::getAccession(), 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 264 of file peptide.cpp.

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

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

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

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

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

References m_aaVec.

Referenced by PeptideProFormaParser.

Friends And Related Symbol Documentation

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