Add ReadOnly ThresholdWidget to MussaAlignedWindow
[mussa.git] / qui / MussaAlignedWindow.hpp
1 #ifndef MUSSA_ALIGNED_WINDOW_H
2 #define MUSSA_ALIGNED_WINDOW_H
3
4 #include <set>
5
6 #include <boost/shared_ptr.hpp>
7
8 #include <QMainWindow>
9 #include <QMenu>
10 #include <QToolBar>
11 #include "alg/mussa.hpp"
12 #include "qui/IntAction.hpp"
13 #include "qui/ZoomWidget.hpp"
14 #include "qui/ThresholdWidget.hpp"
15 #include "qui/seqbrowser/SequenceBrowserWidget.hpp"
16 #include "qui/SubanalysisWindow.hpp"
17
18 //! Show sequence alignments
19 class MussaAlignedWindow : public QMainWindow
20 {
21   Q_OBJECT 
22
23 public:
24   //! construct an aligned window for an analysis and selected paths
25   /*! \param analysis is a shared_ptr to a mussa analysis 
26    *  \param paths is a set of "paths" AKA integer offsets into the sequences stored in mussa
27    *  \param window points to a SubanalysisWindowRef, so we can pick interesting
28    *         sequence portions from both the mussa window and the sequence view window
29    *  \param parent is the typical Qt pointer to a parent widget
30    */ 
31   MussaAlignedWindow(MussaRef analysis, const std::set<int>& paths, 
32                      SubanalysisWindowRef window, QWidget *parent=0);
33
34 public slots:
35   //! launch a sub analysis
36   void createSubAnalysis();
37   //! use selected_paths[pathid] to set the starting position of our sequence
38   void setAlignment(int pathid);
39   //! toggle whether or not to show the aligned basepairs of a window
40   void toggleViewAlignment(int alignment_index);
41
42   //! just force updating the window
43   void update();
44
45 protected:
46   // figure out what Alignments we have (needed for setupAlignmentMenus)
47   void setSelectedPaths(MussaRef m, const std::set<int>& sel_paths);
48   // create our cations
49   void setupActions();
50   // create our menus
51   void setupMenus();
52   //! set menus (must be called after setSelectedPaths)
53   void setupAlignmentMenus();
54   void computeMatchLines();
55   
56   MussaRef analysis;  
57   //std::vector<Sequence> sequences;
58   //const std::set<int>& selected_paths;
59   std::vector<ConservedPath> selected_paths;
60   std::vector<bool> view_paths;
61   SubanalysisWindowRef subanalysis_window;
62   SequenceBrowserWidget browser;
63   QMenu pick_align_menu;
64   QMenu view_align_menu;
65
66   QAction *createSubAnalysisAction;
67   QAction *saveBrowserPixmapAction;
68
69   std::vector <IntAction *> pick_actions;
70   std::vector <IntAction *> view_actions;
71   ZoomWidget *zoom;
72   ThresholdWidget *threshold_widget;
73   QToolBar *alignTB;
74 };
75
76 //! reference to a MussaAlignedWindow
77 typedef boost::shared_ptr<MussaAlignedWindow> MussaAlignedWindowRef;
78 #endif