OpenMS
SpectraIDViewTab.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Timo Sachsenberg $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
15 
16 #include <QtWidgets>
17 #include <QCheckBox>
18 
19 #include <unordered_map>
20 #include <vector>
21 
22 namespace OpenMS
23 {
29  class OPENMS_GUI_DLLAPI SpectraIDViewTab :
30  public QWidget,
31  public DefaultParamHandler,
32  public DataTabBase
33  {
34  Q_OBJECT
35  public:
37  SpectraIDViewTab(const Param& preferences, QWidget* parent = nullptr);
39  ~SpectraIDViewTab() override = default;
40 
41  // docu in base class
42  bool hasData(const LayerDataBase* layer) override;
43 
45  void updateEntries(LayerDataBase* model) override;
48 
50  void clear() override;
51 
53  bool ignore_update = false;
54 
55  protected slots:
59  void updateProteinEntries_(int spec_cell_row_idx);
62  signals:
64  void spectrumSelected(int spectrum_index, int pep_id_index, int pep_hit_index);
66  void spectrumDeselected(int spectrum_index);
68  void requestVisibleArea1D(double lower_mz, double upper_mz);
69 
70  private:
72  void fillRow_(const MSSpectrum& spectrum, const int spec_index, const QColor& background_color);
74  static QString extractNumFromAccession_(const QString& listItem);
76  void openUniProtSiteWithAccession_(const QString& accession);
77 
79  {
80  void resizeEvent(QResizeEvent * event) override;
81  };
82 
83  LayerDataPeak* layer_ = nullptr;
84  QCheckBox* hide_no_identification_ = nullptr;
85  QCheckBox* create_rows_for_commmon_metavalue_ = nullptr;
86  TableView* table_widget_ = nullptr;
87  TableView* protein_table_widget_ = nullptr;
88  QTableWidget* fragment_window_ = nullptr;
89  QSplitter* tables_splitter_ = nullptr;
90  bool is_first_time_loading_ = true;
91  std::unordered_map<String, std::vector<const PeptideIdentification*>> protein_to_peptide_id_map;
92 
93  private slots:
95  void saveIDs_();
97  void updatedSingleCell_(QTableWidgetItem* item);
99  void currentCellChanged_(int row, int column, int old_row, int old_column);
100 
103 
106 
108  void updatedSingleProteinCell_(QTableWidgetItem* /*item*/);
110  void proteinCellClicked_(int row, int column);
111  };
112 }
all tabs need to implement this interface
Definition: DataSelectionTabs.h:31
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
Class that stores the data for one layer.
Definition: LayerDataBase.h:169
Class that stores the data for one layer of type PeakMap.
Definition: LayerDataPeak.h:29
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
Management and storage of parameters / INI files.
Definition: Param.h:44
Definition: SpectraIDViewTab.h:79
void resizeEvent(QResizeEvent *event) override
Tabular visualization / selection of identified spectra.
Definition: SpectraIDViewTab.h:33
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:91
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:22
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19