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, 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 (AtomIsotopeSurvey atom) const override
 get the number of atom C, O, N, H in the molecule
 
virtual int getNumberOfIsotope (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 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
 
AaModificationP getInternalNterModification () const
 
AaModificationP getInternalCterModification () const
 
void removeInternalNterModification ()
 
void removeInternalCterModification ()
 
void setInternalNterModification (AaModificationP mod)
 
void setInternalCterModification (AaModificationP mod)
 
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
 
- 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
 
- Public Member Functions inherited from pappso::Ion
 Ion ()
 
 ~Ion ()
 
virtual pappso_double getMz (unsigned int charge) const final
 
- Public Member Functions inherited from pappso::AtomNumberInterface

Protected Attributes

std::vector< Aam_aaVec
 
pappso_double m_proxyMass = -1
 

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

80{
81
82 QString::const_iterator it(pepstr.begin());
83 if(it != pepstr.end())
84 {
85 // first amino acid is the Nter one
86 // by default, it is obtained by hydrolytic cleavage in normal water
87 // and it is loaded with one Hydrogen
88 Aa nter_aa(it->toLatin1());
89 nter_aa.addAaModification(
90 AaModification::getInstance("internal:Nter_hydrolytic_cleavage_H"));
91 m_aaVec.push_back(nter_aa);
92 it++;
93
94 while(it != pepstr.end())
95 {
96 qDebug() << it->toLatin1();
97 m_aaVec.push_back(Aa(it->toLatin1()));
98 it++;
99 }
100 // by default, Nter aa is obtained by hydrolytic cleavage in normal water
101 // and it is loaded with Hydrogen + Oxygen
102 m_aaVec.back().addAaModification(
103 AaModification::getInstance("internal:Cter_hydrolytic_cleavage_HO"));
104 getMass();
105 qDebug() << "blabla " << m_aaVec.back().toString();
106 }
107}
static AaModificationP getInstance(const QString &accession)
pappso_double getMass()
Definition peptide.cpp:275
std::vector< Aa > m_aaVec
Definition peptide.h:244

References pappso::Aa::addAaModification(), pappso::AaModification::getInstance(), getMass(), and m_aaVec.

◆ ~Peptide()

pappso::Peptide::~Peptide ( )
virtual

Definition at line 109 of file peptide.cpp.

110{
111}

◆ Peptide() [2/3]

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

Definition at line 113 of file peptide.cpp.

114 : m_aaVec(peptide.m_aaVec), m_proxyMass(peptide.m_proxyMass)
115{
116}
pappso_double m_proxyMass
Definition peptide.h:245

◆ Peptide() [3/3]

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

Definition at line 119 of file peptide.cpp.

120 : m_aaVec(std::move(toCopy.m_aaVec)), m_proxyMass(toCopy.m_proxyMass)
121{
122}

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

190{
191 if(position >= size())
192 {
193 throw ExceptionOutOfRange(
194 QObject::tr("position (%1) > size (%2)").arg(position).arg(size()));
195 }
196 m_proxyMass = -1;
197 qDebug() << "Peptide::addAaModification begin " << position;
198 std::vector<Aa>::iterator it = m_aaVec.begin() + position;
199 it->addAaModification(aaModification);
200 getMass();
201 qDebug() << "Peptide::addAaModification end";
202}
unsigned int size() const override
Definition peptide.cpp:183

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

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

◆ addAaModificationOnAllAminoAcid()

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

adds a modification to all amino acid of the sequence

Parameters
aaModificationpointer on modification to add
AminoAcidCharamino_acid to apply the modification

Definition at line 205 of file peptide.cpp.

207{
208
209 for(auto &aa : *this)
210 {
211 if(aa.getAminoAcidChar() == amino_acid)
212 {
213 aa.addAaModification(aaModification);
214 }
215 }
216
217
218 m_proxyMass = -1;
219 getMass();
220}

References getMass(), and m_proxyMass.

◆ begin() [1/2]

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

Definition at line 139 of file peptide.cpp.

140{
141 return m_aaVec.begin();
142}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses().

◆ begin() [2/2]

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

Definition at line 151 of file peptide.cpp.

152{
153 return m_aaVec.begin();
154}

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

336{
337 unsigned int number = 0;
338 std::vector<Aa>::const_iterator it(m_aaVec.begin());
339 while(it != m_aaVec.end())
340 {
341 if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) !=
342 aa_list.end())
343 {
344 number += it->getNumberOfModification(mod);
345 }
346 it++;
347 }
348 // qDebug() << "Aa::getMass() end " << mass;
349 return number;
350}

References m_aaVec.

◆ end() [1/2]

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

Definition at line 145 of file peptide.cpp.

146{
147 return m_aaVec.end();
148}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses().

◆ end() [2/2]

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

Definition at line 157 of file peptide.cpp.

158{
159 return m_aaVec.end();
160}

References m_aaVec.

◆ getAa()

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

Definition at line 603 of file peptide.cpp.

604{
605 if(position >= m_aaVec.size())
606 {
607 throw ExceptionOutOfRange(
608 QObject::tr("no AA at position %1").arg(position));
609 }
610 return m_aaVec.at(position);
611}

References m_aaVec.

Referenced by 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 428 of file peptide.cpp.

429{
430 std::vector<unsigned int> position_list;
431 unsigned int number = 0;
432 std::vector<Aa>::const_iterator it(m_aaVec.begin());
433 while(it != m_aaVec.end())
434 {
435 if(it->getLetter() == aa)
436 position_list.push_back(number);
437 number++;
438 it++;
439 }
440 // qDebug() << "Aa::getMass() end " << mass;
441 return position_list;
442}

References m_aaVec.

Referenced by pappso::PeptideBuilder::setPeptide().

◆ getAaPositionList() [2/2]

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

Definition at line 445 of file peptide.cpp.

446{
447 std::vector<unsigned int> position_list;
448 unsigned int number = 0;
449 std::vector<Aa>::const_iterator it(m_aaVec.begin());
450 while(it != m_aaVec.end())
451 {
452
453 bool found =
454 (std::find(list_aa.begin(), list_aa.end(), it->getLetter()) !=
455 list_aa.end());
456 if(found)
457 {
458 position_list.push_back(number);
459 }
460 number++;
461 it++;
462 }
463 // qDebug() << "Aa::getMass() end " << mass;
464 return position_list;
465}

References m_aaVec.

◆ getConstAa()

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

Definition at line 613 of file peptide.cpp.

614{
615 if(position >= m_aaVec.size())
616 {
617 throw ExceptionOutOfRange(
618 QObject::tr("no AA at position %1").arg(position));
619 }
620 return m_aaVec.at(position);
621}

References m_aaVec.

Referenced by pappso::PeptideModificatorBase::getModificationPositionList().

◆ getInternalCterModification()

AaModificationP pappso::Peptide::getInternalCterModification ( ) const

Definition at line 479 of file peptide.cpp.

480{
481 std::vector<Aa>::const_iterator it(m_aaVec.end());
482 it--;
483 if(it != m_aaVec.end())
484 {
485 return it->getInternalCterModification();
486 }
487 return nullptr;
488}

References m_aaVec.

Referenced by pappso::specglob::PeptideModel::PeptideModel(), pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), removeCterAminoAcid(), reverse(), and rotate().

◆ getInternalNterModification()

AaModificationP pappso::Peptide::getInternalNterModification ( ) const

Definition at line 468 of file peptide.cpp.

469{
470 std::vector<Aa>::const_iterator it(m_aaVec.begin());
471 if(it != m_aaVec.end())
472 {
473 return it->getInternalNterModification();
474 }
475
476 return nullptr;
477}

References m_aaVec.

Referenced by pappso::specglob::PeptideModel::PeptideModel(), pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses(), removeNterAminoAcid(), reverse(), and rotate().

◆ getLiAbsoluteString()

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

get all sequence string with modifications and converting Leucine to Isoleucine

Definition at line 248 of file peptide.cpp.

249{
250 QString seq = "";
251 std::vector<Aa>::const_iterator it(m_aaVec.begin());
252 while(it != m_aaVec.end())
253 {
254 seq += it->toAbsoluteString();
255 it++;
256 }
257 return seq.replace("L", "I");
258}

References m_aaVec.

◆ getMass() [1/2]

pappso_double pappso::Peptide::getMass ( )

Definition at line 275 of file peptide.cpp.

276{
277 qDebug() << "Aa::getMass() begin";
278 if(m_proxyMass < 0)
279 {
280 m_proxyMass = 0;
281 for(auto aa : m_aaVec)
282 {
283 m_proxyMass += aa.getMass();
284 }
285 }
286 qDebug() << "Aa::getMass() end " << m_proxyMass;
287 return m_proxyMass;
288}

References m_aaVec, and m_proxyMass.

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

◆ getMass() [2/2]

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

Implements pappso::Ion.

Definition at line 176 of file peptide.cpp.

177{
178 return m_proxyMass;
179}

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

382{
383 std::vector<unsigned int> position_list;
384 unsigned int position = 0;
385 std::vector<Aa>::const_iterator it(m_aaVec.begin());
386 while(it != m_aaVec.end())
387 {
388 unsigned int number = 0;
389 number += it->getNumberOfModification(mod);
390 for(unsigned int j = 0; j < number; j++)
391 {
392 position_list.push_back(position);
393 }
394 it++;
395 position++;
396 }
397 // qDebug() << "Aa::getMass() end " << mass;
398 return position_list;
399}

References m_aaVec.

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

404{
405 std::vector<unsigned int> position_list;
406 unsigned int position = 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()) !=
411 aa_list.end())
412 {
413 unsigned int number = 0;
414 number += it->getNumberOfModification(mod);
415 for(unsigned int j = 0; j < number; j++)
416 {
417 position_list.push_back(position);
418 }
419 }
420 it++;
421 position++;
422 }
423 // qDebug() << "Aa::getMass() end " << mass;
424 return position_list;
425}

References m_aaVec.

◆ getNumberOfAtom()

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

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

Implements pappso::AtomNumberInterface.

Definition at line 291 of file peptide.cpp.

292{
293 int number = 0;
294 std::vector<Aa>::const_iterator it(m_aaVec.begin());
295 while(it != m_aaVec.end())
296 {
297 number += it->getNumberOfAtom(atom);
298 it++;
299 }
300 // qDebug() << "Aa::getMass() end " << mass;
301 return number;
302}

References m_aaVec.

◆ getNumberOfIsotope()

int pappso::Peptide::getNumberOfIsotope ( 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 305 of file peptide.cpp.

306{
307 int number = 0;
308 std::vector<Aa>::const_iterator it(m_aaVec.begin());
309 while(it != m_aaVec.end())
310 {
311 number += it->getNumberOfIsotope(isotope);
312 it++;
313 }
314 // qDebug() << "Aa::getMass() end " << mass;
315 return number;
316}

References m_aaVec.

◆ getNumberOfModification()

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

count modification occurence

Parameters
modmodification to look for
Returns
number of occurences

Definition at line 320 of file peptide.cpp.

321{
322 unsigned int number = 0;
323 std::vector<Aa>::const_iterator it(m_aaVec.begin());
324 while(it != m_aaVec.end())
325 {
326 number += it->getNumberOfModification(mod);
327 it++;
328 }
329 // qDebug() << "Aa::getMass() end " << mass;
330 return number;
331}

References m_aaVec.

◆ getSequence()

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

print amino acid sequence without modifications

Implements pappso::PeptideInterface.

Definition at line 223 of file peptide.cpp.

224{
225 QString seq = "";
226 std::vector<Aa>::const_iterator it(m_aaVec.begin());
227 while(it != m_aaVec.end())
228 {
229 seq += it->getLetter();
230 it++;
231 }
232 return seq;
233}

References m_aaVec.

Referenced by pappso::XtandemHyperscoreBis::computeXtandemHyperscore(), pappso::PeptideModificatorBase::getModificationPositionList(), 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 588 of file peptide.cpp.

589{
590 std::size_t size = m_aaVec.size();
591 std::size_t k = (size - 1);
592 for(std::size_t i = 0; i < (size / 2); i++, k--)
593 {
594 if(m_aaVec[i].getLetter() != m_aaVec[k].getLetter())
595 {
596 return false;
597 }
598 }
599 return true;
600}

References m_aaVec, and size().

◆ makeNoConstPeptideSp()

NoConstPeptideSp pappso::Peptide::makeNoConstPeptideSp ( ) const

Definition at line 132 of file peptide.cpp.

133{
134 return std::make_shared<Peptide>(*this);
135}

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

◆ makePeptideSp()

◆ rbegin()

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

Definition at line 163 of file peptide.cpp.

164{
165 return m_aaVec.rbegin();
166}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses().

◆ removeAaModification()

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

removes all occurences of a modification

Parameters
modmodification to remove

Definition at line 367 of file peptide.cpp.

368{
369 std::vector<Aa>::iterator it(m_aaVec.begin());
370 while(it != m_aaVec.end())
371 {
372 it->removeAaModification(mod);
373 qDebug() << it->toString() << " " << toAbsoluteString();
374 it++;
375 }
376 m_proxyMass = -1;
377 getMass();
378 // qDebug() << "Aa::getMass() end " << mass;
379}
const QString toAbsoluteString() const
print all modifications
Definition peptide.cpp:235

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

◆ removeCterAminoAcid()

void pappso::Peptide::removeCterAminoAcid ( )

Definition at line 661 of file peptide.cpp.

662{
663 std::vector<Aa>::iterator it(m_aaVec.end());
664 it--;
665 if(it != m_aaVec.end())
666 {
667 AaModificationP cter_modification = getInternalCterModification();
668 m_aaVec.erase(it);
669 if(cter_modification != nullptr)
670 {
671 it = m_aaVec.end();
672 it--;
673 it->addAaModification(cter_modification);
674 }
675 m_proxyMass = -1;
676 getMass();
677 }
678 else
679 {
680 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
681 }
682}
AaModificationP getInternalCterModification() const
Definition peptide.cpp:479
const AaModification * AaModificationP

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

◆ removeInternalCterModification()

void pappso::Peptide::removeInternalCterModification ( )

Definition at line 501 of file peptide.cpp.

502{
503 std::vector<Aa>::iterator it(m_aaVec.end());
504 it--;
505 if(it != m_aaVec.end())
506 {
507 m_proxyMass -= it->getMass();
508 it->removeInternalCterModification();
509 m_proxyMass += it->getMass();
510 }
511}

References m_aaVec, and m_proxyMass.

Referenced by setInternalCterModification().

◆ removeInternalNterModification()

void pappso::Peptide::removeInternalNterModification ( )

Definition at line 490 of file peptide.cpp.

491{
492 std::vector<Aa>::iterator it(m_aaVec.begin());
493 if(it != m_aaVec.end())
494 {
495 m_proxyMass -= it->getMass();
496 it->removeInternalNterModification();
497 m_proxyMass += it->getMass();
498 }
499}

References m_aaVec, and m_proxyMass.

Referenced by setInternalNterModification().

◆ removeNterAminoAcid()

void pappso::Peptide::removeNterAminoAcid ( )

Definition at line 638 of file peptide.cpp.

639{
640 std::vector<Aa>::iterator it(m_aaVec.begin());
641 if(it != m_aaVec.end())
642 {
643 AaModificationP nter_modification = getInternalNterModification();
644 m_aaVec.erase(it);
645 if(nter_modification != nullptr)
646 {
647 m_aaVec.begin()->addAaModification(nter_modification);
648 }
649
650 m_proxyMass = -1;
651 getMass();
652 }
653 else
654 {
655 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
656 }
657}
AaModificationP getInternalNterModification() const
Definition peptide.cpp:468

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

◆ rend()

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

Definition at line 169 of file peptide.cpp.

170{
171 return m_aaVec.rend();
172}

References m_aaVec.

Referenced by pappso::PeptideRawFragmentMasses::PeptideRawFragmentMasses().

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

354{
355 if(oldmod == newmod)
356 return;
357 std::vector<Aa>::iterator it(m_aaVec.begin());
358 while(it != m_aaVec.end())
359 {
360 it->replaceAaModification(oldmod, newmod);
361 it++;
362 }
363 m_proxyMass = -1;
364 getMass();
365}

References getMass(), m_aaVec, and m_proxyMass.

◆ replaceLeucineIsoleucine()

void pappso::Peptide::replaceLeucineIsoleucine ( )

Definition at line 625 of file peptide.cpp.

626{
627
628 std::vector<Aa>::iterator it(m_aaVec.begin());
629 std::vector<Aa>::iterator itend(m_aaVec.end());
630 for(; it != itend; it++)
631 {
632 it->replaceLeucineIsoleucine();
633 }
634}

References m_aaVec.

◆ reverse()

void pappso::Peptide::reverse ( )

Definition at line 575 of file peptide.cpp.

576{
579 m_aaVec.begin()->removeInternalNterModification();
580 (m_aaVec.end() - 1)->removeInternalCterModification();
581 std::reverse(m_aaVec.begin(), m_aaVec.end());
582 m_aaVec.begin()->addAaModification(modNter);
583 (m_aaVec.end() - 1)->addAaModification(modCter);
584}

References getInternalCterModification(), getInternalNterModification(), and m_aaVec.

◆ rotate()

void pappso::Peptide::rotate ( )

Definition at line 563 of file peptide.cpp.

564{
567 m_aaVec.begin()->removeInternalNterModification();
568 (m_aaVec.end() - 1)->removeInternalCterModification();
569 std::rotate(m_aaVec.begin(), m_aaVec.begin() + 1, m_aaVec.end());
570 m_aaVec.begin()->addAaModification(modNter);
571 (m_aaVec.end() - 1)->addAaModification(modCter);
572}

References getInternalCterModification(), getInternalNterModification(), and m_aaVec.

◆ setInternalCterModification()

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

Definition at line 538 of file peptide.cpp.

539{
540 if(mod->getAccession().startsWith("internal:Cter_"))
541 {
543 std::vector<Aa>::iterator it(m_aaVec.end());
544 it--;
545 if(it != m_aaVec.end())
546 {
547 it->addAaModification(mod);
548 }
549 else
550 {
551 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
552 }
553 }
554 else
555 {
556 throw ExceptionNotPossible(
557 QObject::tr("modification is not an internal Cter modification : %1")
558 .arg(mod->getAccession()));
559 }
560}
void removeInternalCterModification()
Definition peptide.cpp:501

References pappso::AaModification::getAccession(), m_aaVec, and removeInternalCterModification().

Referenced by pappso::PeptideStrParser::parseStringToPeptide().

◆ setInternalNterModification()

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

Definition at line 515 of file peptide.cpp.

516{
517 if(mod->getAccession().startsWith("internal:Nter_"))
518 {
520 std::vector<Aa>::iterator it(m_aaVec.begin());
521 if(it != m_aaVec.end())
522 {
523 it->addAaModification(mod);
524 }
525 else
526 {
527 throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
528 }
529 }
530 else
531 {
532 throw ExceptionNotPossible(
533 QObject::tr("modification is not an internal Nter modification : %1")
534 .arg(mod->getAccession()));
535 }
536}
void removeInternalNterModification()
Definition peptide.cpp:490

References pappso::AaModification::getAccession(), m_aaVec, and removeInternalNterModification().

Referenced by pappso::PeptideStrParser::parseStringToPeptide().

◆ size()

◆ toAbsoluteString()

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

print all modifications

Definition at line 235 of file peptide.cpp.

236{
237 QString seq = "";
238 std::vector<Aa>::const_iterator it(m_aaVec.begin());
239 while(it != m_aaVec.end())
240 {
241 seq += it->toAbsoluteString();
242 it++;
243 }
244 return seq;
245}

References m_aaVec.

Referenced by 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 685 of file peptide.cpp.

686{
687
688 QString seq = "";
689 std::vector<Aa>::const_iterator it(m_aaVec.begin());
690 while(it != m_aaVec.end())
691 {
692 seq += it->toProForma();
693 it++;
694 }
695 return seq;
696}

References m_aaVec.

◆ toString()

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

print modification except internal modifications

Definition at line 262 of file peptide.cpp.

263{
264 QString seq = "";
265 std::vector<Aa>::const_iterator it(m_aaVec.begin());
266 while(it != m_aaVec.end())
267 {
268 seq += it->toString();
269 it++;
270 }
271 return seq;
272}

References m_aaVec.

Friends And Related Symbol Documentation

◆ operator<

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

Definition at line 107 of file peptide.h.

109 {
110 return (l.m_aaVec < r.m_aaVec);
111 }

◆ operator==

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

Definition at line 113 of file peptide.h.

114 {
115 return (l.m_aaVec == r.m_aaVec);
116 }

◆ PeptideProFormaParser

friend class PeptideProFormaParser
friend

Definition at line 101 of file peptide.h.

Member Data Documentation

◆ m_aaVec

◆ m_proxyMass


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