OpenStructure
sequence_viewer.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_SEQUENCE_VIEWER_SEQUENCE_VIEWER
20 #define OST_SEQUENCE_VIEWER_SEQUENCE_VIEWER
21 
22 /*
23  Author: Stefan Scheuber
24  */
25 
26 #ifndef Q_MOC_RUN
27 
29 
30 #include <ost/gfx/scene.hh>
31 #include <ost/gfx/gfx_object.hh>
32 #include <ost/gfx/entity.hh>
33 #include <ost/gui/widget.hh>
34 
35 #include <ost/gui/module_config.hh>
36 
37 
38 #include <QWidget>
39 #include <QActionGroup>
40 #include <QToolBar>
41 #include <QModelIndex>
42 #include <QItemSelection>
43 #endif
44 
45 namespace ost {
46 
47 namespace gui {
48 
49 class SeqSearchBar;
50 class SequenceModel;
51 class SequenceTableView;
52 
53 
56  Q_OBJECT
57 public:
58  SequenceViewer(bool stand_alone=true, bool observe_scene=false,
59  const QString& title="Sequence Viewer",
60  QWidget* parent=NULL);
62 
63  virtual void SelectionChanged(const gfx::GfxObjP& o, const mol::EntityView& view);
64 
65  virtual void AddEntity(const gfx::EntityP& entity);
66  virtual void RemoveEntity(const gfx::EntityP& entity);
67  void SetObserveScene(bool flag) { observe_scene_=flag; }
68  bool IsObservingScene() const { return observe_scene_; }
70 
72 
74 
75  virtual bool Restore(const QString&){ return true; };
76  virtual bool Save(const QString&){ return true; };
77 
78  virtual const QStringList& GetDisplayModes();
79  virtual const QStringList& GetDisplayModes(const seq::AlignmentHandle& alignment);
80  virtual const QStringList& GetDisplayModes(const gfx::EntityP& entity);
81 
82  virtual const QString& GetCurrentDisplayMode();
83  virtual const QString& GetCurrentDisplayMode(const seq::AlignmentHandle& alignment);
84  virtual const QString& GetCurrentDisplayMode(const gfx::EntityP& entity);
85 
87 signals:
89 public slots:
90  void ChangeDisplayMode(const QString&);
91  void ChangeDisplayMode(const seq::AlignmentHandle&, const QString&);
92  void ChangeDisplayMode(const gfx::EntityP&, const QString&);
93  void DisplayMenu();
94  //internal
95  void OnSearchBarUpdate(const QString&, bool, const QString&);
96 
97 private:
98  virtual void NodeAdded(const gfx::GfxNodeP& node);
99  virtual void NodeRemoved(const gfx::GfxNodeP& node);
100  void FitToContents();
101  void InitActions();
102  void InitView();
103  void InitSearchBar();
104  void InitMenuBar();
105  void UpdateSearchBar();
106  void SelectList(const QModelIndexList& list);
107  QToolBar* toolbar_;
108  SeqSearchBar* seq_search_bar_;
109  SequenceModel* model_;
110  SequenceTableView* seq_table_view_;
111 
112  ActionList action_list_;
113 
114  QActionGroup* display_mode_actions_;
115  bool observe_scene_;
116 private slots:
117  void ChangeDisplayMode();
118  void FindInSequence();
119  void SelectionModelChanged(const QItemSelection&, const QItemSelection&);
120  void DoubleClicked(const QModelIndex& index);
121  void MouseWheelEvent(QWheelEvent* event);
122  void CopyEvent(QKeyEvent* event);
123 
124 };
125 
126 }}
127 
128 #endif
Interface for observing graphical objects.
search bar to search in multiple sequence alignment
QTableView with first column not moving.
QTableView with first column not moving.
virtual const QStringList & GetDisplayModes(const seq::AlignmentHandle &alignment)
virtual const QStringList & GetDisplayModes()
virtual ActionList GetActions()
get Widget specific actions
virtual const QString & GetCurrentDisplayMode(const seq::AlignmentHandle &alignment)
void ChangeDisplayMode(const QString &)
SequenceViewer(bool stand_alone=true, bool observe_scene=false, const QString &title="Sequence Viewer", QWidget *parent=NULL)
virtual void RemoveEntity(const gfx::EntityP &entity)
virtual const QString & GetCurrentDisplayMode(const gfx::EntityP &entity)
virtual const QString & GetCurrentDisplayMode()
void OnSearchBarUpdate(const QString &, bool, const QString &)
virtual void RemoveAlignment(const seq::AlignmentHandle &alignment)
void SetObserveScene(bool flag)
virtual void SelectionChanged(const gfx::GfxObjP &o, const mol::EntityView &view)
Called when selection of an object changed.
virtual const QStringList & GetDisplayModes(const gfx::EntityP &entity)
virtual bool Restore(const QString &)
virtual void AddEntity(const gfx::EntityP &entity)
void ChangeDisplayMode(const gfx::EntityP &, const QString &)
void ChangeDisplayMode(const seq::AlignmentHandle &, const QString &)
void SetAlignment(const seq::AlignmentHandle &alignment)
virtual void AddAlignment(const seq::AlignmentHandle &alignment)
virtual bool Save(const QString &)
Base class for widgets.
Definition: widget.hh:40
definition of EntityView
Definition: entity_view.hh:86
representation of a multiple sequence alignemnt consisting of two or more sequences
#define DLLEXPORT_OST_GUI
def alignment(query_db, trg_db, resultDB, directory, resultDB_m8, sen=None, exe_path=None, start_sens=None, sens_steps=None, fmt=None)
Definition: mmseqs2.py:57
boost::shared_ptr< GfxNode > GfxNodeP
Definition: gfx_node_fw.hh:31
boost::shared_ptr< Entity > EntityP
Definition: entity_fw.hh:27
boost::shared_ptr< GfxObj > GfxObjP
QList< QAction * > ActionList
Definition: widget.hh:33
Definition: base.dox:1