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>
40#include "../exportinmportconfig.h"
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 PeptideIon ion_type);
63
64
65/** \brief get the direction of a peptide ion
66 * \param ion_type the ion to test
67 * \return the peptide direction
68 */
70
72{
73 b,
74 bstar,
75 bo,
76 a,
77 astar,
78 ao,
79 bp,
80 c
81};
82
83
85{
86 y,
87 ystar,
88 yo,
89 z,
90 yp,
91 x
92};
93
94class Peptide;
95
96typedef std::shared_ptr<const Peptide> PeptideSp;
97typedef std::shared_ptr<Peptide> NoConstPeptideSp;
98
100{
102
103 public:
104 Peptide(const QString &pepstr);
105 virtual ~Peptide();
106 Peptide(const Peptide &peptide);
107 friend bool
108 operator<(const Peptide &l, const Peptide &r)
109 {
110 return (l.m_aaVec < r.m_aaVec);
111 }
112 friend bool
113 operator==(const Peptide &l, const Peptide &r)
114 {
115 return (l.m_aaVec == r.m_aaVec);
116 }
117
118
119 Peptide(Peptide &&toCopy);
120
121 PeptideSp makePeptideSp() const;
122 NoConstPeptideSp makeNoConstPeptideSp() const;
123
124 /** @brief adds a modification to amino acid sequence
125 * @param aaModification pointer on modification to add
126 * @param position position in the amino acid sequence (starts at 0)
127 * */
128 void addAaModification(AaModificationP aaModification, unsigned int position);
129
130 /** @brief adds a modification to all amino acid of the sequence
131 * @param aaModification pointer on modification to add
132 * @param AminoAcidChar amino_acid to apply the modification
133 * */
134 void addAaModificationOnAllAminoAcid(AaModificationP aaModification,
135 AminoAcidChar amino_acid);
136
137 std::vector<Aa>::iterator begin();
138
139 std::vector<Aa>::iterator end();
140
141 std::vector<Aa>::const_iterator begin() const;
142
143 std::vector<Aa>::const_iterator end() const;
144
145 std::vector<Aa>::const_reverse_iterator rbegin() const;
146
147 std::vector<Aa>::const_reverse_iterator rend() const;
148
149 Aa &getAa(unsigned int position);
150 const Aa &getConstAa(unsigned int position) const;
151
152
153 pappso_double getMass();
154 pappso_double getMass() const override;
155
156 virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override;
157 virtual int getNumberOfIsotope(Isotope isotope) const override;
158
159 /** \brief print amino acid sequence without modifications */
160 const QString getSequence() const override;
161 unsigned int size() const override;
162
163 /** @brief count modification occurence
164 * @param mod modification to look for
165 * @result number of occurences
166 */
167 unsigned int getNumberOfModification(AaModificationP mod) const;
168
169 /** @brief count modification occurence
170 * @param mod modification to look for
171 * @param aa_list amino acid list targets (one letter code)
172 * @result number of occurences
173 */
174 unsigned int countModificationOnAa(AaModificationP mod,
175 const std::vector<char> &aa_list) const;
176
177 /** @brief replaces all occurences of a modification by a new one
178 * @param oldmod modification to change
179 * @param newmod new modification
180 */
181 void replaceAaModification(AaModificationP oldmod, AaModificationP newmod);
182
183 /** @brief removes all occurences of a modification
184 * @param mod modification to remove
185 */
186 void removeAaModification(AaModificationP mod);
187
188 /** @brief get modification positions
189 * @param mod modification to look for
190 * @result vector containing positions (from 0 to size-1)
191 */
192 std::vector<unsigned int>
193 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>
201 getModificationPositionList(AaModificationP mod,
202 const std::vector<char> &aa_list) const;
203
204 /** @brief get positions of one amino acid in peptide
205 * @param aa the one letter code of the amino acid
206 * @result vector containing positions (from 0 to size-1) */
207 std::vector<unsigned int> getAaPositionList(char aa) const;
208 std::vector<unsigned int> getAaPositionList(std::list<char> list_aa) const;
209
210 /** \brief print modification except internal modifications */
211 const QString toString() const;
212 /** \brief print all modifications */
213 const QString toAbsoluteString() const;
214 /** \brief get all sequence string with modifications and converting Leucine
215 * to Isoleucine */
216 const QString getLiAbsoluteString() const;
217
218 AaModificationP getInternalNterModification() const;
219 AaModificationP getInternalCterModification() const;
220 void removeInternalNterModification();
221 void removeInternalCterModification();
222
223 void setInternalNterModification(AaModificationP mod);
224 void setInternalCterModification(AaModificationP mod);
225
226
227 void rotate();
228 void reverse();
229 /** @brief tells if the peptide sequence is a palindrome
230 */
231 virtual bool isPalindrome() const override;
232 void replaceLeucineIsoleucine();
233 void removeNterAminoAcid();
234 void removeCterAminoAcid();
235
236
237 /** @brief get the peptide model in ProForma notation
238 * https://github.com/HUPO-PSI/ProForma/blob/master/README.md
239 * @return QString as described in ProForma
240 */
241 QString toProForma() const;
242
243 protected:
244 std::vector<Aa> m_aaVec;
245 pappso_double m_proxyMass = -1;
246};
247
248
249} // namespace pappso
friend bool operator==(const Peptide &l, const Peptide &r)
Definition peptide.h:113
std::vector< Aa > m_aaVec
Definition peptide.h:244
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:429
AminoAcidChar
Definition types.h:163
PeptideDirection getPeptideIonDirection(PeptideIon ion_type)
get the direction of a peptide ion
Definition peptide.cpp:70
bool operator<(Aa const &l, Aa const &r)
Definition aa.cpp:347
PeptideIonNter
Definition peptide.h:72
std::shared_ptr< const Peptide > PeptideSp
PeptideDirection
Definition peptide.h:46
PeptideIonCter
Definition peptide.h:85
AtomIsotopeSurvey
Definition types.h:89
double pappso_double
A type definition for doubles.
Definition types.h:50
Isotope
Definition types.h:104
bool peptideIonTypeIsComplement(PeptideIon ion_type_ref, PeptideIon ion_type)
tells if an ion type is the complement ion of the other
Definition peptide.cpp:43
bool peptideIonIsNter(PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:60
std::shared_ptr< Peptide > NoConstPeptideSp
Definition peptide.h:97