libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
obopsimodterm.cpp
Go to the documentation of this file.
1
2/*******************************************************************************
3 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
4 *
5 * This file is part of the PAPPSOms++ library.
6 *
7 * PAPPSOms++ is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * PAPPSOms++ is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * Contributors:
21 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
22 *implementation
23 ******************************************************************************/
24
25#include <QDebug>
26#include "obopsimodterm.h"
27#include "../pappsoexception.h"
28
30 qRegisterMetaType<pappso::OboPsiModTerm>("pappso::OboPsiModTerm");
31
32inline void
34{
35 Q_INIT_RESOURCE(libpappsomsppresources);
36}
37
38
39namespace pappso
40{
41
42QRegularExpression OboPsiModTerm::m_firstParse("^([a-z,A-Z]+):\\s(.*)$");
44 "^(.*)\\sEXACT\\sPSI-MOD-label\\s\\[\\]$");
45
46// synonym: "Carbamidomethyl" RELATED PSI-MS-label []
48 "^(.*)\\sRELATED\\sPSI-MS-label\\s\\[\\]$");
49
50
54
70
73{
75 m_name = other.m_name;
80 m_origin = other.m_origin;
81
82 m_diffMono = other.m_diffMono;
83 return *this;
84}
85
86
87bool
89{
90 return (!m_accession.isEmpty());
91}
92
93void
95{
96 // qDebug() << "OboPsiModTerm::parseLine begin " << line;
97 // id: MOD:00007
98 QRegularExpressionMatch match_line = m_firstParse.match(line);
99 if(match_line.hasMatch())
100 {
101 QStringList pline = match_line.capturedTexts();
102 // qDebug() << "OboPsiModTerm::parseLine match " << pline[0] << pline[1];
103 if(pline[1] == "id")
104 {
105 m_accession = pline[2].trimmed();
106 // qDebug() << "OboPsiModTerm::parseLine accession = " << m_accession;
107 }
108 else if(pline[1] == "name")
109 {
110 m_name = pline[2].trimmed();
111 // qDebug() << "OboPsiModTerm::parseLine accession = " << m_accession;
112 }
113 else if(pline[1] == "xref")
114 {
115 // xref: DiffMono: "1.007276"
116 QRegularExpressionMatch match_subline = m_firstParse.match(pline[2]);
117 if(match_subline.hasMatch())
118 {
119 QStringList psecond = match_subline.capturedTexts();
120 if(psecond[1] == "DiffMono")
121 {
122 m_diffMono = psecond[2].replace("\"", "").toDouble();
123 // qDebug() << "OboPsiModTerm::parseLine m_diffMono = " <<
124 // m_diffMono;
125 }
126 else if(psecond[1] == "DiffFormula")
127 {
128 m_diffFormula = psecond[2].trimmed().replace("\"", "");
129 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
130 // m_diffFormula<<"|";
131 }
132 else if(psecond[1] == "Origin")
133 {
134 m_origin =
135 psecond[2].trimmed().replace("\"", "").replace(",", "");
136 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
137 // m_diffFormula<<"|";
138 }
139 }
140 }
141 else if(pline[1] == "synonym")
142 {
143 // synonym: "Se(S)Res" EXACT PSI-MOD-label []
144 QRegularExpressionMatch match_exact_psimod =
145 m_findExactPsiModLabel.match(pline[2]);
146 if(match_exact_psimod.hasMatch())
147 {
149 match_exact_psimod.captured(1).trimmed().replace("\"", "");
150 // qDebug() << "OboPsiModTerm::parseLine m_psiModLabel = |" <<
151 // m_psiModLabel<<"|";
152 }
153 else
154 {
155 QRegularExpressionMatch match_related_psims =
156 m_findRelatedPsiMsLabel.match(pline[2]);
157 if(match_related_psims.hasMatch())
158 {
160 match_related_psims.captured(1).trimmed().replace("\"", "");
161 // qDebug() << "OboPsiModTerm::parseLine m_psiModLabel = |" <<
162 // m_psiModLabel<<"|";
163 }
164 }
165 }
166 else if(pline[1] == "def")
167 {
168 // def: "A protein modification that modifies an L-asparagine
169 // residue." [PubMed:18688235]
170 m_definition = pline[2];
171 }
172 }
173}
174void
176{
177 m_accession = "";
178 m_name = "";
179 m_definition = "";
180 m_psiModLabel = "";
181 m_diffFormula = "";
182 m_diffMono = 0;
183 m_origin = "";
184}
185
186} // namespace pappso
OboPsiModTerm & operator=(const OboPsiModTerm &)
static QRegularExpression m_firstParse
void parseLine(const QString &line)
static QRegularExpression m_findRelatedPsiMsLabel
static QRegularExpression m_findExactPsiModLabel
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
void initMyResource()
int oboPsiModTermMetaTypeId