1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// this library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1
// --------------------------------------------------------------------------
2
// OpenMS -- Open-Source Mass Spectrometry
3
// --------------------------------------------------------------------------
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
7
// This software is released under a three-clause BSD license:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of any author or any participating institution
14
// may be used to endorse or promote products derived from this software
15
// without specific prior written permission.
16
// For a full list of authors, refer to the file AUTHORS.
17
// --------------------------------------------------------------------------
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
30
// --------------------------------------------------------------------------
24
31
// $Maintainer:Timo Sachsenberg $
25
32
// $Authors: Marc Sturm $
26
// --------------------------------------------------------------------------s
33
// --------------------------------------------------------------------------
29
36
#include <OpenMS/VISUAL/VISUALIZER/ProteinIdentificationVisualizer.h>
46
ProteinIdentificationVisualizer::ProteinIdentificationVisualizer(bool editable, QWidget* parent, MetaDataBrowser* caller)
47
: BaseVisualizerGUI(editable, parent),
48
BaseVisualizer<ProteinIdentification>()
52
addLineEdit_(identifier_, "Identifier<br>(of corresponding PeptideIdentifications)" );
55
addLineEdit_(engine_, "Search engine" );
56
addLineEdit_(engine_version_, "Search engine version" );
57
addLineEdit_(identification_date_, "Date of search" );
58
addLineEdit_(score_type_, "Score type" );
59
addBooleanComboBox_(higher_better_,"Higher score is better");
60
addDoubleLineEdit_(identification_threshold_, "Protein significance threshold" );
63
addLabel_("Search Parameters:");
64
addLineEdit_(db_, "Database name" );
65
addLineEdit_(db_version_, "Database version" );
66
addLineEdit_(taxonomy_, "Taxonomy restriction" );
67
addLineEdit_(charges_, "Allowed charges" );
68
addIntLineEdit_(missed_cleavages_, "Missed Cleavages" );
69
addDoubleLineEdit_(peak_tolerance_, "Fragment ion mass tolerance" );
70
addDoubleLineEdit_(precursor_tolerance_, "Precursor ion mass tolerance" );
71
addComboBox_(mass_type_, "Mass type" );
72
addComboBox_(enzyme_, "Digestion enzyme" );
75
addLabel_("Show protein hits with score equal or better than a threshold.");
77
addLineEditButton_("Score threshold", filter_threshold_, button, "Filter");
78
connect(button, SIGNAL(clicked()), this, SLOT(updateTree_()) );
83
void ProteinIdentificationVisualizer::load(ProteinIdentification& s, int tree_item_id)
88
// id of the item in the tree
89
tree_id_ = tree_item_id;
91
identification_date_->setText(temp_.getDateTime().get().toQString());
92
identification_threshold_->setText(QString::number(temp_.getSignificanceThreshold()));
93
identifier_->setText(temp_.getIdentifier().toQString());
94
engine_->setText(temp_.getSearchEngine().toQString());
95
engine_version_->setText(temp_.getSearchEngineVersion().toQString());
96
score_type_->setText(temp_.getScoreType().toQString());
97
higher_better_->setCurrentIndex(temp_.isHigherScoreBetter());
99
db_->setText(temp_.getSearchParameters().db.toQString());
100
db_version_->setText(temp_.getSearchParameters().db_version.toQString());
101
taxonomy_->setText(temp_.getSearchParameters().taxonomy.toQString());
102
charges_->setText(temp_.getSearchParameters().charges.toQString());
103
missed_cleavages_->setText(QString::number(temp_.getSearchParameters().missed_cleavages));
104
peak_tolerance_->setText(QString::number(temp_.getSearchParameters().peak_mass_tolerance));
105
precursor_tolerance_->setText(QString::number(temp_.getSearchParameters().precursor_tolerance));
109
fillComboBox_(mass_type_,& ProteinIdentification::NamesOfPeakMassType[temp_.getSearchParameters().mass_type], 1);
110
fillComboBox_(enzyme_,& ProteinIdentification::NamesOfDigestionEnzyme[temp_.getSearchParameters().enzyme], 1);
114
fillComboBox_(mass_type_, ProteinIdentification::NamesOfPeakMassType, ProteinIdentification::SIZE_OF_PEAKMASSTYPE);
115
fillComboBox_(enzyme_, ProteinIdentification::NamesOfDigestionEnzyme, ProteinIdentification::SIZE_OF_DIGESTIONENZYME);
117
enzyme_->setCurrentIndex(temp_.getSearchParameters().enzyme);
118
mass_type_->setCurrentIndex(temp_.getSearchParameters().mass_type);
122
void ProteinIdentificationVisualizer::updateTree_()
124
if (filter_threshold_->text()!="")
126
pidv_caller_->filterHits_(filter_threshold_->text().toDouble(),temp_.isHigherScoreBetter(),tree_id_ );
130
pidv_caller_->showAllHits_(tree_id_);
134
void ProteinIdentificationVisualizer::store()
136
ptr_->setSearchEngine(engine_->text());
137
ptr_->setSearchEngineVersion(engine_version_->text());
138
ptr_->setIdentifier(identifier_->text());
139
ptr_->setSignificanceThreshold(identification_threshold_->text().toFloat());
140
ptr_->setScoreType(score_type_->text());
141
ptr_->setHigherScoreBetter(higher_better_->currentIndex());
146
date.set(identification_date_->text());
147
ptr_->setDateTime(date);
149
catch(exception& /*e*/)
153
std::string status= "Format of date in PROTEINIDENTIFICATION is not correct.";
154
emit sendStatus(status);
159
ProteinIdentification::SearchParameters tmp = ptr_->getSearchParameters();
160
tmp.db = db_->text();
161
tmp.db_version = db_version_->text();
162
tmp.taxonomy = taxonomy_->text();
163
tmp.charges = charges_->text();
164
tmp.missed_cleavages = missed_cleavages_->text().toInt();
165
tmp.peak_mass_tolerance = peak_tolerance_->text().toFloat();
166
tmp.precursor_tolerance = precursor_tolerance_->text().toFloat();
167
tmp.enzyme = (ProteinIdentification::DigestionEnzyme)(enzyme_->currentIndex());
168
tmp.mass_type = (ProteinIdentification::PeakMassType)(mass_type_->currentIndex());
169
ptr_->setSearchParameters(tmp);
174
void ProteinIdentificationVisualizer::undo_()
176
load(*ptr_, tree_id_);
53
ProteinIdentificationVisualizer::ProteinIdentificationVisualizer(bool editable, QWidget * parent, MetaDataBrowser * caller) :
54
BaseVisualizerGUI(editable, parent),
55
BaseVisualizer<ProteinIdentification>()
57
pidv_caller_ = caller;
59
addLineEdit_(identifier_, "Identifier<br>(of corresponding PeptideIdentifications)");
62
addLineEdit_(engine_, "Search engine");
63
addLineEdit_(engine_version_, "Search engine version");
64
addLineEdit_(identification_date_, "Date of search");
65
addLineEdit_(score_type_, "Score type");
66
addBooleanComboBox_(higher_better_, "Higher score is better");
67
addDoubleLineEdit_(identification_threshold_, "Protein significance threshold");
70
addLabel_("Search Parameters:");
71
addLineEdit_(db_, "Database name");
72
addLineEdit_(db_version_, "Database version");
73
addLineEdit_(taxonomy_, "Taxonomy restriction");
74
addLineEdit_(charges_, "Allowed charges");
75
addIntLineEdit_(missed_cleavages_, "Missed Cleavages");
76
addDoubleLineEdit_(peak_tolerance_, "Fragment ion mass tolerance");
77
addDoubleLineEdit_(precursor_tolerance_, "Precursor ion mass tolerance");
78
addComboBox_(mass_type_, "Mass type");
79
addComboBox_(enzyme_, "Digestion enzyme");
82
addLabel_("Show protein hits with score equal or better than a threshold.");
84
addLineEditButton_("Score threshold", filter_threshold_, button, "Filter");
85
connect(button, SIGNAL(clicked()), this, SLOT(updateTree_()));
90
void ProteinIdentificationVisualizer::load(ProteinIdentification & s, int tree_item_id)
95
// id of the item in the tree
96
tree_id_ = tree_item_id;
98
identification_date_->setText(temp_.getDateTime().get().toQString());
99
identification_threshold_->setText(QString::number(temp_.getSignificanceThreshold()));
100
identifier_->setText(temp_.getIdentifier().toQString());
101
engine_->setText(temp_.getSearchEngine().toQString());
102
engine_version_->setText(temp_.getSearchEngineVersion().toQString());
103
score_type_->setText(temp_.getScoreType().toQString());
104
higher_better_->setCurrentIndex(temp_.isHigherScoreBetter());
106
db_->setText(temp_.getSearchParameters().db.toQString());
107
db_version_->setText(temp_.getSearchParameters().db_version.toQString());
108
taxonomy_->setText(temp_.getSearchParameters().taxonomy.toQString());
109
charges_->setText(temp_.getSearchParameters().charges.toQString());
110
missed_cleavages_->setText(QString::number(temp_.getSearchParameters().missed_cleavages));
111
peak_tolerance_->setText(QString::number(temp_.getSearchParameters().peak_mass_tolerance));
112
precursor_tolerance_->setText(QString::number(temp_.getSearchParameters().precursor_tolerance));
116
fillComboBox_(mass_type_, &ProteinIdentification::NamesOfPeakMassType[temp_.getSearchParameters().mass_type], 1);
117
fillComboBox_(enzyme_, &ProteinIdentification::NamesOfDigestionEnzyme[temp_.getSearchParameters().enzyme], 1);
121
fillComboBox_(mass_type_, ProteinIdentification::NamesOfPeakMassType, ProteinIdentification::SIZE_OF_PEAKMASSTYPE);
122
fillComboBox_(enzyme_, ProteinIdentification::NamesOfDigestionEnzyme, ProteinIdentification::SIZE_OF_DIGESTIONENZYME);
124
enzyme_->setCurrentIndex(temp_.getSearchParameters().enzyme);
125
mass_type_->setCurrentIndex(temp_.getSearchParameters().mass_type);
129
void ProteinIdentificationVisualizer::updateTree_()
131
if (filter_threshold_->text() != "")
133
pidv_caller_->filterHits_(filter_threshold_->text().toDouble(), temp_.isHigherScoreBetter(), tree_id_);
137
pidv_caller_->showAllHits_(tree_id_);
141
void ProteinIdentificationVisualizer::store()
143
ptr_->setSearchEngine(engine_->text());
144
ptr_->setSearchEngineVersion(engine_version_->text());
145
ptr_->setIdentifier(identifier_->text());
146
ptr_->setSignificanceThreshold(identification_threshold_->text().toFloat());
147
ptr_->setScoreType(score_type_->text());
148
ptr_->setHigherScoreBetter(higher_better_->currentIndex());
153
date.set(identification_date_->text());
154
ptr_->setDateTime(date);
156
catch (exception & /*e*/)
160
std::string status = "Format of date in PROTEINIDENTIFICATION is not correct.";
161
emit sendStatus(status);
166
ProteinIdentification::SearchParameters tmp = ptr_->getSearchParameters();
167
tmp.db = db_->text();
168
tmp.db_version = db_version_->text();
169
tmp.taxonomy = taxonomy_->text();
170
tmp.charges = charges_->text();
171
tmp.missed_cleavages = missed_cleavages_->text().toInt();
172
tmp.peak_mass_tolerance = peak_tolerance_->text().toFloat();
173
tmp.precursor_tolerance = precursor_tolerance_->text().toFloat();
174
tmp.enzyme = (ProteinIdentification::DigestionEnzyme)(enzyme_->currentIndex());
175
tmp.mass_type = (ProteinIdentification::PeakMassType)(mass_type_->currentIndex());
176
ptr_->setSearchParameters(tmp);
181
void ProteinIdentificationVisualizer::undo_()
183
load(*ptr_, tree_id_);