libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::OboPsiModTerm Class Reference

#include <obopsimodterm.h>

Public Member Functions

 OboPsiModTerm ()
 
 ~OboPsiModTerm ()
 
 OboPsiModTerm (const OboPsiModTerm &)
 
OboPsiModTermoperator= (const OboPsiModTerm &)
 
bool isValid () const
 
bool isA (const QString &accession) const
 tells if this term "is_a" another accession
 
void setAccession (const QString &accession)
 
const QString & getAccession () const
 
bool isUnimod () const
 

Public Attributes

QString m_name
 
QString m_definition
 
QString m_psiModLabel
 
QString m_psiMsLabel
 
QString m_diffFormula
 
QString m_formula
 
QString m_origin
 
double m_diffMono
 
double m_massMono
 
QStringList m_isA
 

Private Member Functions

void parseLine (const QString &line)
 
void clearTerm ()
 

Private Attributes

friend OboPsiMod
 
friend OboPsiMs
 
friend OboUnimod
 
QString m_accession
 
bool m_isUnimod = false
 

Static Private Attributes

static QRegularExpression m_firstParse
 
static QRegularExpression m_findExactPsiModLabel
 
static QRegularExpression m_findRelatedPsiMsLabel
 
static QRegularExpression m_firstParseUnimod
 
static QRegularExpression m_parseDefinition
 

Detailed Description

Definition at line 33 of file obopsimodterm.h.

Constructor & Destructor Documentation

◆ OboPsiModTerm() [1/2]

pappso::OboPsiModTerm::OboPsiModTerm ( )

Definition at line 51 of file obopsimodterm.cpp.

52{
53}

Referenced by OboPsiModTerm(), and operator=().

◆ ~OboPsiModTerm()

pappso::OboPsiModTerm::~OboPsiModTerm ( )

Definition at line 55 of file obopsimodterm.cpp.

56{
57}

◆ OboPsiModTerm() [2/2]

pappso::OboPsiModTerm::OboPsiModTerm ( const OboPsiModTerm & other)

Definition at line 58 of file obopsimodterm.cpp.

59{
60 m_accession = other.m_accession;
61 m_name = other.m_name;
62 m_definition = other.m_definition;
63 m_psiModLabel = other.m_psiModLabel;
64 m_psiMsLabel = other.m_psiMsLabel;
65 m_diffFormula = other.m_diffFormula;
66 m_formula = other.m_formula;
67 m_origin = other.m_origin;
68
69 m_diffMono = other.m_diffMono;
70 m_massMono = other.m_massMono;
71 m_isA = other.m_isA;
72 m_isUnimod = other.m_isUnimod;
73}

References OboPsiModTerm(), m_accession, m_definition, m_diffFormula, m_diffMono, m_formula, m_isA, m_isUnimod, m_massMono, m_name, m_origin, m_psiModLabel, and m_psiMsLabel.

Member Function Documentation

◆ clearTerm()

void pappso::OboPsiModTerm::clearTerm ( )
private

Definition at line 243 of file obopsimodterm.cpp.

244{
245 m_accession = "";
246 m_name = "";
247 m_definition = "";
248 m_psiModLabel = "";
249 m_diffFormula = "";
250 m_formula = "";
251 m_diffMono = 0;
252 m_origin = "";
253 m_massMono = 0;
254 m_isA.clear();
255 m_isUnimod = false;
256}

References m_accession, m_definition, m_diffFormula, m_diffMono, m_formula, m_isA, m_isUnimod, m_massMono, m_name, m_origin, and m_psiModLabel.

◆ getAccession()

◆ isA()

bool pappso::OboPsiModTerm::isA ( const QString & accession) const

tells if this term "is_a" another accession

Returns
bool if true

Definition at line 102 of file obopsimodterm.cpp.

103{
104 return m_isA.contains(accession);
105}

References m_isA.

Referenced by pappso::ChemicalFormula::setOboPsiModTerm().

◆ isUnimod()

bool pappso::OboPsiModTerm::isUnimod ( ) const

Definition at line 277 of file obopsimodterm.cpp.

278{
279 return m_isUnimod;
280}

References m_isUnimod.

Referenced by pappso::ChemicalFormula::setOboPsiModTerm().

◆ isValid()

bool pappso::OboPsiModTerm::isValid ( ) const

Definition at line 96 of file obopsimodterm.cpp.

97{
98 return (!m_accession.isEmpty());
99}

References m_accession.

Referenced by pappso::OboTermForm::displayOboTerm().

◆ operator=()

OboPsiModTerm & pappso::OboPsiModTerm::operator= ( const OboPsiModTerm & other)

Definition at line 76 of file obopsimodterm.cpp.

77{
78 m_accession = other.m_accession;
79 m_name = other.m_name;
80 m_definition = other.m_definition;
81 m_psiModLabel = other.m_psiModLabel;
82 m_psiMsLabel = other.m_psiMsLabel;
83 m_diffFormula = other.m_diffFormula;
84 m_formula = other.m_formula;
85 m_origin = other.m_origin;
86
87 m_diffMono = other.m_diffMono;
88 m_massMono = other.m_massMono;
89 m_isA = other.m_isA;
90 m_isUnimod = other.m_isUnimod;
91 return *this;
92}

References OboPsiModTerm(), m_accession, m_definition, m_diffFormula, m_diffMono, m_formula, m_isA, m_isUnimod, m_massMono, m_name, m_origin, m_psiModLabel, and m_psiMsLabel.

◆ parseLine()

void pappso::OboPsiModTerm::parseLine ( const QString & line)
private

Definition at line 108 of file obopsimodterm.cpp.

109{
110 // qDebug() << "OboPsiModTerm::parseLine begin " << line;
111 // id: MOD:00007
112 // is_a: MOD:01441 ! natural, standard, encoded residue
113 QRegularExpressionMatch match_line = m_firstParse.match(line);
114 if(match_line.hasMatch())
115 {
116 QStringList pline = match_line.capturedTexts();
117 // qDebug() << "OboPsiModTerm::parseLine match " << pline[0] << pline[1];
118 if(pline[1] == "id")
119 {
120 setAccession(pline[2].trimmed());
121 // qDebug() << "OboPsiModTerm::parseLine accession = " << m_accession;
122 }
123 else if(pline[1] == "name")
124 {
125 m_name = pline[2].trimmed();
126 // qDebug() << "OboPsiModTerm::parseLine accession = " << m_accession;
127 }
128 else if(pline[1] == "is_a")
129 {
130 m_isA << pline[2].section(" ", 0, 0);
131 // qDebug() << "OboPsiModTerm::parseLine is_a = " << m_isA.join(" ");
132 }
133 else if(pline[1] == "xref")
134 {
135
136 // xref: DiffMono: "1.007276"
137 QRegularExpressionMatch match_subline = m_firstParse.match(pline[2]);
138 if(m_isUnimod)
139 {
140 match_subline = m_firstParseUnimod.match(pline[2]);
141 }
142 if(match_subline.hasMatch())
143 {
144 QStringList psecond = match_subline.capturedTexts();
145 if(psecond[1] == "DiffMono")
146 {
147 m_diffMono = psecond[2].replace("\"", "").toDouble();
148 // qDebug() << "OboPsiModTerm::parseLine m_diffMono = " <<
149 // m_diffMono;
150 }
151 else if(psecond[1] == "delta_mono_mass")
152 { // UNIMOD
153 // xref: delta_mono_mass "42.010565"
154 m_diffMono = psecond[2].replace("\"", "").toDouble();
155 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
156 // m_diffFormula<<"|";
157 }
158 else if(psecond[1] == "DiffFormula")
159 {
160 m_diffFormula = psecond[2].trimmed().replace("\"", "");
161 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
162 // m_diffFormula<<"|";
163 }
164
165 else if(psecond[1] == "delta_composition")
166 {
167 // UNIMOD
168 // xref: delta_composition "H(2) C(2) O"
169 m_diffFormula = psecond[2].trimmed().replace("\"", "");
170 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
171 // m_diffFormula<<"|";
172 }
173
174 else if(psecond[1] == "Formula")
175 {
176 // xref: Formula: "C 5 H 9 N 1 O 1 S 1"
177 m_formula = psecond[2].trimmed().replace("\"", "");
178 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
179 // m_diffFormula<<"|";
180 }
181 else if(psecond[1] == "Origin")
182 {
183 m_origin = psecond[2].trimmed().replace("\"", "").replace(",", "");
184 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
185 // m_diffFormula<<"|";
186 }
187 // xref: MassMono: "71.037114"
188
189 else if(psecond[1] == "MassMono")
190 {
191 bool is_ok = false;
192 double mass_mono = psecond[2].replace("\"", "").toDouble(&is_ok);
193 if(is_ok)
194 m_massMono = mass_mono;
195 else
196 m_massMono = 0;
197 // qDebug() << "OboPsiModTerm::parseLine m_diffFormula = |" <<
198 // m_diffFormula<<"|";
199 }
200 }
201 }
202 else if(pline[1] == "synonym")
203 {
204 // synonym: "Se(S)Res" EXACT PSI-MOD-label []
205 QRegularExpressionMatch match_exact_psimod = m_findExactPsiModLabel.match(pline[2]);
206 if(match_exact_psimod.hasMatch())
207 {
208 m_psiModLabel = match_exact_psimod.captured(1).trimmed().replace("\"", "");
209 // qDebug() << "OboPsiModTerm::parseLine m_psiModLabel = |" <<
210 // m_psiModLabel<<"|";
211 }
212 else
213 {
214 QRegularExpressionMatch match_related_psims = m_findRelatedPsiMsLabel.match(pline[2]);
215 if(match_related_psims.hasMatch())
216 {
217 m_psiMsLabel = match_related_psims.captured(1).trimmed().replace("\"", "");
218 // qDebug() << "OboPsiModTerm::parseLine m_psiModLabel = |" <<
219 // m_psiModLabel<<"|";
220 }
221 }
222 }
223 else if(pline[1] == "def")
224 {
225 // def: "A protein modification that modifies an L-asparagine
226 // residue." [PubMed:18688235]
227
228 QRegularExpressionMatch match_subline = m_parseDefinition.match(pline[2]);
229
230 if(match_subline.hasMatch())
231 {
232 QStringList psecond = match_subline.capturedTexts();
233 m_definition = psecond[1];
234 }
235 else
236 {
237 m_definition = pline[2];
238 }
239 }
240 }
241}
static QRegularExpression m_firstParseUnimod
void setAccession(const QString &accession)
static QRegularExpression m_firstParse
static QRegularExpression m_findRelatedPsiMsLabel
static QRegularExpression m_findExactPsiModLabel
static QRegularExpression m_parseDefinition

References line, m_definition, m_diffFormula, m_diffMono, m_findExactPsiModLabel, m_findRelatedPsiMsLabel, m_firstParse, m_firstParseUnimod, m_formula, m_isA, m_isUnimod, m_massMono, m_name, m_origin, m_parseDefinition, m_psiModLabel, m_psiMsLabel, and setAccession().

◆ setAccession()

void pappso::OboPsiModTerm::setAccession ( const QString & accession)

Member Data Documentation

◆ m_accession

QString pappso::OboPsiModTerm::m_accession
private

Definition at line 82 of file obopsimodterm.h.

Referenced by OboPsiModTerm(), clearTerm(), getAccession(), isValid(), operator=(), and setAccession().

◆ m_definition

◆ m_diffFormula

◆ m_diffMono

◆ m_findExactPsiModLabel

QRegularExpression pappso::OboPsiModTerm::m_findExactPsiModLabel
staticprivate

Definition at line 76 of file obopsimodterm.h.

Referenced by parseLine().

◆ m_findRelatedPsiMsLabel

QRegularExpression pappso::OboPsiModTerm::m_findRelatedPsiMsLabel
staticprivate

Definition at line 77 of file obopsimodterm.h.

Referenced by parseLine().

◆ m_firstParse

QRegularExpression pappso::OboPsiModTerm::m_firstParse
staticprivate

Definition at line 75 of file obopsimodterm.h.

Referenced by parseLine().

◆ m_firstParseUnimod

QRegularExpression pappso::OboPsiModTerm::m_firstParseUnimod
staticprivate

Definition at line 78 of file obopsimodterm.h.

Referenced by parseLine().

◆ m_formula

QString pappso::OboPsiModTerm::m_formula

◆ m_isA

QStringList pappso::OboPsiModTerm::m_isA

◆ m_isUnimod

bool pappso::OboPsiModTerm::m_isUnimod = false
private

Definition at line 83 of file obopsimodterm.h.

Referenced by OboPsiModTerm(), clearTerm(), isUnimod(), operator=(), parseLine(), and setAccession().

◆ m_massMono

double pappso::OboPsiModTerm::m_massMono

Definition at line 67 of file obopsimodterm.h.

Referenced by OboPsiModTerm(), clearTerm(), operator=(), and parseLine().

◆ m_name

◆ m_origin

◆ m_parseDefinition

QRegularExpression pappso::OboPsiModTerm::m_parseDefinition
staticprivate

Definition at line 79 of file obopsimodterm.h.

Referenced by parseLine().

◆ m_psiModLabel

QString pappso::OboPsiModTerm::m_psiModLabel

◆ m_psiMsLabel

QString pappso::OboPsiModTerm::m_psiMsLabel

◆ OboPsiMod

friend pappso::OboPsiModTerm::OboPsiMod
private

Definition at line 35 of file obopsimodterm.h.

◆ OboPsiMs

friend pappso::OboPsiModTerm::OboPsiMs
private

Definition at line 36 of file obopsimodterm.h.

◆ OboUnimod

friend pappso::OboPsiModTerm::OboUnimod
private

Definition at line 37 of file obopsimodterm.h.


The documentation for this class was generated from the following files: