libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
peptidemodificatorbase.cpp
Go to the documentation of this file.
1
/**
2
* \file protein/peptidemodificatorbase.h
3
* \date 6/12/2016
4
* \author Olivier Langella
5
* \brief base class for all peptide modification builders
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2016 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
#include "
peptidemodificatorbase.h
"
32
33
namespace
pappso
34
{
35
PeptideModificatorBase::PeptideModificatorBase
()
36
{
37
}
38
39
PeptideModificatorBase::~PeptideModificatorBase
()
40
{
41
}
42
43
void
44
PeptideModificatorBase::setModificationPattern
(QString &pattern)
45
{
46
m_pattern
.setPattern(pattern);
47
}
48
49
void
50
PeptideModificatorBase::getModificationPositionList
(std::vector<unsigned int> &position_list,
51
const
QString &peptide_str)
52
{
53
54
int
pos = 0;
55
QRegularExpressionMatch match_pattern =
m_pattern
.match(peptide_str, pos);
56
57
while
(match_pattern.hasMatch())
58
{
59
pos = match_pattern.capturedStart(0);
60
if
(match_pattern.lastCapturedIndex() == 0)
61
{
62
// no motif, just push position
63
position_list.push_back(pos);
64
pos++;
65
}
66
else
67
{
68
// there is a motif : target this position
69
pos = match_pattern.capturedStart(1);
70
if
((position_list.size() > 0) && (position_list.back() == (
unsigned
int
)pos))
71
{
72
pos = match_pattern.capturedStart(0) + 1;
73
}
74
else
75
{
76
position_list.push_back(pos);
77
pos = match_pattern.capturedStart(0) + 1;
78
}
79
}
80
match_pattern =
m_pattern
.match(peptide_str, pos);
81
}
82
}
83
84
void
85
PeptideModificatorBase::getModificationPositionList
(std::vector<unsigned int> &position_list,
86
const
Peptide
*p_peptide,
87
AaModificationP
mod,
88
unsigned
int
modification_counter)
89
{
90
91
int
pos = 0;
92
const
QString peptide_str = p_peptide->
getSequence
();
93
QRegularExpressionMatch match_pattern =
m_pattern
.match(peptide_str, pos);
94
95
while
(match_pattern.hasMatch())
96
{
97
pos = match_pattern.capturedStart(0);
98
if
(match_pattern.lastCapturedIndex() == 0)
99
{
100
// no motif, just push position
101
if
(p_peptide->
getConstAa
(pos).
getNumberOfModification
(mod) == modification_counter)
102
{
103
position_list.push_back(pos);
104
}
105
pos++;
106
}
107
else
108
{
109
// there is a motif : target this position
110
pos = match_pattern.capturedStart(1);
111
if
((position_list.size() > 0) && (position_list.back() == (
unsigned
int
)pos))
112
{
113
pos = match_pattern.capturedStart(0) + 1;
114
}
115
else
116
{
117
if
(p_peptide->
getConstAa
(pos).
getNumberOfModification
(mod) == modification_counter)
118
{
119
position_list.push_back(pos);
120
}
121
pos = match_pattern.capturedStart(0) + 1;
122
}
123
}
124
match_pattern =
m_pattern
.match(peptide_str, pos);
125
}
126
}
127
}
// namespace pappso
pappso::Aa::getNumberOfModification
unsigned int getNumberOfModification(AaModificationP mod) const
Definition
aa.cpp:233
pappso::PeptideModificatorBase::PeptideModificatorBase
PeptideModificatorBase()
Definition
peptidemodificatorbase.cpp:35
pappso::PeptideModificatorBase::~PeptideModificatorBase
virtual ~PeptideModificatorBase()
Definition
peptidemodificatorbase.cpp:39
pappso::PeptideModificatorBase::setModificationPattern
virtual void setModificationPattern(QString &pattern) final
set the pattern on which the modification will be applied (usually the list of concerned AA)
Definition
peptidemodificatorbase.cpp:44
pappso::PeptideModificatorBase::m_pattern
QRegularExpression m_pattern
Definition
peptidemodificatorbase.h:66
pappso::PeptideModificatorBase::getModificationPositionList
virtual void getModificationPositionList(std::vector< unsigned int > &position_list, const QString &peptide_str) final
Definition
peptidemodificatorbase.cpp:50
pappso::Peptide
Definition
peptide.h:102
pappso::Peptide::getSequence
const QString getSequence() const override
print amino acid sequence without modifications
Definition
peptide.cpp:255
pappso::Peptide::getConstAa
const Aa & getConstAa(unsigned int position) const
Definition
peptide.cpp:729
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::AaModificationP
const AaModification * AaModificationP
Definition
aamodification.h:52
peptidemodificatorbase.h
base class for all peptide modification builders
pappsomspp
core
protein
peptidemodificatorbase.cpp
Generated on
for libpappsomspp by
1.17.0