I passed a shared_ptr reference for the subanalysis window
from MussaWindow to MussaAlignedWindow so either window can be used
to customize the same subanalysis.
MussaAlignedWindow::MussaAlignedWindow(MussaRef m,
const set<int>& sel_paths,
MussaAlignedWindow::MussaAlignedWindow(MussaRef m,
const set<int>& sel_paths,
+ SubanalysisWindowRef window,
QWidget *parent)
: QMainWindow(parent),
analysis(m),
QWidget *parent)
: QMainWindow(parent),
analysis(m),
+ subanalysis_window(window),
pick_align_menu(tr("Choose Alignment")),
view_align_menu(tr("View Alignment")),
zoom(0),
pick_align_menu(tr("Choose Alignment")),
view_align_menu(tr("View Alignment")),
zoom(0),
void MussaAlignedWindow::setupActions()
{
void MussaAlignedWindow::setupActions()
{
+ // more cut-n-paste from MussaWindow
+ createSubAnalysisAction = new QAction(tr("Add to Subanalysis"), this);
+ connect(createSubAnalysisAction, SIGNAL(triggered()),
+ this, SLOT(createSubAnalysis()));
+
//Save pixel map action
saveBrowserPixmapAction = new QAction(tr("Save to image..."), this);
connect(saveBrowserPixmapAction, (SIGNAL(triggered())),
//Save pixel map action
saveBrowserPixmapAction = new QAction(tr("Save to image..."), this);
connect(saveBrowserPixmapAction, (SIGNAL(triggered())),
newMenu = menuBar()->addMenu(tr("&Edit"));
newMenu->addAction(browser.getCopySelectedSequenceAsFastaAction());
newMenu = menuBar()->addMenu(tr("&Edit"));
newMenu->addAction(browser.getCopySelectedSequenceAsFastaAction());
+ newMenu->addAction(createSubAnalysisAction);
+
+ // add some extra features to the context menu
+ QMenu *popupMenu = browser.getPopupMenu();
+ if (popupMenu) {
+ popupMenu->addAction(createSubAnalysisAction);
+ }
}
void MussaAlignedWindow::setupAlignmentMenus()
}
void MussaAlignedWindow::setupAlignmentMenus()
+// FIXME: this is a cut-n-paste from MussaWindow, perhaps they should be refactored to
+// some shared place
+void MussaAlignedWindow::createSubAnalysis()
+{
+ list<SequenceLocation> result;
+ SequenceLocationModel& model = subanalysis_window->getModel();
+ browser.copySelectedTracksAsSeqLocation(result);
+ for(list<SequenceLocation>::iterator result_itor = result.begin();
+ result_itor != result.end();
+ ++result_itor)
+ {
+ model.push_back(*result_itor);
+ }
+
+ if (not subanalysis_window->isVisible()) {
+ subanalysis_window->show();
+ }
+}
+
void MussaAlignedWindow::setAlignment(int alignment_index)
{
if (selected_paths.size() > 0) {
void MussaAlignedWindow::setAlignment(int alignment_index)
{
if (selected_paths.size() > 0) {
#include "qui/IntAction.hpp"
#include "qui/ZoomWidget.hpp"
#include "qui/seqbrowser/SequenceBrowserWidget.hpp"
#include "qui/IntAction.hpp"
#include "qui/ZoomWidget.hpp"
#include "qui/seqbrowser/SequenceBrowserWidget.hpp"
+#include "qui/SubanalysisWindow.hpp"
//! Show sequence alignments
class MussaAlignedWindow : public QMainWindow
//! Show sequence alignments
class MussaAlignedWindow : public QMainWindow
//! construct an aligned window for an analysis and selected paths
/*! \param analysis is a shared_ptr to a mussa analysis
* \param paths is a set of "paths" AKA integer offsets into the sequences stored in mussa
//! construct an aligned window for an analysis and selected paths
/*! \param analysis is a shared_ptr to a mussa analysis
* \param paths is a set of "paths" AKA integer offsets into the sequences stored in mussa
+ * \param window points to a SubanalysisWindowRef, so we can pick interesting
+ * sequence portions from both the mussa window and the sequence view window
* \param parent is the typical Qt pointer to a parent widget
*/
* \param parent is the typical Qt pointer to a parent widget
*/
- MussaAlignedWindow(MussaRef analysis, const std::set<int>& paths, QWidget *parent=0);
+ MussaAlignedWindow(MussaRef analysis, const std::set<int>& paths,
+ SubanalysisWindowRef window, QWidget *parent=0);
+ //! launch a sub analysis
+ void createSubAnalysis();
//! use selected_paths[pathid] to set the starting position of our sequence
void setAlignment(int pathid);
//! toggle whether or not to show the aligned basepairs of a window
//! use selected_paths[pathid] to set the starting position of our sequence
void setAlignment(int pathid);
//! toggle whether or not to show the aligned basepairs of a window
//const std::set<int>& selected_paths;
std::vector<ConservedPath> selected_paths;
std::vector<bool> view_paths;
//const std::set<int>& selected_paths;
std::vector<ConservedPath> selected_paths;
std::vector<bool> view_paths;
+ SubanalysisWindowRef subanalysis_window;
SequenceBrowserWidget browser;
QMenu pick_align_menu;
QMenu view_align_menu;
SequenceBrowserWidget browser;
QMenu pick_align_menu;
QMenu view_align_menu;
+ QAction *createSubAnalysisAction;
QAction *saveBrowserPixmapAction;
std::vector <IntAction *> pick_actions;
QAction *saveBrowserPixmapAction;
std::vector <IntAction *> pick_actions;
ZoomWidget *zoom;
QToolBar *alignTB;
};
ZoomWidget *zoom;
QToolBar *alignTB;
};
+
+//! reference to a MussaAlignedWindow
+typedef boost::shared_ptr<MussaAlignedWindow> MussaAlignedWindowRef;
QObject::tr("you should probably select some paths "
"first"));
} else {
QObject::tr("you should probably select some paths "
"first"));
} else {
- boost::shared_ptr<MussaAlignedWindow> ma_win(
- new MussaAlignedWindow(analysis, selected_paths)
+ MussaAlignedWindowRef ma_win(
+ new MussaAlignedWindow(analysis, selected_paths, subanalysis_window)
);
aligned_windows.push_back(ma_win);
);
aligned_windows.push_back(ma_win);
std::list<boost::shared_ptr<MussaAlignedWindow> > aligned_windows;
MotifEditor *motif_editor;
MussaSetupDialog *setup_analysis_dialog;
std::list<boost::shared_ptr<MussaAlignedWindow> > aligned_windows;
MotifEditor *motif_editor;
MussaSetupDialog *setup_analysis_dialog;
- boost::shared_ptr<SubanalysisWindow> subanalysis_window;
+ SubanalysisWindowRef subanalysis_window;
// display our wonderful mussa output
SequenceBrowserWidget *browser;
// display our wonderful mussa output
SequenceBrowserWidget *browser;
SequenceLocationModel model;
};
SequenceLocationModel model;
};
+
+//! reference to a subanalysis window
+typedef boost::shared_ptr<SubanalysisWindow> SubanalysisWindowRef;