libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
obolistwidget.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/widget/obo/obolistwidget/obolistwidget.cpp
3
* \date 17/04/2021
4
* \author Olivier Langella
5
* \brief handles a list of obo term, select and click
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 "
obolistwidget.h
"
31
#include "ui_uiobolistwidget.h"
32
#include <QDebug>
33
#include "
obolistproxymodel.h
"
34
#include "
../../../core/mzrange.h
"
35
36
using namespace
pappso
;
37
38
OboListWidget::OboListWidget
(QWidget *parent) : QWidget(parent),
ui
(new
Ui
::OboListWidgetForm)
39
{
40
qDebug();
41
ui
->setupUi(
this
);
42
43
mpa_oboListModel
=
new
OboListModel
(
this
);
44
mpa_oboListModel
->loadPsiMod();
45
46
mpa_oboListProxyModel
=
new
OboListProxyModel
(
mpa_oboListModel
,
this
);
47
mpa_oboListProxyModel
->setSourceModel(
mpa_oboListModel
);
48
// mpa_oboListProxyModel->setSortRole(Qt::UserRole);
49
50
ui
->oboTermListView->setModel(
mpa_oboListProxyModel
);
51
52
mpa_oboListProxyModel
->sort(Qt::AscendingOrder);
53
54
connect(
ui
->oboTermListView->selectionModel(),
55
&QItemSelectionModel::selectionChanged,
56
this
,
57
&
OboListWidget::onSelectionChanged
);
58
}
59
60
OboListWidget::~OboListWidget
()
61
{
62
delete
ui
;
63
if
(
mpa_oboListProxyModel
!=
nullptr
)
64
{
65
delete
mpa_oboListProxyModel
;
66
}
67
if
(
mpa_oboListModel
!=
nullptr
)
68
{
69
delete
mpa_oboListModel
;
70
}
71
}
72
73
void
74
pappso::OboListWidget::onSelectionChanged
(
const
QItemSelection &selected,
75
const
QItemSelection &deselected [[maybe_unused]])
76
{
77
QModelIndexList index_list =
mpa_oboListProxyModel
->mapSelectionToSource(selected).indexes();
78
79
if
(index_list.size() > 0)
80
{
81
QModelIndex index = index_list.first();
82
OboPsiModTerm
term =
mpa_oboListModel
->data(index, Qt::UserRole).value<
OboPsiModTerm
>();
83
qDebug() << term.
getAccession
();
84
emit
oboTermChanged
(term);
85
}
86
}
87
88
void
89
pappso::OboListWidget::filterMzPrecision
(
double
target_mz,
pappso::PrecisionPtr
precision)
90
{
91
qDebug();
92
mpa_oboListProxyModel
->filterMzPrecision(target_mz, precision);
93
if
(precision ==
nullptr
)
94
{
95
ui
->massFilterGroupBox->setChecked(
false
);
96
ui
->mzSpinBox->setValue(target_mz);
97
}
98
else
99
{
100
ui
->massFilterGroupBox->setChecked(
true
);
101
ui
->precisionWidget->setPrecision(precision);
102
ui
->mzSpinBox->setValue(target_mz);
103
}
104
}
105
106
void
107
pappso::OboListWidget::onFilterChanged
()
108
{
109
qDebug();
110
if
(
ui
->massFilterGroupBox->isChecked())
111
{
112
mpa_oboListProxyModel
->filterMzPrecision(
ui
->mzSpinBox->value(),
113
ui
->precisionWidget->getPrecision());
114
}
115
else
116
{
117
mpa_oboListProxyModel
->filterMzPrecision(0,
nullptr
);
118
}
119
}
120
121
void
122
pappso::OboListWidget::onFilterChanged
(
double
value [[maybe_unused]])
123
{
124
qDebug();
125
if
(
ui
->massFilterGroupBox->isChecked())
126
{
127
mpa_oboListProxyModel
->filterMzPrecision(
ui
->mzSpinBox->value(),
128
ui
->precisionWidget->getPrecision());
129
}
130
else
131
{
132
mpa_oboListProxyModel
->filterMzPrecision(0,
nullptr
);
133
}
134
}
135
136
void
137
pappso::OboListWidget::onFilterChanged
(
pappso::PrecisionPtr
precision [[maybe_unused]])
138
{
139
onFilterChanged
();
140
}
141
142
double
143
pappso::OboListWidget::getMzTarget
()
const
144
{
145
return
ui
->mzSpinBox->value();
146
}
147
148
pappso::PrecisionPtr
149
pappso::OboListWidget::getPrecisionPtr
()
const
150
{
151
if
(
ui
->massFilterGroupBox->isChecked())
152
{
153
return
ui
->precisionWidget->getPrecision();
154
}
155
return
nullptr
;
156
}
pappso::OboListModel
Definition
obolistmodel.h:46
pappso::OboListProxyModel
Definition
obolistproxymodel.h:43
pappso::OboListWidget::getPrecisionPtr
PrecisionPtr getPrecisionPtr() const
get the current precision used to filter term list
Definition
obolistwidget.cpp:149
pappso::OboListWidget::filterMzPrecision
void filterMzPrecision(double target_mz, PrecisionPtr precision)
Definition
obolistwidget.cpp:89
pappso::OboListWidget::OboListWidget
OboListWidget(QWidget *parent=nullptr)
Definition
obolistwidget.cpp:38
pappso::OboListWidget::ui
Ui::OboListWidgetForm * ui
Definition
obolistwidget.h:87
pappso::OboListWidget::getMzTarget
double getMzTarget() const
get the current mz value used to filter term list
Definition
obolistwidget.cpp:143
pappso::OboListWidget::mpa_oboListProxyModel
OboListProxyModel * mpa_oboListProxyModel
Definition
obolistwidget.h:90
pappso::OboListWidget::oboTermChanged
void oboTermChanged(OboPsiModTerm oboTerm) const
pappso::OboListWidget::onFilterChanged
void onFilterChanged()
Definition
obolistwidget.cpp:107
pappso::OboListWidget::onSelectionChanged
void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
Definition
obolistwidget.cpp:74
pappso::OboListWidget::~OboListWidget
~OboListWidget()
Definition
obolistwidget.cpp:60
pappso::OboListWidget::mpa_oboListModel
OboListModel * mpa_oboListModel
Definition
obolistwidget.h:89
pappso::OboListWidget::onFilterChanged
void onFilterChanged(pappso::PrecisionPtr precision)
Definition
obolistwidget.cpp:137
pappso::OboPsiModTerm
Definition
obopsimodterm.h:34
pappso::OboPsiModTerm::getAccession
const QString & getAccession() const
Definition
obopsimodterm.cpp:261
mzrange.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
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
obolistproxymodel.h
obolistwidget.h
pappsomspp
gui
obo
obolistwidget
obolistwidget.cpp
Generated on
for libpappsomspp by
1.17.0