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"
38#include "peptideinterface.h"
39#include <cstdint>
41
42namespace pappso
43{
44
45enum class PeptideDirection : std::int8_t
46{
47 Nter = 0,
48 Cter = 1
49};
50
51
52/** \brief tells if an ion is Nter
53 * \param ion_type the ion to test
54 */
56
57/** \brief tells if an ion type is the complement ion of the other
58 * \param ion_type_ref the ion type reference
59 * \param ion_type the ion to test
60 */
62
63
64/** \brief get the direction of a peptide ion
65 * \param ion_type the ion to test
66 * \return the peptide direction
67 */
69
71{
72 b,
73 bstar,
74 bo,
75 a,
76 astar,
77 ao,
78 bp,
79 c
80};
81
82
84{
85 y,
86 ystar,
87 yo,
88 z,
89 yp,
90 x
91};
92
93class Peptide;
94
95typedef std::shared_ptr<const Peptide> PeptideSp;
96typedef std::shared_ptr<Peptide> NoConstPeptideSp;
97
98
100{
102 friend bool operator<(const Peptide &l, const Peptide &r);
103 friend bool operator==(const Peptide &l, const Peptide &r);
104
105
106 public:
107 Peptide(const QString &pepstr);
108 virtual ~Peptide();
109 Peptide(const Peptide &peptide);
110
111 Peptide(Peptide &&toCopy);
112
113 PeptideSp makePeptideSp() const;
114 NoConstPeptideSp makeNoConstPeptideSp() const;
115
116 /** @brief adds a modification to amino acid sequence
117 * @param aaModification pointer on modification to add
118 * @param position position in the amino acid sequence (starts at 0)
119 * */
120 void addAaModification(AaModificationP aaModification, unsigned int position);
121
122 /** @brief adds a modification to all amino acid of the sequence
123 * @param aaModification pointer on modification to add
124 * @param Enums::AminoAcidChar amino_acid to apply the modification
125 * */
126 void addAaModificationOnAllAminoAcid(AaModificationP aaModification, Enums::AminoAcidChar amino_acid);
127
128 std::vector<Aa>::iterator begin();
129
130 std::vector<Aa>::iterator end();
131
132 std::vector<Aa>::const_iterator begin() const;
133
134 std::vector<Aa>::const_iterator end() const;
135
136 std::vector<Aa>::const_reverse_iterator rbegin() const;
137
138 std::vector<Aa>::const_reverse_iterator rend() const;
139
140 Aa &getAa(unsigned int position);
141 const Aa &getConstAa(unsigned int position) const;
142
143
144 pappso_double getMass();
145 pappso_double getMass() const override;
146
147 virtual int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override;
148 virtual int getNumberOfIsotope(Enums::Isotope isotope) const override;
149
150 /** \brief print amino acid sequence without modifications */
151 const QString getSequence() const override;
152 unsigned int size() const override;
153
154 /** @brief count modification occurence
155 * @param mod modification to look for
156 * @result number of occurences
157 */
158 unsigned int getNumberOfModification(AaModificationP mod) const;
159
160 /** @brief count modification occurence
161 * @param mod modification to look for
162 * @param aa_list amino acid list targets (one letter code)
163 * @result number of occurences
164 */
165 unsigned int countModificationOnAa(AaModificationP mod, const std::vector<char> &aa_list) const;
166
167 /** @brief replaces all occurences of a modification by a new one
168 * @param oldmod modification to change
169 * @param newmod new modification
170 */
171 void replaceAaModification(AaModificationP oldmod, AaModificationP newmod);
172
173
174 /** @brief replaces all occurences of a modification by a new one
175 * on a specific amino acid
176 * @param aa the amino acid to modify
177 * @param oldmod modification to change
178 * @param newmod new modification
179 */
180 void replaceAaModificationOnAminoAcid(Enums::AminoAcidChar aa,
183
184 /** @brief removes all occurences of a modification
185 * @param mod modification to remove
186 */
187 void removeAaModification(AaModificationP mod);
188
189 /** @brief get modification positions
190 * @param mod modification to look for
191 * @result vector containing positions (from 0 to size-1)
192 */
193 std::vector<unsigned int> getModificationPositionList(AaModificationP mod) const;
194
195 /** @brief get modification positions
196 * @param mod modification to look for
197 * @param aa_list amino acid list targets (one letter code)
198 * @result vector containing positions (from 0 to size-1)
199 */
200 std::vector<unsigned int> getModificationPositionList(AaModificationP mod,
201 const std::vector<char> &aa_list) const;
202
203 /** @brief get positions of one amino acid in peptide
204 * @param aa the one letter code of the amino acid
205 * @result vector containing positions (from 0 to size-1) */
206 std::vector<unsigned int> getAaPositionList(char aa) const;
207 std::vector<unsigned int> getAaPositionList(std::list<char> list_aa) const;
208
209 /** \brief print modification except internal modifications */
210 const QString toString() const;
211 /** \brief print all modifications */
212 const QString toAbsoluteString() const;
213 /** \brief get all sequence string with modifications and converting Leucine
214 * to Isoleucine */
215 const QString getLiAbsoluteString() const;
216
217 void setCleavageNterModification(AaModificationP mod);
218 void setCleavageCterModification(AaModificationP mod);
219 AaModificationP getCleavageNterModification() const;
220 AaModificationP getCleavageCterModification() const;
221 void setNterModification(AaModificationP mod);
222 void setCterModification(AaModificationP mod);
223 AaModificationP getNterModification() const;
224 AaModificationP getCterModification() const;
225
226
227 /** @brief apply 100% isotope replacement
228 * @todo
229 */
230 void setGlobalModification(Enums::Isotope isotope_kind);
231
232
233 void rotate();
234 void reverse();
235 /** @brief tells if the peptide sequence is a palindrome
236 */
237 virtual bool isPalindrome() const override;
238 void replaceLeucineIsoleucine();
239 void removeNterAminoAcid();
240 void removeCterAminoAcid();
241
242
243 /** @brief get the peptide model in ProForma notation
244 * https://github.com/HUPO-PSI/ProForma/blob/master/README.md
245 * @return QString as described in ProForma
246 */
247 QString toProForma() const;
248
249
250 virtual const ChemicalFormula getChemicalFormula() const override;
251 virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override;
252
253 protected:
254 std::vector<Aa> m_aaVec;
255 bool m_fullC13 = false;
256 bool m_fullN15 = false;
257 bool m_fullH2 = false;
258 double m_proxyMass = -1;
259 // moiety added to peptide Nter on cleavage
260 AaModificationP m_cleavageNterMod = nullptr;
261 // moiety added to peptide Cter on cleavage
262 AaModificationP m_cleavageCterMod = nullptr;
263 AaModificationP m_NterMod = nullptr;
264 AaModificationP m_CterMod = nullptr;
265};
266
267} // namespace pappso
std::vector< Aa > m_aaVec
Definition peptide.h:254
#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:68
bool operator<(Aa const &l, Aa const &r)
Definition aa.cpp:292
PeptideIonNter
Definition peptide.h:71
std::shared_ptr< const Peptide > PeptideSp
PeptideDirection
Definition peptide.h:46
PeptideIonCter
Definition peptide.h:84
double pappso_double
A type definition for doubles.
Definition types.h:61
PeptideDirection getPeptideIonDirection(Enums::PeptideIon ion_type)
get the direction of a peptide ion
Definition peptide.cpp:95
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:85
bool operator==(Aa const &l, Aa const &r)
Definition aa.cpp:286
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:96