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
73{
74 b,
75 bstar,
76 bo,
77 a,
78 astar,
79 ao,
80 bp,
81 c
82};
83
84
86{
87 y,
88 ystar,
89 yo,
90 z,
91 yp,
92 x
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;
116 NoConstPeptideSp makeNoConstPeptideSp() 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 * */
128 void addAaModificationOnAllAminoAcid(AaModificationP aaModification,
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
156 pappso_double getMass();
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 */
183 void replaceAaModification(AaModificationP oldmod, AaModificationP newmod);
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 */
192 void replaceAaModificationOnAminoAcid(Enums::AminoAcidChar aa,
195
196 /** @brief removes all occurences of a modification
197 * @param mod modification to remove
198 */
199 void removeAaModification(AaModificationP mod);
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
229 void setCleavageNterModification(AaModificationP mod);
230 void setCleavageCterModification(AaModificationP mod);
231 AaModificationP getCleavageNterModification() const;
232 AaModificationP getCleavageCterModification() const;
233 void setNterModification(AaModificationP mod);
234 void setCterModification(AaModificationP mod);
235 AaModificationP getNterModification() const;
236 AaModificationP getCterModification() const;
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;
250 void replaceLeucineIsoleucine();
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
272 AaModificationP m_cleavageNterMod = nullptr;
273 // moiety added to peptide Cter on cleavage
274 AaModificationP m_cleavageCterMod = nullptr;
275 AaModificationP m_NterMod = nullptr;
276 AaModificationP m_CterMod = nullptr;
277};
278
279} // namespace pappso
std::vector< Aa > m_aaVec
Definition peptide.h:266
#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
bool operator<(Aa const &l, Aa const &r)
Definition aa.cpp:292
PeptideIonNter
Definition peptide.h:73
std::shared_ptr< const Peptide > PeptideSp
PeptideDirection
Definition peptide.h:47
PeptideIonCter
Definition peptide.h:86
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
bool operator==(Aa const &l, Aa const &r)
Definition aa.cpp:286
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:98