libpappsomspp
Library for mass spectrometry
peptideinterface.cpp
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
4  *
5  * This file is part of the PAPPSOms++ library.
6  *
7  * PAPPSOms++ is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * PAPPSOms++ is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
19  *
20  * Contributors:
21  * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
22  *implementation
23  ******************************************************************************/
24 
25 #include "peptideinterface.h"
26 
27 namespace pappso
28 {
29 
30 const QString
32 {
33  return QString(this->getSequence()).replace("L", "I");
34 }
35 const QString
36 PeptideInterface::getFormula(unsigned int charge) const
37 {
38  QString carbon(
39  QString("C %1").arg(this->getNumberOfAtom(AtomIsotopeSurvey::C) -
41  if(this->getNumberOfIsotope(Isotope::C13) > 0)
42  {
43  carbon.append(
44  QString(" (13)C %1").arg(this->getNumberOfIsotope(Isotope::C13)));
45  }
46  QString hydrogen(
47  QString("H %1").arg(this->getNumberOfAtom(AtomIsotopeSurvey::H) + charge -
49  if(this->getNumberOfIsotope(Isotope::H2) > 0)
50  {
51  hydrogen.append(
52  QString(" (2)H %1").arg(this->getNumberOfIsotope(Isotope::H2)));
53  }
54  QString oxygen(
55  QString("O %1").arg(this->getNumberOfAtom(AtomIsotopeSurvey::O) -
58  if(this->getNumberOfIsotope(Isotope::O17) > 0)
59  {
60  oxygen.append(
61  QString(" (17)O %1").arg(this->getNumberOfIsotope(Isotope::O17)));
62  }
63  if(this->getNumberOfIsotope(Isotope::O18) > 0)
64  {
65  oxygen.append(
66  QString(" (18)O %1").arg(this->getNumberOfIsotope(Isotope::O18)));
67  }
68  QString nitrogen(
69  QString("N %1").arg(this->getNumberOfAtom(AtomIsotopeSurvey::N) -
71  if(this->getNumberOfIsotope(Isotope::N15) > 0)
72  {
73  nitrogen.append(
74  QString(" (15)N %1").arg(this->getNumberOfIsotope(Isotope::N15)));
75  }
76 
77  QString sulfur(
78  QString("S %1").arg(this->getNumberOfAtom(AtomIsotopeSurvey::S) -
82  if(this->getNumberOfIsotope(Isotope::S33) > 0)
83  {
84  sulfur.append(
85  QString(" (33)S %1").arg(this->getNumberOfIsotope(Isotope::S33)));
86  }
87  if(this->getNumberOfIsotope(Isotope::S34) > 0)
88  {
89  sulfur.append(
90  QString(" (34)S %1").arg(this->getNumberOfIsotope(Isotope::S34)));
91  }
92  if(this->getNumberOfIsotope(Isotope::S36) > 0)
93  {
94  sulfur.append(
95  QString(" (36)S %1").arg(this->getNumberOfIsotope(Isotope::S36)));
96  }
97  return QString("%1 %2 %3 %4 %5")
98  .arg(carbon)
99  .arg(hydrogen)
100  .arg(oxygen)
101  .arg(nitrogen)
102  .arg(sulfur);
103 }
104 } // namespace pappso
virtual int getNumberOfIsotope(Isotope isotope) const =0
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const =0
get the number of atom C, O, N, H in the molecule
virtual const QString getSequence() const =0
amino acid sequence without modification
virtual const QString getSequenceLi() const
amino acid sequence without modification where L are replaced by I
virtual const QString getFormula(unsigned int charge) const final
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39