OpenMS
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-2023.
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 <QCheckBox>
44 
45 #include <unordered_map>
46 #include <vector>
47 
48 namespace OpenMS
49 {
55  class OPENMS_GUI_DLLAPI SpectraIDViewTab :
56  public QWidget,
57  public DefaultParamHandler,
58  public DataTabBase
59  {
60  Q_OBJECT
61  public:
63  SpectraIDViewTab(const Param& preferences, QWidget* parent = nullptr);
65  ~SpectraIDViewTab() override = default;
66 
67  // docu in base class
68  bool hasData(const LayerDataBase* layer) override;
69 
71  void updateEntries(LayerDataBase* model) override;
74 
76  void clear() override;
77 
79  bool ignore_update = false;
80 
81  protected slots:
85  void updateProteinEntries_(int spec_cell_row_idx);
88  signals:
90  void spectrumSelected(int spectrum_index, int pep_id_index, int pep_hit_index);
92  void spectrumDeselected(int spectrum_index);
94  void requestVisibleArea1D(double lower_mz, double upper_mz);
95 
96  private:
98  void fillRow_(const MSSpectrum& spectrum, const int spec_index, const QColor& background_color);
100  static QString extractNumFromAccession_(const QString& listItem);
102  void openUniProtSiteWithAccession_(const QString& accession);
103 
105  {
106  void resizeEvent(QResizeEvent * event) override;
107  };
108 
109  LayerDataPeak* layer_ = nullptr;
110  QCheckBox* hide_no_identification_ = nullptr;
111  QCheckBox* create_rows_for_commmon_metavalue_ = nullptr;
112  TableView* table_widget_ = nullptr;
113  TableView* protein_table_widget_ = nullptr;
114  QTableWidget* fragment_window_ = nullptr;
115  QSplitter* tables_splitter_ = nullptr;
116  bool is_first_time_loading_ = true;
117  std::unordered_map<String, std::vector<const PeptideIdentification*>> protein_to_peptide_id_map;
118 
119  private slots:
121  void saveIDs_();
123  void updatedSingleCell_(QTableWidgetItem* item);
125  void currentCellChanged_(int row, int column, int old_row, int old_column);
126 
129 
132 
134  void updatedSingleProteinCell_(QTableWidgetItem* /*item*/);
136  void proteinCellClicked_(int row, int column);
137  };
138 }
all tabs need to implement this interface
Definition: DataSelectionTabs.h:57
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Class that stores the data for one layer.
Definition: LayerDataBase.h:195
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:55
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
Management and storage of parameters / INI files.
Definition: Param.h:70
Definition: SpectraIDViewTab.h:105
void resizeEvent(QResizeEvent *event) override
Tabular visualization / selection of identified spectra.
Definition: SpectraIDViewTab.h:59
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:117
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 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.
void updatedSingleProteinCell_(QTableWidgetItem *)
update ProteinHits, when data in the table changes (status of checkboxes)
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 or the layer is not LayerDataPeak,...
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:48