libpappsomspp
Library for mass spectrometry
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 More...
 
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 More...
 
virtual int getNumberOfIsotope (Isotope isotope) const override
 get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule More...
 
const QString getSequence () const override
 print amino acid sequence without modifications More...
 
unsigned int size () const override
 
unsigned int getNumberOfModification (AaModificationP mod) const
 count modification occurence More...
 
unsigned int countModificationOnAa (AaModificationP mod, const std::vector< char > &aa_list) const
 count modification occurence More...
 
void replaceAaModification (AaModificationP oldmod, AaModificationP newmod)
 replaces all occurences of a modification by a new one More...
 
void removeAaModification (AaModificationP mod)
 removes all occurences of a modification More...
 
std::vector< unsigned int > getModificationPositionList (AaModificationP mod) const
 get modification positions More...
 
std::vector< unsigned int > getModificationPositionList (AaModificationP mod, const std::vector< char > &aa_list) const
 get modification positions More...
 
std::vector< unsigned int > getAaPositionList (char aa) const
 get positions of one amino acid in peptide More...
 
std::vector< unsigned int > getAaPositionList (std::list< char > list_aa) const
 
const QString toString () const
 print modification except internal modifications More...
 
const QString toAbsoluteString () const
 print all modifications More...
 
const QString getLiAbsoluteString () const
 get all sequence string with modifications and converting Leucine to Isoleucine More...
 
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 More...
 
void replaceLeucineIsoleucine ()
 
void removeNterAminoAcid ()
 
void removeCterAminoAcid ()
 
- Public Member Functions inherited from pappso::PeptideInterface
virtual const QString getSequenceLi () const
 amino acid sequence without modification where L are replaced by I More...
 
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
 

Protected Attributes

std::vector< Aam_aaVec
 
pappso_double m_proxyMass = -1
 

Friends

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  m_aaVec.push_back(Aa(it->toLatin1()));
97  it++;
98  }
99  // by default, Nter aa is obtained by hydrolytic cleavage in normal water
100  // and it is loaded with Hydrogen + Oxygen
101  m_aaVec.back().addAaModification(
102  AaModification::getInstance("internal:Cter_hydrolytic_cleavage_HO"));
103  getMass();
104  qDebug() << "blabla " << m_aaVec.back().toString();
105  }
106 }
static AaModificationP getInstance(const QString &accession)
pappso_double getMass()
Definition: peptide.cpp:207
std::vector< Aa > m_aaVec
Definition: peptide.h:102

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

◆ ~Peptide()

pappso::Peptide::~Peptide ( )
virtual

Definition at line 108 of file peptide.cpp.

109 {
110 }

◆ Peptide() [2/3]

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

Definition at line 112 of file peptide.cpp.

113  : m_aaVec(peptide.m_aaVec), m_proxyMass(peptide.m_proxyMass)
114 {
115 }
pappso_double m_proxyMass
Definition: peptide.h:103

◆ Peptide() [3/3]

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

Definition at line 118 of file peptide.cpp.

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

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

139 {
140  if(position >= size())
141  {
142  throw ExceptionOutOfRange(
143  QObject::tr("position (%1) > size (%2)").arg(position).arg(size()));
144  }
145  m_proxyMass = -1;
146  qDebug() << "Peptide::addAaModification begin " << position;
147  std::vector<Aa>::iterator it = m_aaVec.begin() + position;
148  it->addAaModification(aaModification);
149  getMass();
150  qDebug() << "Peptide::addAaModification end";
151 }
unsigned int size() const override
Definition: peptide.h:185

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

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

◆ begin() [1/2]

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

Definition at line 133 of file peptide.h.

134  {
135  return m_aaVec.begin();
136  }

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

◆ begin() [2/2]

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

Definition at line 145 of file peptide.h.

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

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

268 {
269  unsigned int number = 0;
270  std::vector<Aa>::const_iterator it(m_aaVec.begin());
271  while(it != m_aaVec.end())
272  {
273  if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) !=
274  aa_list.end())
275  {
276  number += it->getNumberOfModification(mod);
277  }
278  it++;
279  }
280  // qDebug() << "Aa::getMass() end " << mass;
281  return number;
282 }

References m_aaVec.

◆ end() [1/2]

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

Definition at line 139 of file peptide.h.

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

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

◆ end() [2/2]

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

Definition at line 151 of file peptide.h.

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

◆ getAa()

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

Definition at line 535 of file peptide.cpp.

536 {
537  if(position >= m_aaVec.size())
538  {
539  throw ExceptionOutOfRange(
540  QObject::tr("no AA at position %1").arg(position));
541  }
542  return m_aaVec.at(position);
543 }

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

361 {
362  std::vector<unsigned int> position_list;
363  unsigned int number = 0;
364  std::vector<Aa>::const_iterator it(m_aaVec.begin());
365  while(it != m_aaVec.end())
366  {
367  if(it->getLetter() == aa)
368  position_list.push_back(number);
369  number++;
370  it++;
371  }
372  // qDebug() << "Aa::getMass() end " << mass;
373  return position_list;
374 }

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

378 {
379  std::vector<unsigned int> position_list;
380  unsigned int number = 0;
381  std::vector<Aa>::const_iterator it(m_aaVec.begin());
382  while(it != m_aaVec.end())
383  {
384 
385  bool found =
386  (std::find(list_aa.begin(), list_aa.end(), it->getLetter()) !=
387  list_aa.end());
388  if(found)
389  {
390  position_list.push_back(number);
391  }
392  number++;
393  it++;
394  }
395  // qDebug() << "Aa::getMass() end " << mass;
396  return position_list;
397 }

References m_aaVec.

◆ getConstAa()

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

Definition at line 545 of file peptide.cpp.

546 {
547  if(position >= m_aaVec.size())
548  {
549  throw ExceptionOutOfRange(
550  QObject::tr("no AA at position %1").arg(position));
551  }
552  return m_aaVec.at(position);
553 }

References m_aaVec.

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

◆ getInternalCterModification()

AaModificationP pappso::Peptide::getInternalCterModification ( ) const

Definition at line 411 of file peptide.cpp.

412 {
413  std::vector<Aa>::const_iterator it(m_aaVec.end());
414  it--;
415  if(it != m_aaVec.end())
416  {
417  return it->getInternalCterModification();
418  }
419  return nullptr;
420 }

References m_aaVec.

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

◆ getInternalNterModification()

AaModificationP pappso::Peptide::getInternalNterModification ( ) const

Definition at line 400 of file peptide.cpp.

401 {
402  std::vector<Aa>::const_iterator it(m_aaVec.begin());
403  if(it != m_aaVec.end())
404  {
405  return it->getInternalNterModification();
406  }
407 
408  return nullptr;
409 }

References m_aaVec.

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

181 {
182  QString seq = "";
183  std::vector<Aa>::const_iterator it(m_aaVec.begin());
184  while(it != m_aaVec.end())
185  {
186  seq += it->toAbsoluteString();
187  it++;
188  }
189  return seq.replace("L", "I");
190 }

References m_aaVec.

◆ getMass() [1/2]

pappso_double pappso::Peptide::getMass ( )

Definition at line 207 of file peptide.cpp.

208 {
209  qDebug() << "Aa::getMass() begin";
210  if(m_proxyMass < 0)
211  {
212  m_proxyMass = 0;
213  for(auto aa : m_aaVec)
214  {
215  m_proxyMass += aa.getMass();
216  }
217  }
218  qDebug() << "Aa::getMass() end " << m_proxyMass;
219  return m_proxyMass;
220 }

References m_aaVec, and m_proxyMass.

Referenced by Peptide(), addAaModification(), pappso::Protein::getMass(), removeAaModification(), removeCterAminoAcid(), removeNterAminoAcid(), and replaceAaModification().

◆ getMass() [2/2]

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

Implements pappso::Ion.

Definition at line 174 of file peptide.h.

175  {
176  return m_proxyMass;
177  };

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

314 {
315  std::vector<unsigned int> position_list;
316  unsigned int position = 0;
317  std::vector<Aa>::const_iterator it(m_aaVec.begin());
318  while(it != m_aaVec.end())
319  {
320  unsigned int number = 0;
321  number += it->getNumberOfModification(mod);
322  for(unsigned int j = 0; j < number; j++)
323  {
324  position_list.push_back(position);
325  }
326  it++;
327  position++;
328  }
329  // qDebug() << "Aa::getMass() end " << mass;
330  return position_list;
331 }

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

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

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

224 {
225  int number = 0;
226  std::vector<Aa>::const_iterator it(m_aaVec.begin());
227  while(it != m_aaVec.end())
228  {
229  number += it->getNumberOfAtom(atom);
230  it++;
231  }
232  // qDebug() << "Aa::getMass() end " << mass;
233  return number;
234 }

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

238 {
239  int number = 0;
240  std::vector<Aa>::const_iterator it(m_aaVec.begin());
241  while(it != m_aaVec.end())
242  {
243  number += it->getNumberOfIsotope(isotope);
244  it++;
245  }
246  // qDebug() << "Aa::getMass() end " << mass;
247  return number;
248 }

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

253 {
254  unsigned int number = 0;
255  std::vector<Aa>::const_iterator it(m_aaVec.begin());
256  while(it != m_aaVec.end())
257  {
258  number += it->getNumberOfModification(mod);
259  it++;
260  }
261  // qDebug() << "Aa::getMass() end " << mass;
262  return number;
263 }

References m_aaVec.

◆ getSequence()

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

print amino acid sequence without modifications

Implements pappso::PeptideInterface.

Definition at line 155 of file peptide.cpp.

156 {
157  QString seq = "";
158  std::vector<Aa>::const_iterator it(m_aaVec.begin());
159  while(it != m_aaVec.end())
160  {
161  seq += it->getLetter();
162  it++;
163  }
164  return seq;
165 }

References m_aaVec.

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

◆ isPalindrome()

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

tells if the peptide sequence is a palindrome

Implements pappso::PeptideInterface.

Definition at line 520 of file peptide.cpp.

521 {
522  std::size_t size = m_aaVec.size();
523  std::size_t k = (size - 1);
524  for(std::size_t i = 0; i < (size / 2); i++, k--)
525  {
526  if(m_aaVec[i].getLetter() != m_aaVec[k].getLetter())
527  {
528  return false;
529  }
530  }
531  return true;
532 }

References m_aaVec, and size().

◆ makeNoConstPeptideSp()

NoConstPeptideSp pappso::Peptide::makeNoConstPeptideSp ( ) const

Definition at line 131 of file peptide.cpp.

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

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

◆ makePeptideSp()

◆ rbegin()

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

Definition at line 157 of file peptide.h.

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

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

300 {
301  std::vector<Aa>::iterator it(m_aaVec.begin());
302  while(it != m_aaVec.end())
303  {
304  it->removeAaModification(mod);
305  qDebug() << it->toString() << " " << toAbsoluteString();
306  it++;
307  }
308  m_proxyMass = -1;
309  getMass();
310  // qDebug() << "Aa::getMass() end " << mass;
311 }
const QString toAbsoluteString() const
print all modifications
Definition: peptide.cpp:167

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

◆ removeCterAminoAcid()

void pappso::Peptide::removeCterAminoAcid ( )

Definition at line 593 of file peptide.cpp.

594 {
595  std::vector<Aa>::iterator it(m_aaVec.end());
596  it--;
597  if(it != m_aaVec.end())
598  {
599  AaModificationP cter_modification = getInternalCterModification();
600  m_aaVec.erase(it);
601  if(cter_modification != nullptr)
602  {
603  it = m_aaVec.end();
604  it--;
605  it->addAaModification(cter_modification);
606  }
607  m_proxyMass = -1;
608  getMass();
609  }
610  else
611  {
612  throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
613  }
614 }
AaModificationP getInternalCterModification() const
Definition: peptide.cpp:411
const AaModification * AaModificationP

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

◆ removeInternalCterModification()

void pappso::Peptide::removeInternalCterModification ( )

Definition at line 433 of file peptide.cpp.

434 {
435  std::vector<Aa>::iterator it(m_aaVec.end());
436  it--;
437  if(it != m_aaVec.end())
438  {
439  m_proxyMass -= it->getMass();
440  it->removeInternalCterModification();
441  m_proxyMass += it->getMass();
442  }
443 }

References m_aaVec, and m_proxyMass.

Referenced by reverse(), rotate(), and setInternalCterModification().

◆ removeInternalNterModification()

void pappso::Peptide::removeInternalNterModification ( )

Definition at line 422 of file peptide.cpp.

423 {
424  std::vector<Aa>::iterator it(m_aaVec.begin());
425  if(it != m_aaVec.end())
426  {
427  m_proxyMass -= it->getMass();
428  it->removeInternalNterModification();
429  m_proxyMass += it->getMass();
430  }
431 }

References m_aaVec, and m_proxyMass.

Referenced by setInternalNterModification().

◆ removeNterAminoAcid()

void pappso::Peptide::removeNterAminoAcid ( )

Definition at line 570 of file peptide.cpp.

571 {
572  std::vector<Aa>::iterator it(m_aaVec.begin());
573  if(it != m_aaVec.end())
574  {
575  AaModificationP nter_modification = getInternalNterModification();
576  m_aaVec.erase(it);
577  if(nter_modification != nullptr)
578  {
579  m_aaVec.begin()->addAaModification(nter_modification);
580  }
581 
582  m_proxyMass = -1;
583  getMass();
584  }
585  else
586  {
587  throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
588  }
589 }
AaModificationP getInternalNterModification() const
Definition: peptide.cpp:400

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

◆ rend()

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

Definition at line 163 of file peptide.h.

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

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

286 {
287  if(oldmod == newmod)
288  return;
289  std::vector<Aa>::iterator it(m_aaVec.begin());
290  while(it != m_aaVec.end())
291  {
292  it->replaceAaModification(oldmod, newmod);
293  it++;
294  }
295  m_proxyMass = -1;
296  getMass();
297 }

References getMass(), m_aaVec, and m_proxyMass.

◆ replaceLeucineIsoleucine()

void pappso::Peptide::replaceLeucineIsoleucine ( )

Definition at line 557 of file peptide.cpp.

558 {
559 
560  std::vector<Aa>::iterator it(m_aaVec.begin());
561  std::vector<Aa>::iterator itend(m_aaVec.end());
562  for(; it != itend; it++)
563  {
564  it->replaceLeucineIsoleucine();
565  }
566 }

References m_aaVec.

◆ reverse()

void pappso::Peptide::reverse ( )

Definition at line 507 of file peptide.cpp.

508 {
511  m_aaVec.begin()->removeInternalNterModification();
513  std::reverse(m_aaVec.begin(), m_aaVec.end());
514  m_aaVec.begin()->addAaModification(modNter);
515  (m_aaVec.end() - 1)->addAaModification(modCter);
516 }
void removeInternalCterModification()
Definition: peptide.cpp:433
void addAaModification(AaModificationP aaModification, unsigned int position)
adds a modification to amino acid sequence
Definition: peptide.cpp:137

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

◆ rotate()

void pappso::Peptide::rotate ( )

Definition at line 495 of file peptide.cpp.

496 {
499  m_aaVec.begin()->removeInternalNterModification();
501  std::rotate(m_aaVec.begin(), m_aaVec.begin() + 1, m_aaVec.end());
502  m_aaVec.begin()->addAaModification(modNter);
503  (m_aaVec.end() - 1)->addAaModification(modCter);
504 }

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

◆ setInternalCterModification()

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

Definition at line 470 of file peptide.cpp.

471 {
472  if(mod->getAccession().startsWith("internal:Cter_"))
473  {
475  std::vector<Aa>::iterator it(m_aaVec.end());
476  it--;
477  if(it != m_aaVec.end())
478  {
479  it->addAaModification(mod);
480  }
481  else
482  {
483  throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
484  }
485  }
486  else
487  {
488  throw ExceptionNotPossible(
489  QObject::tr("modification is not an internal Cter modification : %1")
490  .arg(mod->getAccession()));
491  }
492 }

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

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

◆ setInternalNterModification()

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

Definition at line 447 of file peptide.cpp.

448 {
449  if(mod->getAccession().startsWith("internal:Nter_"))
450  {
452  std::vector<Aa>::iterator it(m_aaVec.begin());
453  if(it != m_aaVec.end())
454  {
455  it->addAaModification(mod);
456  }
457  else
458  {
459  throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
460  }
461  }
462  else
463  {
464  throw ExceptionNotPossible(
465  QObject::tr("modification is not an internal Nter modification : %1")
466  .arg(mod->getAccession()));
467  }
468 }
void removeInternalNterModification()
Definition: peptide.cpp:422

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

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

◆ size()

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

Implements pappso::PeptideInterface.

Definition at line 185 of file peptide.h.

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

Referenced by addAaModification(), isPalindrome(), and pappso::PeptideFixedModificationBuilder::setPeptideSp().

◆ toAbsoluteString()

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

print all modifications

Definition at line 167 of file peptide.cpp.

168 {
169  QString seq = "";
170  std::vector<Aa>::const_iterator it(m_aaVec.begin());
171  while(it != m_aaVec.end())
172  {
173  seq += it->toAbsoluteString();
174  it++;
175  }
176  return seq;
177 }

References m_aaVec.

Referenced by removeAaModification().

◆ toString()

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

print modification except internal modifications

Definition at line 194 of file peptide.cpp.

195 {
196  QString seq = "";
197  std::vector<Aa>::const_iterator it(m_aaVec.begin());
198  while(it != m_aaVec.end())
199  {
200  seq += it->toString();
201  it++;
202  }
203  return seq;
204 }

References m_aaVec.

Friends And Related Function Documentation

◆ operator<

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

Definition at line 109 of file peptide.h.

111  {
112  return (l.m_aaVec < r.m_aaVec);
113  }

◆ operator==

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

Definition at line 115 of file peptide.h.

116  {
117  return (l.m_aaVec == r.m_aaVec);
118  }

Member Data Documentation

◆ m_aaVec

◆ m_proxyMass


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