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