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