libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
obotermform.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/widget/obo/obotermform/obotermform.cpp
3
* \date 20/04/2021
4
* \author Olivier Langella
5
* \brief display an obo term form
6
*/
7
8
9
/*******************************************************************************
10
* Copyright (c) 2021 Olivier Langella
11
*<Olivier.Langella@universite-paris-saclay.fr>.
12
*
13
* This file is part of the PAPPSOms++ library.
14
*
15
* PAPPSOms++ is free software: you can redistribute it and/or modify
16
* it under the terms of the GNU General Public License as published by
17
* the Free Software Foundation, either version 3 of the License, or
18
* (at your option) any later version.
19
*
20
* PAPPSOms++ is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU General Public License for more details.
24
*
25
* You should have received a copy of the GNU General Public License
26
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
27
*
28
******************************************************************************/
29
30
#include "
obotermform.h
"
31
32
#include "ui_uiobotermform.h"
33
#include <QDebug>
34
#include "
pappsomspp/core/exception/exceptionnotfound.h
"
35
36
using namespace
pappso
;
37
38
//"Oxidation of methionine to methionine sulfoxide with neutral loss of CH3SOH."
39
//[PubMed:18688235, PubMed:9004526]
40
QRegularExpression
OboTermForm::m_findExternalLinks
(
"^(.*)\\s\\[(.*)\\]$"
);
41
42
43
OboTermForm::OboTermForm
(QWidget *parent) : QWidget(parent),
ui
(new
Ui
::
OboTermForm
)
44
{
45
qDebug();
46
ui
->setupUi(
this
);
47
48
OboPsiModTerm
empty;
49
displayOboTerm
(empty);
50
}
51
52
pappso::OboTermForm::~OboTermForm
()
53
{
54
delete
ui
;
55
}
56
57
void
58
pappso::OboTermForm::displayOboTerm
(
pappso::OboPsiModTerm
oboTerm)
59
{
60
qDebug() << oboTerm.
getAccession
();
61
ui
->accessionHttpButton->setText(oboTerm.
getAccession
());
62
ui
->nameLabel->setText(oboTerm.
m_name
);
63
ui
->definitionLabel->setText(oboTerm.
m_definition
);
64
ui
->diffFormulaLabel->setText(oboTerm.
m_diffFormula
);
65
if
(oboTerm.
isValid
())
66
{
67
ui
->diffMonoLabel->setText(QString::number(oboTerm.
m_diffMono
,
'f'
, 4));
68
parseDefinitionLabel
();
69
}
70
else
71
{
72
ui
->diffMonoLabel->setText(
""
);
73
}
74
ui
->originLabel->setText(oboTerm.
m_origin
);
75
ui
->psiModLabel->setText(oboTerm.
m_psiModLabel
);
76
77
78
m_oboPsiModTerm
= oboTerm;
79
}
80
81
const
pappso::OboPsiModTerm
&
82
pappso::OboTermForm::getOboPsiModTerm
()
const
83
{
84
if
(
isOboTerm
())
85
{
86
}
87
else
88
{
89
throw
pappso::ExceptionNotFound
(tr(
"OBO term not available"
));
90
}
91
return
m_oboPsiModTerm
;
92
}
93
94
bool
95
pappso::OboTermForm::isOboTerm
()
const
96
{
97
return
m_oboPsiModTerm
.isValid();
98
}
99
100
void
101
pappso::OboTermForm::parseDefinitionLabel
()
102
{
103
QString label =
ui
->definitionLabel->text();
104
//"Oxidation of methionine to methionine sulfoxide with neutral loss of
105
// CH3SOH." [PubMed:18688235, PubMed:9004526]
106
107
QLayoutItem *child;
108
while
((child =
ui
->xrefScrollAreaLayout->takeAt(0)) != 0)
109
{
110
if
(child->widget() != NULL)
111
{
112
delete
(child->widget());
113
}
114
delete
child;
115
}
116
117
ui
->xrefScrollArea->hide();
118
QRegularExpressionMatch match =
m_findExternalLinks
.match(label);
119
if
(match.hasMatch())
120
{
121
QStringList pline = match.capturedTexts();
122
ui
->definitionLabel->setText(pline[1]);
123
124
QStringList list_xref = pline[2].split(
","
);
125
126
ui
->xrefScrollArea->show();
127
for
(
auto
xref : list_xref)
128
{
129
HttpButton
*newButton =
new
HttpButton
;
130
newButton->
setText
(xref.trimmed());
131
newButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
132
ui
->xrefScrollAreaLayout->addWidget(newButton);
133
}
134
}
135
}
pappso::ExceptionNotFound
Definition
exceptionnotfound.h:32
pappso::HttpButton
Definition
httpbutton.h:41
pappso::HttpButton::setText
void setText(const QString &text)
Definition
httpbutton.cpp:86
pappso::OboPsiModTerm
Definition
obopsimodterm.h:34
pappso::OboPsiModTerm::m_psiModLabel
QString m_psiModLabel
Definition
obopsimodterm.h:60
pappso::OboPsiModTerm::m_diffFormula
QString m_diffFormula
Definition
obopsimodterm.h:62
pappso::OboPsiModTerm::m_origin
QString m_origin
Definition
obopsimodterm.h:64
pappso::OboPsiModTerm::m_definition
QString m_definition
Definition
obopsimodterm.h:59
pappso::OboPsiModTerm::isValid
bool isValid() const
Definition
obopsimodterm.cpp:96
pappso::OboPsiModTerm::getAccession
const QString & getAccession() const
Definition
obopsimodterm.cpp:261
pappso::OboPsiModTerm::m_diffMono
double m_diffMono
Definition
obopsimodterm.h:66
pappso::OboPsiModTerm::m_name
QString m_name
Definition
obopsimodterm.h:58
pappso::OboTermForm::getOboPsiModTerm
const OboPsiModTerm & getOboPsiModTerm() const
get the obo term or an exception
Definition
obotermform.cpp:82
pappso::OboTermForm::m_oboPsiModTerm
OboPsiModTerm m_oboPsiModTerm
Definition
obotermform.h:80
pappso::OboTermForm::parseDefinitionLabel
void parseDefinitionLabel()
parse the definition label to extract external links
Definition
obotermform.cpp:101
pappso::OboTermForm::isOboTerm
bool isOboTerm() const
tells if an OBO term is displayed
Definition
obotermform.cpp:95
pappso::OboTermForm::OboTermForm
OboTermForm(QWidget *parent=nullptr)
Definition
obotermform.cpp:43
pappso::OboTermForm::displayOboTerm
void displayOboTerm(OboPsiModTerm oboTerm)
Definition
obotermform.cpp:58
pappso::OboTermForm::ui
Ui::OboTermForm * ui
Definition
obotermform.h:78
pappso::OboTermForm::m_findExternalLinks
static QRegularExpression m_findExternalLinks
Definition
obotermform.h:83
pappso::OboTermForm::~OboTermForm
~OboTermForm()
Definition
obotermform.cpp:52
exceptionnotfound.h
Ui
Definition
obochooserwidget.h:40
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
obotermform.h
pappsomspp
gui
obo
obotermform
obotermform.cpp
Generated on
for libpappsomspp by
1.17.0