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 #ifndef OPENMS_VISUAL_APPLICATIONS_TOPPVIEWBASE_H
36 #define OPENMS_VISUAL_APPLICATIONS_TOPPVIEWBASE_H
37 
38 // OpenMS_GUI config
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
41 //OpenMS
49 
52 
53 //STL
54 #include <map>
55 
56 //QT
57 #include <QtGui/QMainWindow>
58 #include <QtGui/QButtonGroup>
59 #include <QtGui/QActionGroup>
60 #include <QtCore/QStringList>
61 #include <QtCore/QProcess>
62 
63 class QAction;
64 class QComboBox;
65 class QLabel;
66 class QLineEdit;
67 class QListWidget;
68 class QListWidgetItem;
69 class QTreeWidget;
70 class QTreeWidgetItem;
71 class QDockWidget;
72 class QToolButton;
73 class QCloseEvent;
74 class QTextEdit;
75 class QCheckBox;
76 class QSplashScreen;
77 class QToolButton;
78 class QWorkspace;
79 
80 namespace OpenMS
81 {
82  class EnhancedWorkspace;
83  class EnhancedTabBar;
84  class Spectrum1DWidget;
85  class Spectrum2DWidget;
86  class Spectrum3DWidget;
87  class ToolsDialog;
88  class MultiGradientSelector;
89  class FileWatcher;
90 
105  class OPENMS_GUI_DLLAPI TOPPViewBase :
106  public QMainWindow,
107  public DefaultParamHandler
108  {
109  Q_OBJECT
110 
111  friend class TestTOPPView;
112 
113 public:
115 
116  //Feature map type
118  //Feature map managed type
120 
121  //Consensus feature map type
123  //Consensus map managed type
125 
126  //Peak map type
128  //Main managed data type (experiment)
133 
135  TOPPViewBase(QWidget* parent = 0);
137  ~TOPPViewBase();
138 
151  void addDataFile(const String& filename, bool show_options, bool add_to_recent, String caption = "", UInt window_id = 0, Size spectrum_id = 0);
152 
168  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);
169 
171  void loadFiles(const StringList& list, QSplashScreen* splash_screen);
172 
178  void loadPreferences(String filename = "");
179 
181  void savePreferences();
182 
184  Param getSpectrumParameters(UInt dim);
185 
187  const LayerData* getCurrentLayer() const;
188 
189  //@name Accessors for the main gui components.
190  //@brief The top level enhanced workspace and the EnhancedTabWidgets resing in the EnhancedTabBar.
192  EnhancedWorkspace* getWorkspace() const;
194 
196  SpectrumWidget* getActiveSpectrumWidget() const;
197 
199  Spectrum1DWidget* getActive1DWidget() const;
200 
202  Spectrum2DWidget* getActive2DWidget() const;
203 
205  Spectrum3DWidget* getActive3DWidget() const;
207 
209  SpectrumCanvas* getActiveCanvas() const;
210 
211 
213  SpectraIdentificationViewWidget* getSpectraIdentificationViewWidget();
214 
216  void showSpectrumWidgetInWindow(SpectrumWidget* sw, const String& caption);
217 
218 public slots:
220  void updateCurrentPath();
222  void showURL();
224  void openFileDialog();
226  void openExampleDialog();
228  void showGoToDialog();
230  void preferencesDialog();
232  void layerStatistics();
234  void editMetadata();
236  void layerActivated();
238  void layerZoomChanged();
240  void linkZoom();
242  void layerDeactivated();
244  void closeFile();
246  void updateToolBar();
248  void updateLayerBar();
250  void updateViewBar();
252  void viewChanged(int);
254  void updateFilterBar();
256  void updateMenu();
258  void updateTabBar(QWidget* w);
260  void tileVertical();
262  void tileHorizontal();
269  void showStatusMessage(std::string msg, OpenMS::UInt time);
271  void showCursorStatus(double mz, double rt);
273  void showCursorStatusInvert(double mz, double rt);
275  void showTOPPDialog();
277  void annotateWithID();
279  void showSpectrumGenerationDialog();
281  void showSpectrumAlignmentDialog();
283  void showSpectrumAs1D(int index);
284  void showSpectrumAs1D(std::vector<int, std::allocator<int> > indices);
286  void showCurrentPeaksAs2D();
288  void showCurrentPeaksAs3D();
290  void showAboutDialog();
292  void saveLayerAll();
294  void saveLayerVisible();
296  void toggleGridLines();
298  void toggleAxisLegends();
300  void showPreferences();
302  void metadataFileDialog();
303 
307  void setDrawMode1D(int);
308  void setIntensityMode(int);
309  void changeLayerFlag(bool);
310  void changeLabel(QAction*);
311  void changeUnassigned(QAction*);
312  void resetZoom();
313  void toggleProjections();
315 
317  void loadFile(QString);
318 
319 protected slots:
323  void layerSelectionChange(int);
326  void layerFilterVisibilityChange(bool);
328  void layerContextMenu(const QPoint& pos);
330  void logContextMenu(const QPoint& pos);
332  void layerVisibilityChange(QListWidgetItem* item);
334  void filterContextMenu(const QPoint& pos);
336  void filterEdit(QListWidgetItem* item);
338  void layerEdit(QListWidgetItem* /*item*/);
340 
342  void finishTOPPToolExecution(int exitCode, QProcess::ExitStatus exitStatus);
344  void abortTOPPTool();
346  void rerunTOPPTool();
348  void showSpectrumBrowser();
350  void showSpectrumMetaData(int spectrum_index);
351 
355  void closeByTab(int id);
358  void enhancedWorkspaceWindowChanged(int id);
360  void openRecentFile();
362  void copyLayer(const QMimeData* data, QWidget* source, int id = -1);
364 
366  void updateProcessLog();
367 
369  void fileChanged_(const String&);
370 protected:
372  void initializeDefaultParameters_();
373 
376  bool annotateMS1FromMassFingerprinting_(const FeatureMap& identifications);
377 
379  std::set<String> getFilenamesOfOpenFiles_();
380 
384  QStringList getFileList_(const String& path_overwrite = "");
385 
387  EnhancedTabBarWidgetInterface* window_(int id) const;
388 
390 
391  QDockWidget* layer_dock_widget_;
392  QDockWidget* views_dockwidget_;
393  QDockWidget* filter_dock_widget_;
395 
397 
401 
404 
406 
408  QCheckBox* filters_check_box_;
410 
413 
416 
419 
421 
424 
428  QToolBar* tool_bar_;
429  //common intensity modes
430 
431  QButtonGroup* intensity_button_group_;
432  //1D specific stuff
433 
434  QToolBar* tool_bar_1d_;
435  QButtonGroup* draw_group_1d_;
436 
437  //2D specific stuff
438  QToolBar* tool_bar_2d_peak_;
439  QToolBar* tool_bar_2d_feat_;
440  QToolBar* tool_bar_2d_cons_;
443  QAction* dm_hull_2d_;
444  QAction* dm_hulls_2d_;
445  QToolButton* dm_label_2d_;
446  QActionGroup* group_label_2d_;
447  QToolButton* dm_unassigned_2d_;
448  QActionGroup* group_unassigned_2d_;
449  QAction* dm_elements_2d_;
450  QAction* projections_2d_;
451  QAction* dm_ident_2d_;
453 
456 
459 
463  QLabel* message_label_;
466  QLabel* mz_label_;
468  QLabel* rt_label_;
470 
472 
473  void addRecentFile_(const String& filename);
476  void updateRecentMenu_();
478  QStringList recent_files_;
480  std::vector<QAction*> recent_actions_;
482 
483 
485 
486  void runTOPPTool_();
489  struct
490  {
500  QTime timer;
501  bool visible;
502  } topp_;
504 
506  void checkPreferences_();
508 
509  void closeEvent(QCloseEvent* event);
511 
513  enum LogState
514  {
517  LS_ERROR
518  };
520  void showLogMessage_(LogState state, const String& heading, const String& body);
521 
524 
526  void showTOPPDialog_(bool visible);
527 
531 
533  QTabWidget* views_tabwidget_;
534 
539 
540  // static helper functions
541 public:
543  static bool containsMS1Scans(const ExperimentType& exp);
544 
546  float estimateNoiseFromRandomMS1Scans(const ExperimentType& exp, UInt n_scans = 10);
547 
549  static bool hasMS1Zeros(const ExperimentType& exp);
550 
552  static bool hasPeptideIdentifications(const ExperimentType& map);
553 
554 private:
557  }; //class
558 
559 } //namespace
560 
561 #endif
String layer_name
Definition: TOPPViewBase.h:496
LayerData::ConsensusMapSharedPtrType ConsensusMapSharedPtrType
Definition: TOPPViewBase.h:124
QLabel * rt_label_
RT label for messages in the status bar.
Definition: TOPPViewBase.h:468
boost::shared_ptr< FeatureMap > FeatureMapSharedPtrType
SharedPtr on feature map.
Definition: LayerData.h:112
TOPPViewIdentificationViewBehavior * identificationview_behavior_
TOPPView behavior for the identification view.
Definition: TOPPViewBase.h:536
QDockWidget * filter_dock_widget_
Definition: TOPPViewBase.h:393
QAction * linkZoom_action_
Definition: TOPPViewBase.h:420
QButtonGroup * draw_group_1d_
Definition: TOPPViewBase.h:435
QToolBar * tool_bar_1d_
Definition: TOPPViewBase.h:434
Behavior of TOPPView in identification mode.
Definition: TOPPViewIdentificationViewBehavior.h:49
std::vector< QAction * > recent_actions_
list of the recently opened files actions (menu entries)
Definition: TOPPViewBase.h:480
A more convenient string class.
Definition: String.h:57
QAction * dm_hulls_2d_
Definition: TOPPViewBase.h:444
QToolBar * tool_bar_2d_ident_
Definition: TOPPViewBase.h:441
LayerData::ExperimentSharedPtrType ExperimentSharedPtrType
Definition: TOPPViewBase.h:129
bool visible
Definition: TOPPViewBase.h:501
LayerData::ConsensusMapType ConsensusMapType
Definition: TOPPViewBase.h:122
QListWidget * filters_
Definition: TOPPViewBase.h:407
Hierarchical visualization and selection of spectra.
Definition: SpectraViewWidget.h:52
Main window of TOPPView tool.
Definition: TOPPViewBase.h:105
String tool
Definition: TOPPViewBase.h:492
String file_name
Definition: TOPPViewBase.h:495
QToolBar * tool_bar_2d_feat_
Definition: TOPPViewBase.h:439
DataType
Dataset types.
Definition: LayerData.h:68
A container for features.
Definition: FeatureMap.h:94
Widget for 2D-visualization of peak map and feature map data.
Definition: Spectrum2DWidget.h:64
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
QToolBar * tool_bar_2d_cons_
Definition: TOPPViewBase.h:440
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:96
A container for consensus elements.
Definition: ConsensusMap.h:72
QToolBar * tool_bar_2d_peak_
Definition: TOPPViewBase.h:438
SpectraIdentificationViewWidget * spectra_identification_view_widget_
Definition: TOPPViewBase.h:399
QAction * dm_elements_2d_
Definition: TOPPViewBase.h:449
QAction * dm_hull_2d_
Definition: TOPPViewBase.h:443
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
FileWatcher * watcher_
Watcher that tracks file changes (in order to update the data in the different views) ...
Definition: TOPPViewBase.h:412
String in
Definition: TOPPViewBase.h:493
bool zoom_together_
Stores whether the individual windows should zoom together (be linked) or not.
Definition: TOPPViewBase.h:418
boost::shared_ptr< ExperimentType > ExperimentSharedPtrType
SharedPtr on MSExperiment.
Definition: LayerData.h:124
QTime timer
Definition: TOPPViewBase.h:500
QDockWidget * layer_dock_widget_
Definition: TOPPViewBase.h:391
bool watcher_msgbox_
Holds the messageboxes for each layer that are currently popped up (to avoid popping them up again...
Definition: TOPPViewBase.h:415
QAction * dm_ident_2d_
Definition: TOPPViewBase.h:451
Size spectrum_id
Definition: TOPPViewBase.h:498
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
SpectraViewWidget * spectra_view_widget_
Definition: TOPPViewBase.h:398
QLabel * mz_label_
m/z label for messages in the status bar
Definition: TOPPViewBase.h:466
TOPPViewSpectraViewBehavior * spectraview_behavior_
TOPPView behavior for the spectra view.
Definition: TOPPViewBase.h:538
LayerData::FeatureMapSharedPtrType FeatureMapSharedPtrType
Definition: TOPPViewBase.h:119
UInt window_id
Definition: TOPPViewBase.h:497
Param param
Definition: TOPPViewBase.h:491
QActionGroup * group_label_2d_
Definition: TOPPViewBase.h:446
Widget for visualization of several spectra.
Definition: Spectrum1DWidget.h:66
boost::shared_ptr< ConsensusMap > ConsensusMapSharedPtrType
SharedPtr on consensus features.
Definition: LayerData.h:118
Base class for spectrum widgets.
Definition: SpectrumWidget.h:74
Warning.
Definition: TOPPViewBase.h:516
QTabWidget * views_tabwidget_
Tabwidget that hold the different views on the loaded data.
Definition: TOPPViewBase.h:533
static const String CAPTION_3D_SUFFIX_
Suffix appended to caption of tabs when layer is shown in 3D.
Definition: TOPPViewBase.h:556
Widget for 3D-visualization of map data.
Definition: Spectrum3DWidget.h:54
String out
Definition: TOPPViewBase.h:494
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
Management and storage of parameters / INI files.
Definition: Param.h:75
Behavior of TOPPView in spectra view mode.
Definition: TOPPViewSpectraViewBehavior.h:49
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
QButtonGroup * intensity_button_group_
Definition: TOPPViewBase.h:431
QToolButton * dm_unassigned_2d_
Definition: TOPPViewBase.h:447
QToolBar * tool_bar_
Definition: TOPPViewBase.h:428
Notice.
Definition: TOPPViewBase.h:515
QStringList recent_files_
list of the recently opened files
Definition: TOPPViewBase.h:478
Tabular visualization / selection of identified spectra.
Definition: SpectraIdentificationViewWidget.h:54
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
Definition: EnhancedWorkspace.h:50
LogState
Log message states.
Definition: TOPPViewBase.h:513
QDockWidget * views_dockwidget_
Definition: TOPPViewBase.h:392
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:52
LayerData::FeatureMapType FeatureMapType
Definition: TOPPViewBase.h:117
QTextEdit * log_
Log output window.
Definition: TOPPViewBase.h:423
QListWidget * layer_manager_
Layer management widget.
Definition: TOPPViewBase.h:403
QActionGroup * group_unassigned_2d_
Definition: TOPPViewBase.h:448
EnhancedWorkspace * ws_
Main workspace.
Definition: TOPPViewBase.h:455
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
String current_path_
Definition: TOPPViewBase.h:530
EnhancedTabBar * tab_bar_
Tab bar. The address of the corresponding window to a tab is stored as an int in tabData() ...
Definition: TOPPViewBase.h:458
Watcher that monitors file changes.
Definition: FileWatcher.h:66
QCheckBox * filters_check_box_
Definition: TOPPViewBase.h:408
QMenu * add_2d_context_
Additional context menu for 2D layers.
Definition: TOPPViewBase.h:523
QToolButton * dm_label_2d_
Definition: TOPPViewBase.h:445
QAction * dm_precursors_2d_
Definition: TOPPViewBase.h:442
QProcess * process
Definition: TOPPViewBase.h:499
Class that stores the data for one layer.
Definition: LayerData.h:62
LayerData::ExperimentType ExperimentType
Definition: TOPPViewBase.h:127
Convenience tab bar implementation.
Definition: EnhancedTabBar.h:61
QAction * projections_2d_
Definition: TOPPViewBase.h:450
ExperimentType::SpectrumType SpectrumType
Peak spectrum type.
Definition: TOPPViewBase.h:131

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13