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
81
82
84{
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;
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 * */
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
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 */
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 */
183
184 /** @brief removes all occurences of a modification
185 * @param mod modification to remove
186 */
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
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;
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
261 // moiety added to peptide Cter on cleavage
265};
266
267} // namespace pappso
AaModificationP m_cleavageCterMod
Definition peptide.h:262
void replaceLeucineIsoleucine()
Definition peptide.cpp:687
PeptideSp makePeptideSp() const
Definition peptide.cpp:158
Peptide(const QString &pepstr)
Definition peptide.cpp:104
AaModificationP getCterModification() const
Definition peptide.cpp:627
void setNterModification(AaModificationP mod)
Definition peptide.cpp:596
void replaceAaModification(AaModificationP oldmod, AaModificationP newmod)
replaces all occurences of a modification by a new one
Definition peptide.cpp:421
void removeNterAminoAcid()
Definition peptide.cpp:700
std::vector< Aa >::const_reverse_iterator rend() const
Definition peptide.cpp:201
virtual const ChemicalFormula getChemicalFormulaCharge(unsigned int charge) const override
Definition peptide.cpp:792
std::vector< unsigned int > getModificationPositionList(AaModificationP mod) const
get modification positions
Definition peptide.cpp:469
NoConstPeptideSp makeNoConstPeptideSp() const
Definition peptide.cpp:164
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:370
virtual bool isPalindrome() const override
tells if the peptide sequence is a palindrome
Definition peptide.cpp:652
std::vector< Aa >::const_reverse_iterator rbegin() const
Definition peptide.cpp:195
AaModificationP getCleavageCterModification() const
Definition peptide.cpp:590
const QString getLiAbsoluteString() const
get all sequence string with modifications and converting Leucine to Isoleucine
Definition peptide.cpp:295
friend class PeptideProFormaParser
Definition peptide.h:101
void removeCterAminoAcid()
Definition peptide.cpp:717
void setGlobalModification(Enums::Isotope isotope_kind)
apply 100% isotope replacement
Definition peptide.cpp:773
void setCleavageCterModification(AaModificationP mod)
Definition peptide.cpp:568
void setCterModification(AaModificationP mod)
Definition peptide.cpp:611
AaModificationP m_NterMod
Definition peptide.h:263
virtual const ChemicalFormula getChemicalFormula() const override
Definition peptide.cpp:785
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:436
AaModificationP m_cleavageNterMod
Definition peptide.h:260
const QString toAbsoluteString() const
print all modifications
Definition peptide.cpp:264
friend bool operator<(const Peptide &l, const Peptide &r)
Definition peptide.cpp:45
AaModificationP getNterModification() const
Definition peptide.cpp:633
unsigned int getNumberOfModification(AaModificationP mod) const
count modification occurence
Definition peptide.cpp:390
const QString toString() const
print modification except internal modifications
Definition peptide.cpp:309
QString toProForma() const
get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README....
Definition peptide.cpp:734
AaModificationP getCleavageNterModification() const
Definition peptide.cpp:585
void removeAaModification(AaModificationP mod)
removes all occurences of a modification
Definition peptide.cpp:455
unsigned int size() const override
Definition peptide.cpp:215
virtual int getNumberOfAtom(Enums::AtomIsotopeSurvey atom) const override
get the number of atom C, O, N, H in the molecule
Definition peptide.cpp:350
void setCleavageNterModification(AaModificationP mod)
Definition peptide.cpp:552
Aa & getAa(unsigned int position)
Definition peptide.cpp:667
void addAaModificationOnAllAminoAcid(AaModificationP aaModification, Enums::AminoAcidChar amino_acid)
adds a modification to all amino acid of the sequence
Definition peptide.cpp:235
std::vector< unsigned int > getAaPositionList(char aa) const
get positions of one amino acid in peptide
Definition peptide.cpp:514
pappso_double getMass()
Definition peptide.cpp:322
std::vector< Aa >::iterator begin()
Definition peptide.cpp:171
const QString getSequence() const override
print amino acid sequence without modifications
Definition peptide.cpp:252
void addAaModification(AaModificationP aaModification, unsigned int position)
adds a modification to amino acid sequence
Definition peptide.cpp:220
std::vector< Aa >::iterator end()
Definition peptide.cpp:177
double m_proxyMass
Definition peptide.h:258
friend bool operator==(const Peptide &l, const Peptide &r)
Definition peptide.cpp:51
AaModificationP m_CterMod
Definition peptide.h:264
std::vector< Aa > m_aaVec
Definition peptide.h:254
unsigned int countModificationOnAa(AaModificationP mod, const std::vector< char > &aa_list) const
count modification occurence
Definition peptide.cpp:404
const Aa & getConstAa(unsigned int position) const
Definition peptide.cpp:676
#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
PeptideIonNter
Definition peptide.h:71
std::shared_ptr< const Peptide > PeptideSp
PeptideDirection
Definition peptide.h:46
PeptideIonCter
Definition peptide.h:84
const AaModification * AaModificationP
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
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:96