libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
peptide.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/peptide/peptide.h
3 * \date 7/3/2015
4 * \author Olivier Langella
5 * \brief peptide model
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms++ is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Contributors:
27 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
31#pragma once
32
33
34#include <vector>
35#include <memory>
36#include <QString>
37#include "../amino_acid/aa.h"
39#include "peptideinterface.h"
40#include <cstdint>
42
43namespace pappso
44{
45
46enum class PeptideDirection : std::int8_t
47{
48 Nter = 0,
49 Cter = 1
50};
51
52
53/** \brief tells if an ion is Nter
54 * \param ion_type the ion to test
55 */
57
58/** \brief tells if an ion type is the complement ion of the other
59 * \param ion_type_ref the ion type reference
60 * \param ion_type the ion to test
61 */
63 Enums::PeptideIon ion_type);
64
65
66/** \brief get the direction of a peptide ion
67 * \param ion_type the ion to test
68 * \return the peptide direction
69 */
71
83
84
86{
93};
94
95class Peptide;
96
97typedef std::shared_ptr<const Peptide> PeptideSp;
98typedef std::shared_ptr<Peptide> NoConstPeptideSp;
99
100
102{
104 friend bool operator<(const Peptide &l, const Peptide &r);
105 friend bool operator==(const Peptide &l, const Peptide &r);
106
107
108 public:
109 Peptide(const QString &pepstr);
110 virtual ~Peptide();
111 Peptide(const Peptide &peptide);
112
113 Peptide(Peptide &&toCopy);
114
115 PeptideSp makePeptideSp() const;
117
118 /** @brief adds a modification to amino acid sequence
119 * @param aaModification pointer on modification to add
120 * @param position position in the amino acid sequence (starts at 0)
121 * */
122 void addAaModification(AaModificationP aaModification, unsigned int position);
123
124 /** @brief adds a modification to all amino acid of the sequence
125 * @param aaModification pointer on modification to add
126 * @param Enums::AminoAcidChar amino_acid to apply the modification
127 * */
129 Enums::AminoAcidChar amino_acid);
130
131 std::vector<Aa>::iterator begin();
132
133 std::vector<Aa>::iterator end();
134
135 std::vector<Aa>::const_iterator begin() const;
136
137 std::vector<Aa>::const_iterator end() const;
138
139 std::vector<Aa>::const_reverse_iterator rbegin() const;
140
141 std::vector<Aa>::const_reverse_iterator rend() const;
142
143 Aa &getAa(unsigned int position);
144 const Aa &getConstAa(unsigned int position) const;
145
146
147 /** @brief get raw mass array of the amino acid sequence
148 */
149 std::vector<double> getRawMassArray() const;
150
151 /** @brief get complete serie of product masses for a given charge and ion type
152 */
153 std::vector<double> getMassIonSerie(unsigned int charge,
154 pappso::Enums::PeptideIon ion_type) const;
155
157 pappso_double getMass() const override;
158
159 virtual int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override;
160 virtual int getNumberOfIsotope(Enums::Isotope isotope) const override;
161
162 /** \brief print amino acid sequence without modifications */
163 const QString getSequence() const override;
164 unsigned int size() const override;
165
166 /** @brief count modification occurence
167 * @param mod modification to look for
168 * @result number of occurences
169 */
170 unsigned int getNumberOfModification(AaModificationP mod) const;
171
172 /** @brief count modification occurence
173 * @param mod modification to look for
174 * @param aa_list amino acid list targets (one letter code)
175 * @result number of occurences
176 */
177 unsigned int countModificationOnAa(AaModificationP mod, const std::vector<char> &aa_list) const;
178
179 /** @brief replaces all occurences of a modification by a new one
180 * @param oldmod modification to change
181 * @param newmod new modification
182 */
184
185
186 /** @brief replaces all occurences of a modification by a new one
187 * on a specific amino acid
188 * @param aa the amino acid to modify
189 * @param oldmod modification to change
190 * @param newmod new modification
191 */
195
196 /** @brief removes all occurences of a modification
197 * @param mod modification to remove
198 */
200
201 /** @brief get modification positions
202 * @param mod modification to look for
203 * @result vector containing positions (from 0 to size-1)
204 */
205 std::vector<unsigned int> getModificationPositionList(AaModificationP mod) const;
206
207 /** @brief get modification positions
208 * @param mod modification to look for
209 * @param aa_list amino acid list targets (one letter code)
210 * @result vector containing positions (from 0 to size-1)
211 */
212 std::vector<unsigned int> getModificationPositionList(AaModificationP mod,
213 const std::vector<char> &aa_list) const;
214
215 /** @brief get positions of one amino acid in peptide
216 * @param aa the one letter code of the amino acid
217 * @result vector containing positions (from 0 to size-1) */
218 std::vector<unsigned int> getAaPositionList(char aa) const;
219 std::vector<unsigned int> getAaPositionList(std::list<char> list_aa) const;
220
221 /** \brief print modification except internal modifications */
222 const QString toString() const;
223 /** \brief print all modifications */
224 const QString toAbsoluteString() const;
225 /** \brief get all sequence string with modifications and converting Leucine
226 * to Isoleucine */
227 const QString getLiAbsoluteString() const;
228
237
238
239 /** @brief apply 100% isotope replacement
240 * @todo
241 */
242 void setGlobalModification(Enums::Isotope isotope_kind);
243
244
245 void rotate();
246 void reverse();
247 /** @brief tells if the peptide sequence is a palindrome
248 */
249 virtual bool isPalindrome() const override;
251 void removeNterAminoAcid();
252 void removeCterAminoAcid();
253
254
255 /** @brief get the peptide model in ProForma notation
256 * https://github.com/HUPO-PSI/ProForma/blob/master/README.md
257 * @return QString as described in ProForma
258 */
259 QString toProForma() const;
260
261
262 virtual const ChemicalFormula getChemicalFormula() const override;
263 virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override;
264
265 protected:
266 std::vector<Aa> m_aaVec;
267 bool m_fullC13 = false;
268 bool m_fullN15 = false;
269 bool m_fullH2 = false;
270 double m_proxyMass = -1;
271 // moiety added to peptide Nter on cleavage
273 // moiety added to peptide Cter on cleavage
277};
278
279} // namespace pappso
AaModificationP m_cleavageCterMod
Definition peptide.h:274
void replaceLeucineIsoleucine()
Definition peptide.cpp:740
PeptideSp makePeptideSp() const
Definition peptide.cpp:160
Peptide(const QString &pepstr)
Definition peptide.cpp:106
AaModificationP getCterModification() const
Definition peptide.cpp:680
void setNterModification(AaModificationP mod)
Definition peptide.cpp:649
void replaceAaModification(AaModificationP oldmod, AaModificationP newmod)
replaces all occurences of a modification by a new one
Definition peptide.cpp:474
void removeNterAminoAcid()
Definition peptide.cpp:753
std::vector< Aa >::const_reverse_iterator rend() const
Definition peptide.cpp:203
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override
Definition peptide.cpp:845
std::vector< unsigned int > getModificationPositionList(AaModificationP mod) const
get modification positions
Definition peptide.cpp:522
NoConstPeptideSp makeNoConstPeptideSp() const
Definition peptide.cpp:166
virtual int getNumberOfIsotope(Enums::Isotope isotope) const override
get the number of isotopes C13, H2, O17, O18, N15, S33, S34, S36 in the molecule
Definition peptide.cpp:423
virtual bool isPalindrome() const override
tells if the peptide sequence is a palindrome
Definition peptide.cpp:705
std::vector< Aa >::const_reverse_iterator rbegin() const
Definition peptide.cpp:197
AaModificationP getCleavageCterModification() const
Definition peptide.cpp:643
const QString getLiAbsoluteString() const
get all sequence string with modifications and converting Leucine to Isoleucine
Definition peptide.cpp:298
friend class PeptideProFormaParser
Definition peptide.h:103
void removeCterAminoAcid()
Definition peptide.cpp:770
void setGlobalModification(Enums::Isotope isotope_kind)
apply 100% isotope replacement
Definition peptide.cpp:826
void setCleavageCterModification(AaModificationP mod)
Definition peptide.cpp:621
void setCterModification(AaModificationP mod)
Definition peptide.cpp:664
AaModificationP m_NterMod
Definition peptide.h:275
virtual const ChemicalFormula getChemicalFormula() const override
Definition peptide.cpp:838
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
Definition peptide.cpp:489
AaModificationP m_cleavageNterMod
Definition peptide.h:272
const QString toAbsoluteString() const
print all modifications
Definition peptide.cpp:267
friend bool operator<(const Peptide &l, const Peptide &r)
Definition peptide.cpp:47
AaModificationP getNterModification() const
Definition peptide.cpp:686
unsigned int getNumberOfModification(AaModificationP mod) const
count modification occurence
Definition peptide.cpp:443
std::vector< double > getMassIonSerie(unsigned int charge, pappso::Enums::PeptideIon ion_type) const
get complete serie of product masses for a given charge and ion type
Definition peptide.cpp:336
const QString toString() const
print modification except internal modifications
Definition peptide.cpp:312
std::vector< double > getRawMassArray() const
get raw mass array of the amino acid sequence
Definition peptide.cpp:325
QString toProForma() const
get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README....
Definition peptide.cpp:787
AaModificationP getCleavageNterModification() const
Definition peptide.cpp:638
void removeAaModification(AaModificationP mod)
removes all occurences of a modification
Definition peptide.cpp:508
unsigned int size() const override
Definition peptide.cpp:217
virtual int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition peptide.cpp:403
void setCleavageNterModification(AaModificationP mod)
Definition peptide.cpp:605
Aa & getAa(unsigned int position)
Definition peptide.cpp:720
void addAaModificationOnAllAminoAcid(AaModificationP aaModification, Enums::AminoAcidChar amino_acid)
adds a modification to all amino acid of the sequence
Definition peptide.cpp:237
std::vector< unsigned int > getAaPositionList(char aa) const
get positions of one amino acid in peptide
Definition peptide.cpp:567
pappso_double getMass()
Definition peptide.cpp:375
std::vector< Aa >::iterator begin()
Definition peptide.cpp:173
const QString getSequence() const override
print amino acid sequence without modifications
Definition peptide.cpp:255
void addAaModification(AaModificationP aaModification, unsigned int position)
adds a modification to amino acid sequence
Definition peptide.cpp:222
std::vector< Aa >::iterator end()
Definition peptide.cpp:179
double m_proxyMass
Definition peptide.h:270
friend bool operator==(const Peptide &l, const Peptide &r)
Definition peptide.cpp:53
AaModificationP m_CterMod
Definition peptide.h:276
std::vector< Aa > m_aaVec
Definition peptide.h:266
unsigned int countModificationOnAa(AaModificationP mod, const std::vector< char > &aa_list) const
count modification occurence
Definition peptide.cpp:457
const Aa & getConstAa(unsigned int position) const
Definition peptide.cpp:729
#define PMSPP_LIB_DECL
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
bool peptideIonTypeIsComplement(Enums::PeptideIon ion_type_ref, Enums::PeptideIon ion_type)
tells if an ion type is the complement ion of the other
Definition peptide.cpp:70
PeptideIonNter
Definition peptide.h:73
std::shared_ptr< const Peptide > PeptideSp
PeptideDirection
Definition peptide.h:47
PeptideIonCter
Definition peptide.h:86
const AaModification * AaModificationP
double pappso_double
A type definition for doubles.
Definition types.h:60
PeptideDirection getPeptideIonDirection(Enums::PeptideIon ion_type)
get the direction of a peptide ion
Definition peptide.cpp:97
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:87
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:98