OpenMS  2.8.0
SpectraIDViewTab.h
Go to the documentation of this file.
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-2021.
6 //
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.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 
42 #include <QtWidgets>
43 #include <QLineEdit>
44 #include <QComboBox>
45 #include <QTableWidget>
46 #include <QCheckBox>
47 #include <QWidget>
48 
49 #include <unordered_map>
50 #include <vector>
51 
52 namespace OpenMS
53 {
59  class OPENMS_GUI_DLLAPI SpectraIDViewTab :
60  public QWidget,
61  public DefaultParamHandler,
62  public DataTabBase
63  {
64  Q_OBJECT
65  public:
67  SpectraIDViewTab(const Param& preferences, QWidget* parent = nullptr);
69  ~SpectraIDViewTab() override = default;
70 
71  // docu in base class
72  bool hasData(const LayerDataBase* layer) override;
73 
75  void updateEntries(LayerDataBase* model) override;
78 
80  void clear() override;
81 
83  bool ignore_update = false;
84 
85  protected slots:
89  void updateProteinEntries_(int spec_cell_row_idx);
92  signals:
94  void spectrumSelected(int spectrum_index, int pep_id_index, int pep_hit_index);
96  void spectrumDeselected(int spectrum_index);
98  void requestVisibleArea1D(double lower_mz, double upper_mz);
99 
100  private:
102  void fillRow_(const MSSpectrum& spectrum, const int spec_index, const QColor& background_color);
104  static QString extractNumFromAccession_(const QString& listItem);
106  void openUniProtSiteWithAccession_(const QString& accession);
107 
109  {
110  void resizeEvent(QResizeEvent * event) override;
111  };
112 
113  LayerDataBase* layer_ = nullptr;
114  QCheckBox* hide_no_identification_ = nullptr;
115  QCheckBox* create_rows_for_commmon_metavalue_ = nullptr;
116  TableView* table_widget_ = nullptr;
117  TableView* protein_table_widget_ = nullptr;
118  QTableWidget* fragment_window_ = nullptr;
119  QSplitter* tables_splitter_ = nullptr;
120  bool is_first_time_loading_ = true;
121  std::unordered_map<String, std::vector<const PeptideIdentification*>> protein_to_peptide_id_map;
122 
123  private slots:
125  void saveIDs_();
127  void updatedSingleCell_(QTableWidgetItem* item);
129  void currentCellChanged_(int row, int column, int old_row, int old_column);
130 
133 
136 
138  void updatedSingleProteinCell_(QTableWidgetItem* item);
140  void proteinCellClicked_(int row, int column);
141  };
142 }
all tabs need to implement this interface
Definition: DataSelectionTabs.h:57
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
Class that stores the data for one layer.
Definition: LayerDataBase.h:99
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
Management and storage of parameters / INI files.
Definition: Param.h:70
Definition: SpectraIDViewTab.h:109
void resizeEvent(QResizeEvent *event) override
Tabular visualization / selection of identified spectra.
Definition: SpectraIDViewTab.h:63
void requestVisibleArea1D(double lower_mz, double upper_mz)
request to zoom into a 1D spec
void proteinCellClicked_(int row, int column)
Protein Cell clicked in protein_table_widget; emits which protein (row) was clicked,...
std::unordered_map< String, std::vector< const PeptideIdentification * > > protein_to_peptide_id_map
Definition: SpectraIDViewTab.h:121
void openUniProtSiteWithAccession_(const QString &accession)
open browser to navigate to uniport site with accession
void currentCellChanged_(int row, int column, int old_row, int old_column)
Cell clicked in table_widget; emits which spectrum (row) was clicked, and may show additional data.
void updateEntries_()
Rebuild table entries.
bool hasData(const LayerDataBase *layer) override
void switchOrientation_()
Switch horizontal or vertical layout of the PSM and Proteintable.
LayerDataBase * getLayer()
get layer data
void fillRow_(const MSSpectrum &spectrum, const int spec_index, const QColor &background_color)
partially fill the bottom-most row
void saveIDs_()
Saves the (potentially filtered) IDs as an idXML or mzIdentML file.
void spectrumSelected(int spectrum_index, int pep_id_index, int pep_hit_index)
request to show a specific spectrum, and (if available) a specific pepId + pepHit in there (otherwise...
void spectrumDeselected(int spectrum_index)
request to unshow a spectrum
void currentSpectraSelectionChanged_()
Cell selected or deselected: this is only used to check for deselection, rest happens in currentCellC...
void updateProteinEntries_(int spec_cell_row_idx)
Rebuild protein table entries.
~SpectraIDViewTab() override=default
Destructor.
void updatedSingleProteinCell_(QTableWidgetItem *item)
update ProteinHits, when data in the table changes (status of checkboxes)
void updatedSingleCell_(QTableWidgetItem *item)
update PeptideIdentification / PeptideHits, when data in the table changes (status of checkboxes)
void createProteinToPeptideIDMap_()
Create 'protein accession to peptide identification' map using C++ STL unordered_map.
static QString extractNumFromAccession_(const QString &listItem)
extract the required part of the accession
void clear() override
clears all visible data from table widget and voids the layer
SpectraIDViewTab(const Param &preferences, QWidget *parent=nullptr)
Constructor.
void updateEntries(LayerDataBase *model) override
set layer data and create table anew; if given a nullptr, behaves as clear()
A better QTable for TOPPView, which supports exporting to TSV and conveniently adding data to cells a...
Definition: TableView.h:48
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47