libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
peptidevariablemodificationreplacement.cpp
Go to the documentation of this file.
1
/**
2
* \file protein/peptidevariablemodificationreplacement.h
3
* \date 5/12/2016
4
* \author Olivier Langella
5
* \brief potential replacement of a modification by an other
6
*/
7
/*******************************************************************************
8
* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
9
*
10
* This file is part of the PAPPSOms++ library.
11
*
12
* PAPPSOms++ is free software: you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation, either version 3 of the License, or
15
* (at your option) any later version.
16
*
17
* PAPPSOms++ is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License
23
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
24
*
25
* Contributors:
26
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
27
*implementation
28
******************************************************************************/
29
30
#include "
peptidevariablemodificationreplacement.h
"
31
32
33
namespace
pappso
34
{
35
PeptideVariableModificationReplacement::PeptideVariableModificationReplacement
(
36
AaModificationP
mod_before,
AaModificationP
mod_after)
37
:
PeptideVariableModificationBuilder
(mod_before)
38
{
39
mp_modAfter
= mod_after;
40
/** this forces to check that the targetted modified sites really has the
41
* mod_before */
42
m_modificationCount
= 1;
43
}
44
45
PeptideVariableModificationReplacement::~PeptideVariableModificationReplacement
()
46
{
47
}
48
49
50
void
51
PeptideVariableModificationReplacement::replaceModificationsAtPosition
(
Peptide
&new_peptide,
52
unsigned
int
position)
53
{
54
// replace all mod_before by mod_after :
55
Aa
&aa = new_peptide.
getAa
(position);
56
aa.removeAaModification(
mp_mod
);
57
unsigned
int
i = 0;
58
while
(i <
m_modificationCount
)
59
{
60
aa.addAaModification(
mp_modAfter
);
61
i++;
62
}
63
}
64
65
66
void
67
PeptideVariableModificationReplacement::setPeptideSp
(std::int8_t sequence_database_id,
68
const
ProteinSp
&protein_sp,
69
bool
is_decoy,
70
const
PeptideSp
&peptide_sp_original,
71
unsigned
int
start,
72
bool
is_nter,
73
unsigned
int
missed_cleavage_number,
74
bool
semi_enzyme)
75
{
76
// QString s = "Banana";
77
// s.replace(QRegExp("a[mn]"), "ox");
78
79
80
bool
modify_this_peptide =
true
;
81
if
(
m_isProtNterMod
||
m_isProtCterMod
)
82
{
83
modify_this_peptide =
false
;
84
if
((
m_isProtNterMod
) && (is_nter))
85
{
86
// this an Nter peptide
87
modify_this_peptide =
true
;
88
}
89
else
if
((
m_isProtCterMod
) &&
90
(protein_sp.get()->size() == (start + peptide_sp_original.get()->size())))
91
{
92
// this is a Cter peptide
93
modify_this_peptide =
true
;
94
}
95
else
if
(
m_isProtElseMod
)
96
{
97
modify_this_peptide =
true
;
98
}
99
}
100
101
if
(modify_this_peptide)
102
{
103
std::vector<unsigned int> position_list;
104
getModificationPositionList
(
105
position_list, peptide_sp_original.get(),
mp_mod
,
m_modificationCount
);
106
107
// std::vector< unsigned int > position_list =
108
// peptide_sp_original.get()->getAaPositionList(_aamp_modification_list);
109
// std::string s = "12345";
110
// no AA modification :
111
if
(
m_minNumberMod
== 0)
112
{
113
m_sink
->setPeptideSp(sequence_database_id,
114
protein_sp,
115
is_decoy,
116
peptide_sp_original,
117
start,
118
is_nter,
119
missed_cleavage_number,
120
semi_enzyme);
121
}
122
123
unsigned
int
nb_pos = position_list.size();
124
if
(nb_pos > 0)
125
{
126
// loop to find 1 to n-1 AA modification combinations
127
unsigned
int
comb_size = 1;
128
while
((comb_size < nb_pos) && (comb_size <=
m_maxNumberMod
))
129
{
130
do
131
{
132
// std::cout << std::string(being,begin + comb_size) <<
133
// std::endl;
134
Peptide
new_peptide(*(peptide_sp_original.get()));
135
for
(
unsigned
int
i = 0; i < comb_size; i++)
136
{
137
// new_peptide.addAaModification(mp_mod,position_list[i]);
138
this->
replaceModificationsAtPosition
(new_peptide, position_list[i]);
139
}
140
PeptideSp
new_peptide_sp = new_peptide.
makePeptideSp
();
141
m_sink
->setPeptideSp(sequence_database_id,
142
protein_sp,
143
is_decoy,
144
new_peptide_sp,
145
start,
146
is_nter,
147
missed_cleavage_number,
148
semi_enzyme);
149
}
150
while
(
next_combination
(
151
position_list.begin(), position_list.begin() + comb_size, position_list.end()));
152
comb_size++;
153
}
154
155
if
(nb_pos <=
m_maxNumberMod
)
156
{
157
// the last combination : all aa are modified :
158
Peptide
new_peptide(*(peptide_sp_original.get()));
159
for
(
unsigned
int
i = 0; i < nb_pos; i++)
160
{
161
// new_peptide.addAaModification(mp_mod,position_list[i]);
162
163
this->
replaceModificationsAtPosition
(new_peptide, position_list[i]);
164
}
165
PeptideSp
new_peptide_sp = new_peptide.
makePeptideSp
();
166
m_sink
->setPeptideSp(sequence_database_id,
167
protein_sp,
168
is_decoy,
169
new_peptide_sp,
170
start,
171
is_nter,
172
missed_cleavage_number,
173
semi_enzyme);
174
}
175
}
176
}
177
else
178
{
179
// no modification
180
m_sink
->setPeptideSp(sequence_database_id,
181
protein_sp,
182
is_decoy,
183
peptide_sp_original,
184
start,
185
is_nter,
186
missed_cleavage_number,
187
semi_enzyme);
188
}
189
}
190
191
}
// namespace pappso
pappso::Aa
Definition
aa.h:45
pappso::PeptideModificatorBase::getModificationPositionList
virtual void getModificationPositionList(std::vector< unsigned int > &position_list, const QString &peptide_str) final
Definition
peptidemodificatorbase.cpp:50
pappso::PeptideVariableModificationBuilder::mp_mod
AaModificationP mp_mod
Definition
peptidevariablemodificationbuilder.h:104
pappso::PeptideVariableModificationBuilder::m_maxNumberMod
unsigned int m_maxNumberMod
Definition
peptidevariablemodificationbuilder.h:108
pappso::PeptideVariableModificationBuilder::m_isProtNterMod
bool m_isProtNterMod
Definition
peptidevariablemodificationbuilder.h:113
pappso::PeptideVariableModificationBuilder::m_sink
PeptideModificatorInterface * m_sink
Definition
peptidevariablemodificationbuilder.h:103
pappso::PeptideVariableModificationBuilder::m_modificationCount
unsigned int m_modificationCount
Definition
peptidevariablemodificationbuilder.h:110
pappso::PeptideVariableModificationBuilder::m_isProtElseMod
bool m_isProtElseMod
Definition
peptidevariablemodificationbuilder.h:117
pappso::PeptideVariableModificationBuilder::next_combination
static bool next_combination(const std::vector< unsigned int >::iterator first, std::vector< unsigned int >::iterator k, const std::vector< unsigned int >::iterator last)
Definition
peptidevariablemodificationbuilder.cpp:30
pappso::PeptideVariableModificationBuilder::m_minNumberMod
unsigned int m_minNumberMod
Definition
peptidevariablemodificationbuilder.h:106
pappso::PeptideVariableModificationBuilder::PeptideVariableModificationBuilder
PeptideVariableModificationBuilder(AaModificationP mod)
Definition
peptidevariablemodificationbuilder.cpp:72
pappso::PeptideVariableModificationBuilder::m_isProtCterMod
bool m_isProtCterMod
Definition
peptidevariablemodificationbuilder.h:115
pappso::PeptideVariableModificationReplacement::~PeptideVariableModificationReplacement
virtual ~PeptideVariableModificationReplacement()
Definition
peptidevariablemodificationreplacement.cpp:45
pappso::PeptideVariableModificationReplacement::PeptideVariableModificationReplacement
PeptideVariableModificationReplacement(AaModificationP mod_before, AaModificationP mod_after)
Definition
peptidevariablemodificationreplacement.cpp:35
pappso::PeptideVariableModificationReplacement::replaceModificationsAtPosition
void replaceModificationsAtPosition(Peptide &new_peptide, unsigned int position)
Definition
peptidevariablemodificationreplacement.cpp:51
pappso::PeptideVariableModificationReplacement::mp_modAfter
AaModificationP mp_modAfter
Definition
peptidevariablemodificationreplacement.h:61
pappso::PeptideVariableModificationReplacement::setPeptideSp
void setPeptideSp(std::int8_t sequence_database_id, const ProteinSp &protein_sp, bool is_decoy, const PeptideSp &peptide_sp_original, unsigned int start, bool is_nter, unsigned int missed_cleavage_number, bool semi_enzyme) override
function to give the products of modifications for a digested peptide
Definition
peptidevariablemodificationreplacement.cpp:67
pappso::Peptide
Definition
peptide.h:102
pappso::Peptide::makePeptideSp
PeptideSp makePeptideSp() const
Definition
peptide.cpp:160
pappso::Peptide::getAa
Aa & getAa(unsigned int position)
Definition
peptide.cpp:720
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition
aamodification.h:48
pappso::AaModificationP
const AaModification * AaModificationP
Definition
aamodification.h:52
pappso::ProteinSp
std::shared_ptr< const Protein > ProteinSp
shared pointer on a Protein object
Definition
protein.h:47
peptidevariablemodificationreplacement.h
potential replacement of a modification by an other
pappsomspp
core
protein
peptidevariablemodificationreplacement.cpp
Generated on
for libpappsomspp by
1.17.0