add nl to end of 3 files
[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/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
51 protected:
52   // figure out what Alignments we have (needed for setupAlignmentMenus)
53   void setSelectedPaths(MussaRef m, const std::set<int>& sel_paths);
54   // create our cations
55   void setupActions();
56   // create our menus
57   void setupMenus();
58   //! set menus (must be called after setSelectedPaths)
59   void setupAlignmentMenus();
60   void computeMatchLines();
61   
62   MussaRef analysis;
63   boost::shared_ptr<QDir> default_dir;
64   //std::vector<Sequence> sequences;
65   //const std::set<int>& selected_paths;
66   std::vector<ConservedPath> selected_paths;
67   std::vector<bool> view_paths;
68   SubanalysisWindowRef subanalysis_window;
69   SequenceBrowserWidget browser;
70   QMenu pick_align_menu;
71   QMenu view_align_menu;
72
73   QAction *createSubAnalysisAction;
74   QAction *saveBrowserPixmapAction;
75
76   std::vector <IntAction *> pick_actions;
77   std::vector <IntAction *> view_actions;
78   ZoomWidget *zoom;
79   ThresholdWidget *threshold_widget;
80   QToolBar *alignTB;
81 };
82
83 //! reference to a MussaAlignedWindow
84 typedef boost::shared_ptr<MussaAlignedWindow> MussaAlignedWindowRef;
85 #endif