Line |
Branch |
Exec |
Source |
1 |
|
|
/* BEGIN software license |
2 |
|
|
* |
3 |
|
|
* MsXpertSuite - mass spectrometry software suite |
4 |
|
|
* ----------------------------------------------- |
5 |
|
|
* Copyright(C) 2009,...,2018 Filippo Rusconi |
6 |
|
|
* |
7 |
|
|
* http://www.msxpertsuite.org |
8 |
|
|
* |
9 |
|
|
* This file is part of the MsXpertSuite project. |
10 |
|
|
* |
11 |
|
|
* The MsXpertSuite project is the successor of the massXpert project. This |
12 |
|
|
* project now includes various independent modules: |
13 |
|
|
* |
14 |
|
|
* - massXpert, model polymer chemistries and simulate mass spectrometric data; |
15 |
|
|
* - mineXpert, a powerful TIC chromatogram/mass spectrum viewer/miner; |
16 |
|
|
* |
17 |
|
|
* This program is free software: you can redistribute it and/or modify |
18 |
|
|
* it under the terms of the GNU General Public License as published by |
19 |
|
|
* the Free Software Foundation, either version 3 of the License, or |
20 |
|
|
* (at your option) any later version. |
21 |
|
|
* |
22 |
|
|
* This program is distributed in the hope that it will be useful, |
23 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 |
|
|
* GNU General Public License for more details. |
26 |
|
|
* |
27 |
|
|
* You should have received a copy of the GNU General Public License |
28 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
29 |
|
|
* |
30 |
|
|
* END software license |
31 |
|
|
*/ |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/////////////////////// Local includes |
35 |
|
|
#include "ChemicalGroupRule.hpp" |
36 |
|
|
|
37 |
|
|
|
38 |
|
|
namespace MsXpS |
39 |
|
|
{ |
40 |
|
|
|
41 |
|
|
namespace libXpertMass |
42 |
|
|
{ |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
/*! |
46 |
|
|
\class MsXpS::libXpertMass::ChemicalGroupRule |
47 |
|
|
\inmodule libXpertMass |
48 |
|
|
\ingroup PolChemDefBuildingdBlocks |
49 |
|
|
\inheaderfile ChemicalGroupRule.hpp |
50 |
|
|
|
51 |
|
|
\brief The ChemicalGroupRule class provides a model for refining the |
52 |
|
|
acido-basic behaviour of a chemical group of either a \l Monomer object or of a |
53 |
|
|
\l Modif object. |
54 |
|
|
|
55 |
|
|
In an pkaphpidata definition file, the following xml structure |
56 |
|
|
is encountered: |
57 |
|
|
|
58 |
|
|
\code |
59 |
|
|
<pkaphpidata> |
60 |
|
|
<monomers> |
61 |
|
|
<monomer> |
62 |
|
|
<code>A</code> |
63 |
|
|
<mnmchemgroup> |
64 |
|
|
<name>N-term NH2</name> |
65 |
|
|
<pka>9.6</pka> |
66 |
|
|
<acidcharged>TRUE</acidcharged> |
67 |
|
|
<polrule>left_trapped</polrule> |
68 |
|
|
<chemgrouprule> |
69 |
|
|
<entity>LE_PLM_MODIF</entity> |
70 |
|
|
<name>Acetylation</name> |
71 |
|
|
<outcome>LOST</outcome> |
72 |
|
|
</chemgrouprule> |
73 |
|
|
</mnmchemgroup> |
74 |
|
|
<mnmchemgroup> |
75 |
|
|
<name>C-term COOH</name> |
76 |
|
|
<pka>2.35</pka> |
77 |
|
|
<acidcharged>FALSE</acidcharged> |
78 |
|
|
<polrule>right_trapped</polrule> |
79 |
|
|
</mnmchemgroup> |
80 |
|
|
</monomer> |
81 |
|
|
<monomer> |
82 |
|
|
<code>C</code> |
83 |
|
|
<mnmchemgroup> |
84 |
|
|
<name>N-term NH2</name> |
85 |
|
|
<pka>9.6</pka> |
86 |
|
|
<acidcharged>TRUE</acidcharged> |
87 |
|
|
<polrule>left_trapped</polrule> |
88 |
|
|
<chemgrouprule> |
89 |
|
|
<entity>LE_PLM_MODIF</entity> |
90 |
|
|
<name>Acetylation</name> |
91 |
|
|
<outcome>LOST</outcome> |
92 |
|
|
</chemgrouprule> |
93 |
|
|
</mnmchemgroup> |
94 |
|
|
<mnmchemgroup> |
95 |
|
|
<name>C-term COOH</name> |
96 |
|
|
<pka>2.35</pka> |
97 |
|
|
<acidcharged>FALSE</acidcharged> |
98 |
|
|
<polrule>right_trapped</polrule> |
99 |
|
|
</mnmchemgroup> |
100 |
|
|
<mnmchemgroup> |
101 |
|
|
<name>Lateral SH2</name> |
102 |
|
|
<pka>8.3</pka> |
103 |
|
|
<acidcharged>FALSE</acidcharged> |
104 |
|
|
<polrule>never_trapped</polrule> |
105 |
|
|
</mnmchemgroup> |
106 |
|
|
</monomer> |
107 |
|
|
..... |
108 |
|
|
<modifs> |
109 |
|
|
<modif> |
110 |
|
|
<name>Phosphorylation</name> |
111 |
|
|
<mdfchemgroup> |
112 |
|
|
<name>none_set</name> |
113 |
|
|
<pka>1.2</pka> |
114 |
|
|
<acidcharged>FALSE</acidcharged> |
115 |
|
|
</mdfchemgroup> |
116 |
|
|
<mdfchemgroup> |
117 |
|
|
<name>none_set</name> |
118 |
|
|
<pka>6.5</pka> |
119 |
|
|
<acidcharged>FALSE</acidcharged> |
120 |
|
|
</mdfchemgroup> |
121 |
|
|
</modif> |
122 |
|
|
</modifs> |
123 |
|
|
</pkaphpidata> |
124 |
|
|
\endcode |
125 |
|
|
|
126 |
|
|
\sa ChemicalGroup, |
127 |
|
|
*/ |
128 |
|
|
|
129 |
|
|
|
130 |
|
|
/*! |
131 |
|
|
\enum MsXpS::libXpertMass::ChemicalGroupRuleFate |
132 |
|
|
|
133 |
|
|
This enum specifies how the chemical group behaves when the chemical entity |
134 |
|
|
that it holds polymerizes into a \l Polymer. |
135 |
|
|
|
136 |
|
|
This example clarifies the concept: |
137 |
|
|
|
138 |
|
|
\code |
139 |
|
|
<monomer> |
140 |
|
|
<code>C</code> |
141 |
|
|
<mnmchemgroup> |
142 |
|
|
<name>N-term NH2</name> |
143 |
|
|
<pka>9.6</pka> |
144 |
|
|
<acidcharged>TRUE</acidcharged> |
145 |
|
|
<polrule>left_trapped</polrule> |
146 |
|
|
<chemgrouprule> |
147 |
|
|
<entity>LE_PLM_MODIF</entity> |
148 |
|
|
<name>Acetylation</name> |
149 |
|
|
<outcome>LOST</outcome> |
150 |
|
|
</chemgrouprule> |
151 |
|
|
</mnmchemgroup> |
152 |
|
|
\endcode |
153 |
|
|
|
154 |
|
|
When the Cysteine's amino group is modified because the Cys residue |
155 |
|
|
on on the N-terminal end of the polymer, if it gets acetylated, then the amino |
156 |
|
|
group is lost because it is trapped in the amide bond. It is thus not accounted |
157 |
|
|
for when computing the pI of the protein. |
158 |
|
|
|
159 |
|
|
\value LOST |
160 |
|
|
The chemical group is lost upon modification of the \l Monomer. |
161 |
|
|
\value PRESERVED |
162 |
|
|
The chemical group is preserved upon modification of the \l Monomer. |
163 |
|
|
*/ |
164 |
|
|
|
165 |
|
|
/*! |
166 |
|
|
\variable MsXpS::libXpertMass::ChemicalGroupRule::m_name |
167 |
|
|
|
168 |
|
|
\brief The name of the ChemicalGroupRule instance. |
169 |
|
|
*/ |
170 |
|
|
|
171 |
|
|
/*! |
172 |
|
|
\variable MsXpS::libXpertMass::ChemicalGroupRule::m_entity |
173 |
|
|
|
174 |
|
|
\brief The entity of the ChemicalGroupRule instance, like LE_PLM_MODIF for |
175 |
|
|
\e{left end polymer modification}. |
176 |
|
|
*/ |
177 |
|
|
|
178 |
|
|
/*! |
179 |
|
|
\variable MsXpS::libXpertMass::ChemicalGroupRule::m_chemicalGroupFate |
180 |
|
|
|
181 |
|
|
\brief The fate of the ChemicalGroupRule instance. |
182 |
|
|
|
183 |
|
|
\sa MsXpS::libXpertMass::ChemicalGroupRuleFate |
184 |
|
|
*/ |
185 |
|
|
|
186 |
|
|
/*! |
187 |
|
|
\brief Constructs a ChemicalGroupRule instance. |
188 |
|
|
|
189 |
|
|
\list |
190 |
|
|
\li \a name: The name of this ChemicalGroupRule instance. |
191 |
|
|
\li \a entity: The entity of this ChemicalGroupRule instance. |
192 |
|
|
\li \a fate: The fate of this ChemicalGroupRule instance. |
193 |
|
|
\endlist |
194 |
|
|
*/ |
195 |
|
✗ |
ChemicalGroupRule::ChemicalGroupRule(QString name, |
196 |
|
|
QString entity, |
197 |
|
✗ |
ChemicalGroupRuleFate fate) |
198 |
|
✗ |
: m_name(name), m_entity(entity), m_chemicalGroupFate(fate) |
199 |
|
|
{ |
200 |
|
✗ |
Q_ASSERT(m_chemicalGroupFate == ChemicalGroupRuleFate::LOST || |
201 |
|
|
m_chemicalGroupFate == ChemicalGroupRuleFate::PRESERVED); |
202 |
|
✗ |
} |
203 |
|
|
|
204 |
|
|
/*! |
205 |
|
|
\brief Sets the \a name. |
206 |
|
|
*/ |
207 |
|
|
void |
208 |
|
✗ |
ChemicalGroupRule::setName(QString name) |
209 |
|
|
{ |
210 |
|
✗ |
m_name = name; |
211 |
|
✗ |
} |
212 |
|
|
|
213 |
|
|
|
214 |
|
|
/*! |
215 |
|
|
\brief Returns the name. |
216 |
|
|
*/ |
217 |
|
|
QString |
218 |
|
✗ |
ChemicalGroupRule::name() |
219 |
|
|
{ |
220 |
|
✗ |
return m_name; |
221 |
|
|
} |
222 |
|
|
|
223 |
|
|
|
224 |
|
|
/*! |
225 |
|
|
\brief Sets the \a entity. |
226 |
|
|
*/ |
227 |
|
|
void |
228 |
|
✗ |
ChemicalGroupRule::setEntity(QString entity) |
229 |
|
|
{ |
230 |
|
✗ |
m_entity = entity; |
231 |
|
✗ |
} |
232 |
|
|
|
233 |
|
|
/*! |
234 |
|
|
\brief Returns the entity. |
235 |
|
|
*/ |
236 |
|
|
QString |
237 |
|
✗ |
ChemicalGroupRule::entity() |
238 |
|
|
{ |
239 |
|
✗ |
return m_entity; |
240 |
|
|
} |
241 |
|
|
|
242 |
|
|
/*! |
243 |
|
|
\brief Sets the \a fate. |
244 |
|
|
*/ |
245 |
|
|
void |
246 |
|
✗ |
ChemicalGroupRule::setFate(ChemicalGroupRuleFate fate) |
247 |
|
|
{ |
248 |
|
✗ |
m_chemicalGroupFate = fate; |
249 |
|
✗ |
} |
250 |
|
|
|
251 |
|
|
/*! |
252 |
|
|
\brief Returns the fate. |
253 |
|
|
*/ |
254 |
|
|
ChemicalGroupRuleFate |
255 |
|
✗ |
ChemicalGroupRule::fate() |
256 |
|
|
{ |
257 |
|
✗ |
return m_chemicalGroupFate; |
258 |
|
|
} |
259 |
|
|
|
260 |
|
|
|
261 |
|
|
/*! |
262 |
|
|
\brief Parses the ChemicalGroupRule XML \a element. |
263 |
|
|
|
264 |
|
|
Upon parsing of the \a element, its data are validated and set to this |
265 |
|
|
ChemicalGroupRule instance, thus essentially initializing it. |
266 |
|
|
|
267 |
|
|
Returns true if parsing and validation were successful, false otherwise. |
268 |
|
|
*/ |
269 |
|
|
bool |
270 |
|
✗ |
ChemicalGroupRule::renderXmlElement(const QDomElement &element) |
271 |
|
|
{ |
272 |
|
✗ |
QDomElement child; |
273 |
|
|
|
274 |
|
|
// In an acidobasic definition file, the following xml structure |
275 |
|
|
// is encountered: |
276 |
|
|
|
277 |
|
|
// <monomer> |
278 |
|
|
// <code>C</code> |
279 |
|
|
// <mnmchemgroup> |
280 |
|
|
// <name>N-term NH2</name> |
281 |
|
|
// <pka>9.6</pka> |
282 |
|
|
// <acidcharged>TRUE</acidcharged> |
283 |
|
|
// <polrule>left_trapped</polrule> |
284 |
|
|
// <chemgrouprule> |
285 |
|
|
// <entity>LE_PLM_MODIF</entity> |
286 |
|
|
// <name>Acetylation</name> |
287 |
|
|
// <outcome>LOST</outcome> |
288 |
|
|
// </chemgrouprule> |
289 |
|
|
// </mnmchemgroup> |
290 |
|
|
|
291 |
|
|
// The relevant DTD line is: |
292 |
|
|
// <!ELEMENT chemgrouprule(entity,name,outcome)> |
293 |
|
|
|
294 |
|
|
// And the element the parameter points to is: |
295 |
|
|
|
296 |
|
|
// <chemgrouprule> |
297 |
|
|
|
298 |
|
|
// Which means that element.tagName() == "chemgrouprule" and that we'll |
299 |
|
|
// have to go one step down to the first child of the current node |
300 |
|
|
// in order to get to the <entity> element. |
301 |
|
|
|
302 |
|
✗ |
if(element.tagName() != "chemgrouprule") |
303 |
|
✗ |
return false; |
304 |
|
|
|
305 |
|
✗ |
child = element.firstChildElement("entity"); |
306 |
|
|
|
307 |
|
✗ |
if(child.isNull()) |
308 |
|
✗ |
return false; |
309 |
|
|
|
310 |
|
✗ |
m_entity = child.text(); |
311 |
|
|
|
312 |
|
✗ |
child = child.nextSiblingElement(); |
313 |
|
|
|
314 |
|
✗ |
if(child.isNull() || child.tagName() != "name") |
315 |
|
✗ |
return false; |
316 |
|
|
|
317 |
|
✗ |
m_name = child.text(); |
318 |
|
|
|
319 |
|
✗ |
child = child.nextSiblingElement(); |
320 |
|
|
|
321 |
|
✗ |
if(child.isNull() || child.tagName() != "outcome") |
322 |
|
✗ |
return false; |
323 |
|
|
|
324 |
|
✗ |
if(child.text() == "LOST") |
325 |
|
✗ |
m_chemicalGroupFate = ChemicalGroupRuleFate::LOST; |
326 |
|
✗ |
else if(child.text() == "PRESERVED") |
327 |
|
✗ |
m_chemicalGroupFate = ChemicalGroupRuleFate::PRESERVED; |
328 |
|
|
else |
329 |
|
✗ |
return false; |
330 |
|
|
|
331 |
|
✗ |
return true; |
332 |
|
✗ |
} |
333 |
|
|
|
334 |
|
|
} // namespace libXpertMass |
335 |
|
|
|
336 |
|
|
} // namespace MsXpS |
337 |
|
|
|