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

Constructor & Destructor Documentation

◆ Peptide() [1/3]

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

Definition at line 83 of file peptide.cpp.

86  :Cter_hydrolytic_cleavage_HO"));
87  getMass();
88  qDebug() << "blabla " << m_aaVec.back().toString();
89  }
90 }
91 
92 Peptide::~Peptide()
93 {
94 }
95 
96 Peptide::Peptide(const Peptide &peptide)
97  : m_aaVec(peptide.m_aaVec), m_proxyMass(peptide.m_proxyMass)
98 {
99 }
100 
101 
102 Peptide::Peptide(Peptide &&toCopy) // move constructor
103  : m_aaVec(std::move(toCopy.m_aaVec)), m_proxyMass(toCopy.m_proxyMass)
104 {
105 }
106 
107 
108 PeptideSp
109 Peptide::makePeptideSp() const
110 {

◆ ~Peptide()

pappso::Peptide::~Peptide ( )
virtual

Definition at line 112 of file peptide.cpp.

◆ Peptide() [2/3]

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

Definition at line 116 of file peptide.cpp.

116 {
117  return std::make_shared<Peptide>(*this);
118 }
119 

◆ Peptide() [3/3]

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

Definition at line 122 of file peptide.cpp.

123 {
124  if(position >= size())
125  {

References size().

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

144  {
145  seq += it->getLetter();
146  it++;
147  }
148  return seq;
149 }
150 const QString
152 {
153  QString seq = "";
154  std::vector<Aa>::const_iterator it(m_aaVec.begin());
155  while(it != m_aaVec.end())

◆ begin() [1/2]

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

Definition at line 145 of file peptide.h.

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

◆ begin() [2/2]

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

Definition at line 157 of file peptide.h.

157  {
158  return m_aaVec.rend();
159  }
160 

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

270 {
271  if(oldmod == newmod)
272  return;
273  std::vector<Aa>::iterator it(m_aaVec.begin());
274  while(it != m_aaVec.end())
275  {
276  it->replaceAaModification(oldmod, newmod);
277  it++;
278  }
279  m_proxyMass = -1;
280  getMass();
281 }
282 void
284 {
285  std::vector<Aa>::iterator it(m_aaVec.begin());
286  while(it != m_aaVec.end())

References getMass(), m_aaVec, and m_proxyMass.

◆ end() [1/2]

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

Definition at line 151 of file peptide.h.

151  {
152  return m_aaVec.rbegin();
153  }
154 

Referenced by pappso::PeptideFragment::PeptideFragment().

◆ end() [2/2]

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

Definition at line 163 of file peptide.h.

168  {

◆ getAa()

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

Definition at line 539 of file peptide.cpp.

542 {
543 
544  std::vector<Aa>::iterator it(m_aaVec.begin());
545  std::vector<Aa>::iterator itend(m_aaVec.end());
546  for(; it != itend; it++)
547  {

References m_aaVec.

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

367  {
368 
369  bool found =
370  (std::find(list_aa.begin(), list_aa.end(), it->getLetter()) !=
371  list_aa.end());
372  if(found)
373  {
374  position_list.push_back(number);
375  }
376  number++;
377  it++;
378  }

◆ getAaPositionList() [2/2]

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

Definition at line 381 of file peptide.cpp.

385 {
386  std::vector<Aa>::const_iterator it(m_aaVec.begin());
387  if(it != m_aaVec.end())
388  {
389  return it->getInternalNterModification();
390  }
391 
392  return nullptr;
393 }
396 {
397  std::vector<Aa>::const_iterator it(m_aaVec.end());
398  it--;
399  if(it != m_aaVec.end())
400  {
401  return it->getInternalCterModification();

◆ getConstAa()

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

Definition at line 549 of file peptide.cpp.

555 {
556  std::vector<Aa>::iterator it(m_aaVec.begin());
557  if(it != m_aaVec.end())

◆ getInternalCterModification()

AaModificationP pappso::Peptide::getInternalCterModification ( ) const

Definition at line 415 of file peptide.cpp.

418 {
419  std::vector<Aa>::iterator it(m_aaVec.end());
420  it--;
421  if(it != m_aaVec.end())
422  {
423  m_proxyMass -= it->getMass();
424  it->removeInternalCterModification();

Referenced by removeNterAminoAcid().

◆ getInternalNterModification()

AaModificationP pappso::Peptide::getInternalNterModification ( ) const

Definition at line 404 of file peptide.cpp.

407 {
408  std::vector<Aa>::iterator it(m_aaVec.begin());
409  if(it != m_aaVec.end())
410  {
411  m_proxyMass -= it->getMass();
412  it->removeInternalNterModification();
413  m_proxyMass += it->getMass();

◆ getLiAbsoluteString()

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

get all sequence string with modifications and converting Leucine to Isoleucine

Definition at line 184 of file peptide.cpp.

192 {
193  qDebug() << "Aa::getMass() begin";
194  if(m_proxyMass < 0)

◆ getMass() [1/2]

pappso_double pappso::Peptide::getMass ( )

Definition at line 211 of file peptide.cpp.

212  {
213  number += it->getNumberOfAtom(atom);
214  it++;
215  }
216  // qDebug() << "Aa::getMass() end " << mass;
217  return number;
218 }
219 
220 int
222 {
223  int number = 0;
224  std::vector<Aa>::const_iterator it(m_aaVec.begin());

Referenced by countModificationOnAa(), and removeNterAminoAcid().

◆ getMass() [2/2]

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

Implements pappso::Ion.

Definition at line 186 of file peptide.h.

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

320 {
321  std::vector<unsigned int> position_list;
322  unsigned int position = 0;
323  std::vector<Aa>::const_iterator it(m_aaVec.begin());
324  while(it != m_aaVec.end())
325  {
326  if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) !=
327  aa_list.end())
328  {
329  unsigned int number = 0;
330  number += it->getNumberOfModification(mod);
331  for(unsigned int j = 0; j < number; j++)
332  {
333  position_list.push_back(position);
334  }
335  }

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

345 {
346  std::vector<unsigned int> position_list;
347  unsigned int number = 0;
348  std::vector<Aa>::const_iterator it(m_aaVec.begin());
349  while(it != m_aaVec.end())
350  {
351  if(it->getLetter() == aa)
352  position_list.push_back(number);
353  number++;
354  it++;
355  }
356  // qDebug() << "Aa::getMass() end " << mass;
357  return position_list;
358 }
359 
360 std::vector<unsigned int>
361 Peptide::getAaPositionList(std::list<char> list_aa) const

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

237 {
238  unsigned int number = 0;

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

241  {
242  number += it->getNumberOfModification(mod);
243  it++;
244  }
245  // qDebug() << "Aa::getMass() end " << mass;
246  return number;
247 }
248 
249 unsigned int
251  const std::vector<char> &aa_list) const
252 {

◆ getNumberOfModification()

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

count modification occurence

Parameters
modmodification to look for
Returns
number of occurences

Definition at line 256 of file peptide.cpp.

256  {
257  if(std::find(aa_list.begin(), aa_list.end(), it->getLetter()) !=
258  aa_list.end())
259  {
260  number += it->getNumberOfModification(mod);
261  }
262  it++;
263  }
264  // qDebug() << "Aa::getMass() end " << mass;
265  return number;
266 }
267 

◆ getSequence()

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

print amino acid sequence without modifications

Implements pappso::PeptideInterface.

Definition at line 159 of file peptide.cpp.

165 {
166  QString seq = "";
167  std::vector<Aa>::const_iterator it(m_aaVec.begin());
168  while(it != m_aaVec.end())
169  {

Referenced by pappso::XtandemHyperscoreBis::computeXtandemHyperscore().

◆ isPalindrome()

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

tells if the peptide sequence is a palindrome

Implements pappso::PeptideInterface.

Definition at line 524 of file peptide.cpp.

530 {
531  if(position >= m_aaVec.size())
532  {
533  throw ExceptionOutOfRange(
534  QObject::tr("no AA at position %1").arg(position));
535  }
536  return m_aaVec.at(position);

◆ makeNoConstPeptideSp()

NoConstPeptideSp pappso::Peptide::makeNoConstPeptideSp ( ) const

Definition at line 135 of file peptide.cpp.

◆ makePeptideSp()

PeptideSp pappso::Peptide::makePeptideSp ( ) const

Definition at line 129 of file peptide.cpp.

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

◆ rbegin()

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

Definition at line 169 of file peptide.h.

179  {

◆ removeAaModification()

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

removes all occurences of a modification

Parameters
modmodification to remove

Definition at line 303 of file peptide.cpp.

303  {
304  unsigned int number = 0;
305  number += it->getNumberOfModification(mod);
306  for(unsigned int j = 0; j < number; j++)
307  {
308  position_list.push_back(position);
309  }
310  it++;
311  position++;
312  }
313  // qDebug() << "Aa::getMass() end " << mass;
314  return position_list;
315 }

◆ removeCterAminoAcid()

void pappso::Peptide::removeCterAminoAcid ( )

Definition at line 597 of file peptide.cpp.

◆ removeInternalCterModification()

void pappso::Peptide::removeInternalCterModification ( )

Definition at line 437 of file peptide.cpp.

438  {
439  it->addAaModification(mod);
440  }
441  else
442  {
443  throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
444  }
445  }
446  else
447  {

◆ removeInternalNterModification()

void pappso::Peptide::removeInternalNterModification ( )

Definition at line 426 of file peptide.cpp.

432 {
433  if(mod->getAccession().startsWith("internal:Nter_"))
434  {

◆ removeNterAminoAcid()

void pappso::Peptide::removeNterAminoAcid ( )

Definition at line 574 of file peptide.cpp.

578 {
579  std::vector<Aa>::iterator it(m_aaVec.end());
580  it--;
581  if(it != m_aaVec.end())
582  {
583  AaModificationP cter_modification = getInternalCterModification();
584  m_aaVec.erase(it);
585  if(cter_modification != nullptr)
586  {
587  it = m_aaVec.end();
588  it--;
589  it->addAaModification(cter_modification);
590  }
591  m_proxyMass = -1;
592  getMass();
593  }

References pappso::AaModificationP, getInternalCterModification(), getMass(), m_aaVec, and m_proxyMass.

◆ rend()

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

Definition at line 175 of file peptide.h.

179  {

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

298 {
299  std::vector<unsigned int> position_list;
300  unsigned int position = 0;
301  std::vector<Aa>::const_iterator it(m_aaVec.begin());

◆ replaceLeucineIsoleucine()

void pappso::Peptide::replaceLeucineIsoleucine ( )

Definition at line 561 of file peptide.cpp.

562  {
563  m_aaVec.begin()->addAaModification(nter_modification);
564  }
565 
566  m_proxyMass = -1;
567  getMass();
568  }
569  else
570  {

References m_aaVec.

◆ reverse()

void pappso::Peptide::reverse ( )

Definition at line 511 of file peptide.cpp.

511  {
512  return false;
513  }
514  }
515  return true;
516 }
517 
518 Aa &
519 Peptide::getAa(unsigned int position)
520 {

◆ rotate()

void pappso::Peptide::rotate ( )

Definition at line 499 of file peptide.cpp.

505 {
506  std::size_t size = m_aaVec.size();
507  std::size_t k = (size - 1);
508  for(std::size_t i = 0; i < (size / 2); i++, k--)

◆ setInternalCterModification()

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

Definition at line 474 of file peptide.cpp.

480 {
483  m_aaVec.begin()->removeInternalNterModification();
485  std::rotate(m_aaVec.begin(), m_aaVec.begin() + 1, m_aaVec.end());
486  m_aaVec.begin()->addAaModification(modNter);
487  (m_aaVec.end() - 1)->addAaModification(modCter);
488 }
489 
490 void
492 {
495  m_aaVec.begin()->removeInternalNterModification();

◆ setInternalNterModification()

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

Definition at line 451 of file peptide.cpp.

455 {
456  if(mod->getAccession().startsWith("internal:Cter_"))
457  {
459  std::vector<Aa>::iterator it(m_aaVec.end());
460  it--;
461  if(it != m_aaVec.end())
462  {
463  it->addAaModification(mod);
464  }
465  else
466  {
467  throw ExceptionOutOfRange(QObject::tr("peptide is empty"));
468  }
469  }
470  else
471  {
472  throw ExceptionNotPossible(

◆ size()

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

◆ toAbsoluteString()

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

print all modifications

Definition at line 171 of file peptide.cpp.

179 {
180  QString seq = "";
181  std::vector<Aa>::const_iterator it(m_aaVec.begin());

◆ toString()

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

print modification except internal modifications

Definition at line 198 of file peptide.cpp.

198  {
199  m_proxyMass += aa.getMass();
200  }
201  }
202  qDebug() << "Aa::getMass() end " << m_proxyMass;
203  return m_proxyMass;
204 }
205 
206 int
208 {

References m_proxyMass.

Friends And Related Function Documentation

◆ operator<

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

Definition at line 122 of file peptide.h.

127  {

◆ operator==

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

Definition at line 127 of file peptide.h.

127  {
128  return m_aaVec.begin();
129  }
130 

Member Data Documentation

◆ m_aaVec

std::vector<Aa> pappso::Peptide::m_aaVec
protected

◆ m_proxyMass

pappso_double pappso::Peptide::m_proxyMass = -1
protected

Definition at line 115 of file peptide.h.

Referenced by countModificationOnAa(), removeNterAminoAcid(), and toString().


The documentation for this class was generated from the following files:
pappso::Peptide::removeInternalCterModification
void removeInternalCterModification()
Definition: peptide.cpp:437
pappso::Peptide::removeAaModification
void removeAaModification(AaModificationP mod)
removes all occurences of a modification
Definition: peptide.cpp:303
pappso::Peptide::size
unsigned int size() const override
Definition: peptide.h:197
pappso::Peptide::getInternalCterModification
AaModificationP getInternalCterModification() const
Definition: peptide.cpp:415
pappso::Isotope
Isotope
Definition: types.h:109
pappso::Peptide::toAbsoluteString
const QString toAbsoluteString() const
print all modifications
Definition: peptide.cpp:171
pappso::Peptide::countModificationOnAa
unsigned int countModificationOnAa(AaModificationP mod, const std::vector< char > &aa_list) const
count modification occurence
Definition: peptide.cpp:270
pappso::Peptide::getNumberOfAtom
virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition: peptide.cpp:227
pappso::Peptide::getNumberOfIsotope
virtual int getNumberOfIsotope(Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
Definition: peptide.cpp:241
pappso::Peptide::getInternalNterModification
AaModificationP getInternalNterModification() const
Definition: peptide.cpp:404
pappso::Peptide::m_aaVec
std::vector< Aa > m_aaVec
Definition: peptide.h:114
pappso::Peptide::removeInternalNterModification
void removeInternalNterModification()
Definition: peptide.cpp:426
pappso::Peptide::addAaModification
void addAaModification(AaModificationP aaModification, unsigned int position)
adds a modification to amino acid sequence
Definition: peptide.cpp:141
pappso::AaModificationP
const typedef AaModification * AaModificationP
Definition: aamodification.h:71
pappso::Peptide::getAaPositionList
std::vector< unsigned int > getAaPositionList(char aa) const
get positions of one amino acid in peptide
Definition: peptide.cpp:364
pappso::Peptide::m_proxyMass
pappso_double m_proxyMass
Definition: peptide.h:115
pappso::Peptide::getMass
pappso_double getMass()
Definition: peptide.cpp:211
pappso::Peptide::reverse
void reverse()
Definition: peptide.cpp:511
pappso::AtomIsotopeSurvey
AtomIsotopeSurvey
Definition: types.h:94
pappso::Peptide::getAa
Aa & getAa(unsigned int position)
Definition: peptide.cpp:539