Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TOPPViewBase.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-2017.
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: Marc Sturm, Timo Sachsenberg $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
40 //OpenMS
48 
51 
52 //STL
53 #include <map>
54 
55 //QT
56 #include <QtWidgets/QMainWindow>
57 #include <QtWidgets/QButtonGroup>
58 #include <QtWidgets/QActionGroup>
59 #include <QtCore/QStringList>
60 #include <QtCore/QProcess>
61 
62 class QAction;
63 class QComboBox;
64 class QLabel;
65 class QLineEdit;
66 class QListWidget;
67 class QListWidgetItem;
68 class QTreeWidget;
69 class QTreeWidgetItem;
70 class QDockWidget;
71 class QToolButton;
72 class QCloseEvent;
73 class QTextEdit;
74 class QCheckBox;
75 class QSplashScreen;
76 class QToolButton;
77 class QWorkspace;
78 
79 namespace OpenMS
80 {
81  class EnhancedWorkspace;
82  class EnhancedTabBar;
83  class Spectrum1DWidget;
84  class Spectrum2DWidget;
85  class Spectrum3DWidget;
86  class ToolsDialog;
87  class MultiGradientSelector;
88  class FileWatcher;
89 
102  class OPENMS_GUI_DLLAPI TOPPViewBase :
103  public QMainWindow,
104  public DefaultParamHandler
105  {
106  Q_OBJECT
107 
108  friend class TestTOPPView;
109 
110 public:
112 
113  //Feature map type
115  //Feature map managed type
117 
118  //Consensus feature map type
120  //Consensus map managed type
122 
123  //Peak map type
125  //Main managed data type (experiment)
130 
132  TOPPViewBase(QWidget* parent = nullptr);
134  ~TOPPViewBase() override;
135 
148  void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption = "", UInt window_id = 0, Size spectrum_id = 0);
149 
165  void addData(FeatureMapSharedPtrType feature_map, ConsensusMapSharedPtrType consensus_map, std::vector<PeptideIdentification>& peptides, ExperimentSharedPtrType peak_map, LayerData::DataType data_type, bool show_as_1d, bool show_options, bool as_new_window = true, const String& filename = "", const String& caption = "", UInt window_id = 0, Size spectrum_id = 0);
166 
168  void loadFiles(const StringList& list, QSplashScreen* splash_screen);
169 
175  void loadPreferences(String filename = "");
176 
178  void savePreferences();
179 
181  Param getSpectrumParameters(UInt dim);
182 
184  const LayerData* getCurrentLayer() const;
185 
186  //@name Accessors for the main gui components.
187  //@brief The top level enhanced workspace and the EnhancedTabWidgets resing in the EnhancedTabBar.
189  EnhancedWorkspace* getWorkspace() const;
191 
193  SpectrumWidget* getActiveSpectrumWidget() const;
194 
196  Spectrum1DWidget* getActive1DWidget() const;
197 
199  Spectrum2DWidget* getActive2DWidget() const;
200 
202  Spectrum3DWidget* getActive3DWidget() const;
204 
206  SpectrumCanvas* getActiveCanvas() const;
207 
208 
210  SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
211 
213  void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
214 
215 public slots:
217  void updateCurrentPath();
219  void showURL();
221  void openFileDialog();
223  void openExampleDialog();
225  void showGoToDialog();
227  void preferencesDialog();
229  void layerStatistics();
231  void editMetadata();
233  void layerActivated();
235  void layerZoomChanged();
237  void linkZoom();
239  void layerDeactivated();
241  void closeFile();
243  void updateToolBar();
245  void updateLayerBar();
247  void updateViewBar();
249  void viewChanged(int);
251  void updateFilterBar();
253  void updateMenu();
255  void updateTabBar(QMdiSubWindow* w);
257  void tileVertical();
259  void tileHorizontal();
266  void showStatusMessage(std::string msg, OpenMS::UInt time);
268  void showCursorStatus(double mz, double rt);
270  void showCursorStatusInvert(double mz, double rt);
272  void showTOPPDialog();
274  void annotateWithID();
276  void showSpectrumGenerationDialog();
278  void showSpectrumAlignmentDialog();
280  void showSpectrumAs1D(int index);
281  void showSpectrumAs1D(std::vector<int, std::allocator<int> > indices);
283  void showCurrentPeaksAs2D();
285  void showCurrentPeaksAs3D();
287  void showAboutDialog();
289  void saveLayerAll();
291  void saveLayerVisible();
293  void toggleGridLines();
295  void toggleAxisLegends();
297  void showPreferences();
299  void metadataFileDialog();
300 
304  void setDrawMode1D(int);
305  void setIntensityMode(int);
306  void changeLayerFlag(bool);
307  void changeLabel(QAction*);
308  void changeUnassigned(QAction*);
309  void resetZoom();
310  void toggleProjections();
312 
314  void loadFile(QString);
315 
316 protected slots:
320  void layerSelectionChange(int);
323  void layerFilterVisibilityChange(bool);
325  void layerContextMenu(const QPoint& pos);
327  void logContextMenu(const QPoint& pos);
329  void layerVisibilityChange(QListWidgetItem* item);
331  void filterContextMenu(const QPoint& pos);
333  void filterEdit(QListWidgetItem* item);
335  void layerEdit(QListWidgetItem* /*item*/);
337 
339  void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
341  void abortTOPPTool();
343  void rerunTOPPTool();
345  void showSpectrumBrowser();
347  void showSpectrumMetaData(int spectrum_index);
348 
352  void closeByTab(int id);
355  void enhancedWorkspaceWindowChanged(int id);
357  void openRecentFile();
359  void copyLayer(const QMimeData* data, QWidget* source, int id = -1);
361 
363  void updateProcessLog();
364 
366  void fileChanged_(const String&);
367 protected:
369  void initializeDefaultParameters_();
370 
373  bool annotateMS1FromMassFingerprinting_(const FeatureMap& identifications);
374 
376  std::set<String> getFilenamesOfOpenFiles_();
377 
381  QStringList getFileList_(const String& path_overwrite = "");
382 
384  EnhancedTabBarWidgetInterface* window_(int id) const;
385 
387 
388  QDockWidget* layer_dock_widget_;
389  QDockWidget* views_dockwidget_;
390  QDockWidget* filter_dock_widget_;
392 
394 
398 
401 
403 
405  QCheckBox* filters_check_box_;
407 
410 
413 
416 
418 
421 
425  QToolBar* tool_bar_;
426  //common intensity modes
427 
428  QButtonGroup* intensity_button_group_;
429  //1D specific stuff
430 
431  QToolBar* tool_bar_1d_;
432  QButtonGroup* draw_group_1d_;
433 
434  //2D specific stuff
435  QToolBar* tool_bar_2d_peak_;
436  QToolBar* tool_bar_2d_feat_;
437  QToolBar* tool_bar_2d_cons_;
440  QAction* dm_hull_2d_;
441  QAction* dm_hulls_2d_;
442  QToolButton* dm_label_2d_;
443  QActionGroup* group_label_2d_;
444  QToolButton* dm_unassigned_2d_;
445  QActionGroup* group_unassigned_2d_;
446  QAction* dm_elements_2d_;
447  QAction* projections_2d_;
448  QAction* dm_ident_2d_;
450 
453 
456 
460  QLabel* message_label_;
463  QLabel* mz_label_;
465  QLabel* rt_label_;
467 
469 
470  void addRecentFile_(const String& filename);
473  void updateRecentMenu_();
475  QStringList recent_files_;
477  std::vector<QAction*> recent_actions_;
479 
480 
482 
483  void runTOPPTool_();
486  struct
487  {
497  QTime timer;
498  bool visible;
499  } topp_;
501 
503  void checkPreferences_();
505 
506  void closeEvent(QCloseEvent* event) override;
508 
510  enum LogState
511  {
514  LS_ERROR
515  };
517  void showLogMessage_(LogState state, const String& heading, const String& body);
518 
521 
523  void showTOPPDialog_(bool visible);
524 
528 
530  QTabWidget* views_tabwidget_;
531 
536 
537  // static helper functions
538 public:
540  static bool containsMS1Scans(const ExperimentType& exp);
541 
543  float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
544 
546  static bool hasMS1Zeros(const ExperimentType& exp);
547 
549  static bool hasPeptideIdentifications(const ExperimentType& map);
550 
551 private:
554  }; //class
555 
556 } //namespace
557 
String layer_name
Definition: TOPPViewBase.h:493
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Definition: TOPPViewBase.h:121
QLabel * rt_label_
RT label for messages in the status bar.
Definition: TOPPViewBase.h:465
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:111
TOPPViewIdentificationViewBehavior * identificationview_behavior_
TOPPView behavior for the identification view.
Definition: TOPPViewBase.h:533
QDockWidget * filter_dock_widget_
Definition: TOPPViewBase.h:390
QAction * linkZoom_action_
Definition: TOPPViewBase.h:417
QButtonGroup * draw_group_1d_
Definition: TOPPViewBase.h:432
QToolBar * tool_bar_1d_
Definition: TOPPViewBase.h:431
Behavior of TOPPView in identification mode.
Definition: TOPPViewIdentificationViewBehavior.h:48
std::vector< QAction * > recent_actions_
list of the recently opened files actions (menu entries)
Definition: TOPPViewBase.h:477
A more convenient string class.
Definition: String.h:57
QAction * dm_hulls_2d_
Definition: TOPPViewBase.h:441
QToolBar * tool_bar_2d_ident_
Definition: TOPPViewBase.h:438
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Definition: TOPPViewBase.h:126
bool visible
Definition: TOPPViewBase.h:498
LayerData::ConsensusMapType ConsensusMapType
Definition: TOPPViewBase.h:119
QListWidget * filters_
Definition: TOPPViewBase.h:404
Hierarchical visualization and selection of spectra.
Definition: SpectraViewWidget.h:51
Main window of TOPPView tool.
Definition: TOPPViewBase.h:102
String tool
Definition: TOPPViewBase.h:489
String file_name
Definition: TOPPViewBase.h:492
QToolBar * tool_bar_2d_feat_
Definition: TOPPViewBase.h:436
DataType
Dataset types.
Definition: LayerData.h:67
A container for features.
Definition: FeatureMap.h:93
Widget for 2D-visualization of peak map and feature map data.
Definition: Spectrum2DWidget.h:63
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
QToolBar * tool_bar_2d_cons_
Definition: TOPPViewBase.h:437
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:96
A container for consensus elements.
Definition: ConsensusMap.h:71
QToolBar * tool_bar_2d_peak_
Definition: TOPPViewBase.h:435
SpectraIdentificationViewWidget * spectra_identification_view_widget_
Definition: TOPPViewBase.h:396
QAction * dm_elements_2d_
Definition: TOPPViewBase.h:446
QAction * dm_hull_2d_
Definition: TOPPViewBase.h:440
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
FileWatcher * watcher_
Watcher that tracks file changes (in order to update the data in the different views) ...
Definition: TOPPViewBase.h:409
String in
Definition: TOPPViewBase.h:490
bool zoom_together_
Stores whether the individual windows should zoom together (be linked) or not.
Definition: TOPPViewBase.h:415
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:123
QTime timer
Definition: TOPPViewBase.h:497
QDockWidget * layer_dock_widget_
Definition: TOPPViewBase.h:388
bool watcher_msgbox_
Holds the messageboxes for each layer that are currently popped up (to avoid popping them up again...
Definition: TOPPViewBase.h:412
QAction * dm_ident_2d_
Definition: TOPPViewBase.h:448
Size spectrum_id
Definition: TOPPViewBase.h:495
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
SpectraViewWidget * spectra_view_widget_
Definition: TOPPViewBase.h:395
QLabel * mz_label_
m/z label for messages in the status bar
Definition: TOPPViewBase.h:463
TOPPViewSpectraViewBehavior * spectraview_behavior_
TOPPView behavior for the spectra view.
Definition: TOPPViewBase.h:535
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Definition: TOPPViewBase.h:116
UInt window_id
Definition: TOPPViewBase.h:494
Param param
Definition: TOPPViewBase.h:488
QActionGroup * group_label_2d_
Definition: TOPPViewBase.h:443
Widget for visualization of several spectra.
Definition: Spectrum1DWidget.h:65
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:117
Base class for spectrum widgets.
Definition: SpectrumWidget.h:73
Warning.
Definition: TOPPViewBase.h:513
QTabWidget * views_tabwidget_
Tabwidget that hold the different views on the loaded data.
Definition: TOPPViewBase.h:530
static const String CAPTION_3D_SUFFIX_
Suffix appended to caption of tabs when layer is shown in 3D.
Definition: TOPPViewBase.h:553
Widget for 3D-visualization of map data.
Definition: Spectrum3DWidget.h:53
String out
Definition: TOPPViewBase.h:491
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:73
Management and storage of parameters / INI files.
Definition: Param.h:74
Behavior of TOPPView in spectra view mode.
Definition: TOPPViewSpectraViewBehavior.h:48
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
QButtonGroup * intensity_button_group_
Definition: TOPPViewBase.h:428
QToolButton * dm_unassigned_2d_
Definition: TOPPViewBase.h:444
QToolBar * tool_bar_
Definition: TOPPViewBase.h:425
Notice.
Definition: TOPPViewBase.h:512
QStringList recent_files_
list of the recently opened files
Definition: TOPPViewBase.h:475
Tabular visualization / selection of identified spectra.
Definition: SpectraIdentificationViewWidget.h:53
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Definition: EnhancedWorkspace.h:49
LogState
Log message states.
Definition: TOPPViewBase.h:510
QDockWidget * views_dockwidget_
Definition: TOPPViewBase.h:389
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:51
LayerData::FeatureMapType FeatureMapType
Definition: TOPPViewBase.h:114
QTextEdit * log_
Log output window.
Definition: TOPPViewBase.h:420
QListWidget * layer_manager_
Layer management widget.
Definition: TOPPViewBase.h:400
QActionGroup * group_unassigned_2d_
Definition: TOPPViewBase.h:445
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPViewBase.h:452
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
String current_path_
Definition: TOPPViewBase.h:527
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData() ...
Definition: TOPPViewBase.h:455
Watcher that monitors file changes.
Definition: FileWatcher.h:65
QCheckBox * filters_check_box_
Definition: TOPPViewBase.h:405
QMenu * add_2d_context_
Additional context menu for 2D layers.
Definition: TOPPViewBase.h:520
QToolButton * dm_label_2d_
Definition: TOPPViewBase.h:442
QAction * dm_precursors_2d_
Definition: TOPPViewBase.h:439
QProcess * process
Definition: TOPPViewBase.h:496
Class that stores the data for one layer.
Definition: LayerData.h:61
LayerData::ExperimentType ExperimentType
Definition: TOPPViewBase.h:124
Convenience tab bar implementation.
Definition: EnhancedTabBar.h:60
QAction * projections_2d_
Definition: TOPPViewBase.h:447
ExperimentType::SpectrumType SpectrumType
Peak spectrum type.
Definition: TOPPViewBase.h:128

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:09 using doxygen 1.8.14