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{
101 protected:
102 std::vector<Aa> m_aaVec;
103 pappso_double m_proxyMass = -1;
104
105 public:
106 Peptide(const QString &pepstr);
107 virtual ~Peptide();
108 Peptide(const Peptide &peptide);
109 friend bool
110 operator<(const Peptide &l, const Peptide &r)
111 {
112 return (l.m_aaVec < r.m_aaVec);
113 }
114 friend bool
115 operator==(const Peptide &l, const Peptide &r)
116 {
117 return (l.m_aaVec == r.m_aaVec);
118 }
119
120
121 Peptide(Peptide &&toCopy);
122
123 PeptideSp makePeptideSp() const;
124 NoConstPeptideSp makeNoConstPeptideSp() const;
125
126 /** @brief adds a modification to amino acid sequence
127 * @param aaModification pointer on modification to add
128 * @param position position in the amino acid sequence (starts at 0)
129 * */
130 void addAaModification(AaModificationP aaModification, unsigned int position);
131
132 /** @brief adds a modification to all amino acid of the sequence
133 * @param aaModification pointer on modification to add
134 * @param AminoAcidChar amino_acid to apply the modification
135 * */
136 void addAaModificationOnAllAminoAcid(AaModificationP aaModification,
137 AminoAcidChar amino_acid);
138
139 std::vector<Aa>::iterator begin();
140
141 std::vector<Aa>::iterator end();
142
143 std::vector<Aa>::const_iterator begin() const;
144
145 std::vector<Aa>::const_iterator end() const;
146
147 std::vector<Aa>::const_reverse_iterator rbegin() const;
148
149 std::vector<Aa>::const_reverse_iterator rend() const;
150
151 Aa &getAa(unsigned int position);
152 const Aa &getConstAa(unsigned int position) const;
153
154
155 pappso_double getMass();
156 pappso_double getMass() const override;
157
158 virtual int getNumberOfAtom(AtomIsotopeSurvey atom) const override;
159 virtual int getNumberOfIsotope(Isotope isotope) const override;
160
161 /** \brief print amino acid sequence without modifications */
162 const QString getSequence() const override;
163 unsigned int size() const override;
164
165 /** @brief count modification occurence
166 * @param mod modification to look for
167 * @result number of occurences
168 */
169 unsigned int getNumberOfModification(AaModificationP mod) const;
170
171 /** @brief count modification occurence
172 * @param mod modification to look for
173 * @param aa_list amino acid list targets (one letter code)
174 * @result number of occurences
175 */
176 unsigned int countModificationOnAa(AaModificationP mod,
177 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 /** @brief removes all occurences of a modification
186 * @param mod modification to remove
187 */
188 void removeAaModification(AaModificationP mod);
189
190 /** @brief get modification positions
191 * @param mod modification to look for
192 * @result vector containing positions (from 0 to size-1)
193 */
194 std::vector<unsigned int>
195 getModificationPositionList(AaModificationP mod) const;
196
197 /** @brief get modification positions
198 * @param mod modification to look for
199 * @param aa_list amino acid list targets (one letter code)
200 * @result vector containing positions (from 0 to size-1)
201 */
202 std::vector<unsigned int>
203 getModificationPositionList(AaModificationP mod,
204 const std::vector<char> &aa_list) const;
205
206 /** @brief get positions of one amino acid in peptide
207 * @param aa the one letter code of the amino acid
208 * @result vector containing positions (from 0 to size-1) */
209 std::vector<unsigned int> getAaPositionList(char aa) const;
210 std::vector<unsigned int> getAaPositionList(std::list<char> list_aa) const;
211
212 /** \brief print modification except internal modifications */
213 const QString toString() const;
214 /** \brief print all modifications */
215 const QString toAbsoluteString() const;
216 /** \brief get all sequence string with modifications and converting Leucine
217 * to Isoleucine */
218 const QString getLiAbsoluteString() const;
219
220 AaModificationP getInternalNterModification() const;
221 AaModificationP getInternalCterModification() const;
222 void removeInternalNterModification();
223 void removeInternalCterModification();
224
225 void setInternalNterModification(AaModificationP mod);
226 void setInternalCterModification(AaModificationP mod);
227
228
229 void rotate();
230 void reverse();
231 /** @brief tells if the peptide sequence is a palindrome
232 */
233 virtual bool isPalindrome() const override;
234 void replaceLeucineIsoleucine();
235 void removeNterAminoAcid();
236 void removeCterAminoAcid();
237};
238
239
240} // namespace pappso
friend bool operator==(const Peptide &l, const Peptide &r)
Definition peptide.h:115
std::vector< Aa > m_aaVec
Definition peptide.h:102
#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:425
AminoAcidChar
Definition types.h:159
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:294
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