libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
peptidemodel.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/specglob/peptidemodel.cpp
3
* \date 05/10/2025
4
* \author Olivier Langella
5
* \brief SpecPeptidOMS peptide model
6
* \todo https://www.psidev.info/proforma
7
*
8
*/
9
10
11
/*
12
* SpecGlobTool, Spectra to peptide alignment tool
13
* Copyright (C) 2025 Olivier Langella
14
* <olivier.langella@universite-paris-saclay.fr>
15
*
16
* This program is free software: you can redistribute ipetide to spectrum
17
* alignmentt and/or modify it under the terms of the GNU General Public License
18
* as published by the Free Software Foundation, either version 3 of the
19
* License, or (at your option) any later version.
20
*
21
* This program is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* GNU General Public License for more details.
25
*
26
* You should have received a copy of the GNU General Public License
27
* along with this program. If not, see <http://www.gnu.org/licenses/>.
28
*
29
*/
30
31
#include "
peptidemodel.h
"
32
33
namespace
pappso
34
{
35
namespace
specpeptidoms
36
{
37
38
QString
39
AminoAcidModel::toProForma
()
const
40
{
41
if
(
m_massDifference
!= 0)
42
{
43
return
QString(
"%1[%2]"
)
44
.arg(
m_aminoAcid
.toProForma())
45
.arg(
PeptideModel::toProFormaMass
(
m_massDifference
));
46
}
47
else
48
{
49
return
m_aminoAcid
.toProForma();
50
}
51
}
52
53
QString
54
AminoAcidModel::toInterpretation
()
const
55
{
56
if
(
m_massDifference
!= 0)
57
{
58
if
(
m_skipped
)
59
{
60
return
QString(
"[%1][%2]"
)
61
.arg(
m_aminoAcid
.toString())
62
.arg(QString::number(
m_massDifference
));
63
}
64
else
65
{
66
return
QString(
"%1[%2]"
)
67
.arg(
m_aminoAcid
.toString())
68
.arg(QString::number(
m_massDifference
));
69
}
70
}
71
else
if
(
m_skipped
)
72
{
73
return
QString(
"[%1]"
).arg(
m_aminoAcid
.toString());
74
}
75
else
76
{
77
return
m_aminoAcid
.toString();
78
}
79
}
80
PeptideModel::PeptideModel
()
81
{
82
}
83
84
PeptideModel::~PeptideModel
()
85
{
86
}
87
88
void
89
PeptideModel::reset
()
90
{
91
this->clear();
92
m_cterShift
= 0;
93
m_nterShift
= 0;
94
m_precursorMass
= 0;
95
}
96
void
97
PeptideModel::setCterShift
(
double
mass_shift)
98
{
99
m_cterShift
= mass_shift;
100
}
101
102
void
103
PeptideModel::setNterShift
(
double
mass_shift)
104
{
105
m_nterShift
= mass_shift;
106
}
107
108
void
109
PeptideModel::setPrecursorMass
(
double
mass)
110
{
111
m_precursorMass
= mass;
112
}
113
114
double
115
PeptideModel::getPrecursorMass
()
const
116
{
117
return
m_precursorMass
;
118
}
119
QString
120
PeptideModel::toProFormaMass
(
double
mass)
121
{
122
if
(mass > 0)
123
{
124
return
QString(
"+%1"
).arg(QString::number(mass,
'f'
, 4));
125
}
126
else
127
{
128
return
QString(
"%1"
).arg(QString::number(mass,
'f'
, 4));
129
}
130
}
131
132
double
133
PeptideModel::getMass
()
const
134
{
135
double
mass =
m_cterShift
+
m_nterShift
+
MASSH2O
;
136
// qWarning() << mass;
137
for
(
auto
&aa : *
this
)
138
{
139
// qWarning() << aa.m_aminoAcid.toProForma();
140
mass += aa.m_aminoAcid.getMass() + aa.m_massDifference;
141
}
142
return
mass;
143
}
144
145
QString
146
PeptideModel::toProForma
()
const
147
{
148
149
double
mass_delta =
m_precursorMass
-
getMass
();
150
151
QString proforma(
"["
);
152
if
(mass_delta > 0)
153
{
154
proforma.append(
"+"
);
155
}
156
proforma.append(QString(
"%1]?"
).arg(QString::number(mass_delta,
'f'
, 4)));
157
proforma.replace(
"[+0.0000]?"
,
""
);
158
proforma.replace(
"[-0.0000]?"
,
""
);
159
160
161
// QString proforma;
162
163
if
(size() > 0)
164
{
165
if
(
m_nterShift
!= 0)
166
{
167
proforma =
'['
+
toProFormaMass
(
m_nterShift
) +
"]-"
;
168
}
169
for
(
auto
&aa : *
this
)
170
{
171
proforma.append(aa.toProForma());
172
}
173
if
(
m_cterShift
!= 0)
174
{
175
proforma =
"-["
+
toProFormaMass
(
m_cterShift
) +
']'
;
176
}
177
}
178
return
proforma;
179
}
180
QString
181
PeptideModel::toInterpretation
()
const
182
{
183
QString proforma;
184
185
if
(size() > 0)
186
{
187
if
(
m_nterShift
> 0)
188
{
189
proforma =
'['
+ QString::number(
m_nterShift
) +
"]"
;
190
}
191
for
(
auto
&aa : *
this
)
192
{
193
proforma.append(aa.toInterpretation());
194
}
195
if
(
m_cterShift
> 0)
196
{
197
proforma =
"["
+ QString::number(
m_cterShift
) +
']'
;
198
}
199
}
200
return
proforma;
201
}
202
203
double
204
PeptideModel::getNonAlignedMass
()
const
205
{
206
return
getPrecursorMass
() -
getMass
();
207
}
208
209
}
// namespace specpeptidoms
210
}
// namespace pappso
pappso::specpeptidoms::PeptideModel::toProFormaMass
static QString toProFormaMass(double mass)
Definition
peptidemodel.cpp:120
pappso::specpeptidoms::PeptideModel::PeptideModel
PeptideModel()
Definition
peptidemodel.cpp:80
pappso::specpeptidoms::PeptideModel::setNterShift
void setNterShift(double mass_shift)
Definition
peptidemodel.cpp:103
pappso::specpeptidoms::PeptideModel::m_precursorMass
double m_precursorMass
Definition
peptidemodel.h:94
pappso::specpeptidoms::PeptideModel::setCterShift
void setCterShift(double mass_shift)
Definition
peptidemodel.cpp:97
pappso::specpeptidoms::PeptideModel::getNonAlignedMass
double getNonAlignedMass() const
Return the difference between the precursor's mass and the mass modelized by the PeptideModel.
Definition
peptidemodel.cpp:204
pappso::specpeptidoms::PeptideModel::m_cterShift
double m_cterShift
Definition
peptidemodel.h:92
pappso::specpeptidoms::PeptideModel::toProForma
QString toProForma() const
Definition
peptidemodel.cpp:146
pappso::specpeptidoms::PeptideModel::m_nterShift
double m_nterShift
Definition
peptidemodel.h:93
pappso::specpeptidoms::PeptideModel::getPrecursorMass
double getPrecursorMass() const
Definition
peptidemodel.cpp:115
pappso::specpeptidoms::PeptideModel::toInterpretation
QString toInterpretation() const
Definition
peptidemodel.cpp:181
pappso::specpeptidoms::PeptideModel::setPrecursorMass
void setPrecursorMass(double mass)
Definition
peptidemodel.cpp:109
pappso::specpeptidoms::PeptideModel::getMass
double getMass() const
Definition
peptidemodel.cpp:133
pappso::specpeptidoms::PeptideModel::~PeptideModel
virtual ~PeptideModel()
Definition
peptidemodel.cpp:84
pappso::specpeptidoms::PeptideModel::reset
void reset()
Definition
peptidemodel.cpp:89
pappso::specpeptidoms
Definition
correctiontree.h:40
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::MASSH2O
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)
peptidemodel.h
pappso::specpeptidoms::AminoAcidModel::m_massDifference
double m_massDifference
Definition
peptidemodel.h:46
pappso::specpeptidoms::AminoAcidModel::toInterpretation
QString toInterpretation() const
Definition
peptidemodel.cpp:54
pappso::specpeptidoms::AminoAcidModel::m_aminoAcid
pappso::Aa m_aminoAcid
Definition
peptidemodel.h:45
pappso::specpeptidoms::AminoAcidModel::m_skipped
bool m_skipped
Definition
peptidemodel.h:47
pappso::specpeptidoms::AminoAcidModel::toProForma
QString toProForma() const
Definition
peptidemodel.cpp:39
pappsomspp
core
processing
specpeptidoms
peptidemodel.cpp
Generated on
for libpappsomspp by
1.17.0