1 #include "qui/MussaWindow.hpp"
2 #include "mussa_exceptions.hpp"
6 #include <QApplication>
7 #include <QAssistantClient>
9 #include <QDesktopServices>
11 #include <QFileDialog>
12 #include <QHBoxLayout>
15 #include <QMessageBox>
19 #include <QStringList>
27 #include <boost/filesystem/path.hpp>
28 #include <boost/filesystem/operations.hpp>
29 #include <boost/filesystem/convenience.hpp>
30 namespace fs = boost::filesystem;
31 #include <boost/bind.hpp>
35 static void init_resources() {
36 static bool resources_loaded = false;
37 if (not resources_loaded) {
38 Q_INIT_RESOURCE(icons);
39 resources_loaded = true;
43 MussaWindow::MussaWindow(MussaRef analysis_, QWidget *parent) :
47 setup_analysis_dialog(0),
55 createNewAnalysisAction(0),
56 createSubAnalysisAction(0),
58 loadMotifListAction(0),
60 loadSavedAnalysisAction(0),
61 mussaManualAssistantAction(0),
62 newMussaWindowAction(0),
63 saveMotifListAction(0),
64 showMussaViewToolbarAction(0),
65 toggleMotifsAction(0),
66 saveBrowserPixmapAction(0),
68 viewMussaAlignmentAction(0),
73 default_dir.reset(new QDir(QDir::home().absolutePath()));
80 setWindowIcon(QIcon(":/icons/mussa.png"));
82 setCentralWidget(browser);
83 // well updatePosition isn't quite right as we really just need
85 connect(this, SIGNAL(changedAnnotations()), browser, SLOT(update()));
86 connect(this, SIGNAL(changedMotifs()), this, SLOT(updateAnnotations()));
87 connect(browser, SIGNAL(basepairsCopied(size_t)),
88 this, SLOT(showBasePairsCopied(size_t)));
89 connect(zoom, SIGNAL(valueChanged(double)),
90 browser, SLOT(setZoom(double)));
91 mussaViewTB->addWidget(zoom);
93 // threshold range is set in updateAnalysis
94 connect(threshold, SIGNAL(thresholdChanged(int)),
95 this, SLOT(setSoftThreshold(int)));
96 mussaViewTB->addWidget(threshold);
98 addToolBar(mussaViewTB);
100 statusBar()->showMessage("Welcome to mussa", 2000);
102 // FIXME: we should start refactoring the connect call to updateAnalysis or something
104 connect(analysis.get(), SIGNAL(progress(const QString&, int, int)),
105 this, SLOT(updateProgress(const QString&, int, int)));
106 connect(analysis.get(), SIGNAL(isModified(bool)),
107 this, SLOT(updateAnalysisModified(bool)));
113 void MussaWindow::setAnalysis(MussaRef new_analysis)
115 if (new_analysis != 0) {
116 // only switch mussas if we loaded without error
118 //std::cout << "analysis soft: " << analysis->get_soft_threshold()
119 // << " new analysis soft: " << new_analysis->get_soft_threshold()
121 analysis.swap(new_analysis);
122 //std::cout << "after swap soft thres: " << analysis->get_soft_threshold()
124 threshold->disconnect(this);
125 threshold->reset(analysis->get_threshold(),
126 analysis->get_window(),
127 analysis->get_soft_threshold());
128 connect(threshold, SIGNAL(thresholdChanged(int)),
129 this, SLOT(setSoftThreshold(int)));
135 void MussaWindow::setupActions()
137 // we really don't want to run this more than once.
138 assert (closeAction == 0);
140 // the ever popular about box
141 aboutAction = new QAction(tr("&About"), this);
142 connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
143 aboutAction->setIcon(QIcon(":/icons/info.png"));
146 closeAction = new QAction(tr("&Close"), this);
147 closeAction->setStatusTip(tr("Close this window"));
148 connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
149 closeAction->setIcon(QIcon(":/icons/exit.png"));
151 createNewAnalysisAction = new QAction(tr("Create &New Analysis"), this);
152 connect(createNewAnalysisAction, SIGNAL(triggered()),
153 this, SLOT(createNewAnalysis()));
154 createNewAnalysisAction->setIcon(QIcon(":/icons/filenew.png"));
155 createNewAnalysisAction->setShortcut(Qt::CTRL | Qt::Key_N);
157 createSubAnalysisAction = new QAction(tr("Add to Subanalysis"), this);
158 connect(createSubAnalysisAction, SIGNAL(triggered()),
159 this, SLOT(createSubAnalysis()));
161 saveAnalysisAction = new QAction(tr("&Save Analysis"), this);
162 connect(saveAnalysisAction, SIGNAL(triggered()),
163 this, SLOT(saveAnalysis()));
164 saveAnalysisAction->setIcon(QIcon(":/icons/filesave.png"));
165 saveAnalysisAction->setShortcut(Qt::CTRL | Qt::Key_S);
167 saveAnalysisAsAction = new QAction(tr("Save Analysis &As"), this);
168 connect(saveAnalysisAsAction, SIGNAL(triggered()),
169 this, SLOT(saveAnalysisAs()));
170 saveAnalysisAsAction->setIcon(QIcon(":/icons/filesave.png"));
172 editMotifsAction = new QAction(tr("Edit Motifs"), this);;
173 connect(editMotifsAction, SIGNAL(triggered()), this, SLOT(editMotifs()));
175 loadMotifListAction = new QAction(tr("Open Motif List"), this);
176 connect(loadMotifListAction, SIGNAL(triggered()),
177 this, SLOT(loadMotifList()));
178 loadMotifListAction->setIcon(QIcon(":/icons/fileopen.png"));
180 loadMupaAction = new QAction(tr("Create Analysis from File"), this);
181 connect(loadMupaAction, SIGNAL(triggered()),
182 this, SLOT(loadMupa()));
183 loadMupaAction->setIcon(QIcon(":/icons/fileopen.png"));
185 loadSavedAnalysisAction = new QAction(tr("&Open Existing &Analysis"), this);
186 connect(loadSavedAnalysisAction, SIGNAL(triggered()),
187 this, SLOT(loadSavedAnalysis()));
188 loadSavedAnalysisAction->setIcon(QIcon(":/icons/fileopen.png"));
189 loadSavedAnalysisAction->setShortcut(Qt::CTRL | Qt::Key_O);
191 mussaManualAssistantAction = new QAction(tr("Mussagl Manual..."), this);
192 mussaManualAssistantAction->setIcon(QIcon(":/icons/contents.png"));
193 connect(mussaManualAssistantAction, SIGNAL(triggered()),
194 this, SLOT(showManual()));
196 newMussaWindowAction = new QAction(tr("&New Mussa Window"), this);
197 newMussaWindowAction->setStatusTip("open another mussa window to allow comparing results");
198 connect(newMussaWindowAction, SIGNAL(triggered()),
199 this, SLOT(newMussaWindow()));
200 newMussaWindowAction->setIcon(QIcon(":/icons/window_new.png"));
202 saveMotifListAction = new QAction(tr("Save Motifs"), this);
203 connect(saveMotifListAction, SIGNAL(triggered()),
204 this, SLOT(saveMotifList()));
205 saveMotifListAction->setIcon(QIcon(":/icons/filesave.png"));
207 showMussaViewToolbarAction = new QAction(tr("Show Toolbar"), this);
208 connect(showMussaViewToolbarAction, SIGNAL(triggered()),
209 this, SLOT(showMussaToolbar()));
210 showMussaViewToolbarAction->setCheckable(true);
211 showMussaViewToolbarAction->setChecked(true);
213 toggleMotifsAction = new QAction(tr("Toggle Motifs"), this);
214 connect(toggleMotifsAction, SIGNAL(triggered()),
215 this, SLOT(toggleMotifs()));
216 toggleMotifsAction->setCheckable(true);
217 toggleMotifsAction->setIcon(QIcon(":/icons/motif_icon.png"));
218 toggleMotifsAction->setWhatsThis(tr("Toggle motif annotations on/off\n\n"
219 "You can load motif annotations via "
220 "'File->Load Motif List' menu option."));
222 //Save pixel map action
223 saveBrowserPixmapAction = new QAction(tr("Save to image..."), this);
225 connect(saveBrowserPixmapAction, (SIGNAL(triggered())),
226 browser, SLOT(promptSaveBrowserPixmap()));
227 saveBrowserPixmapAction->setIcon(QIcon(":/icons/image2.png"));
230 viewMussaAlignmentAction = new QAction(tr("View sequence alignment"), this);
231 connect(viewMussaAlignmentAction, SIGNAL(triggered()),
232 this, SLOT(viewMussaAlignment() ));
233 viewMussaAlignmentAction->setWhatsThis(tr("Create a zoomed in window "
234 "showing alignment of the seqcomp "
237 whatsThisAction = QWhatsThis::createAction(this);
238 whatsThisAction->setIcon(QIcon(":/icons/help.png"));
243 void MussaWindow::closeEvent(QCloseEvent *event)
245 if(isClearingAnalysisSafe()) {
252 void MussaWindow::setupMainMenu()
254 // we need to run setupActions first
255 assert (closeAction != 0);
257 QMenu *newMenu = menuBar()->addMenu(tr("&File"));
259 newMenu->addAction(newMussaWindowAction);
260 newMenu->addAction(createNewAnalysisAction);
261 newMenu->addAction(loadMupaAction);
262 newMenu->addAction(loadSavedAnalysisAction);
263 newMenu->addAction(saveAnalysisAction);
264 newMenu->addAction(saveAnalysisAsAction);
265 newMenu->addSeparator();
266 newMenu->addAction(loadMotifListAction);
267 newMenu->addAction(saveMotifListAction);
268 newMenu->addSeparator();
269 newMenu->addAction(saveBrowserPixmapAction);
270 newMenu->addSeparator();
271 newMenu->addAction(closeAction);
273 newMenu = menuBar()->addMenu(tr("&Edit"));
274 newMenu->addAction(editMotifsAction);
275 if (browser) newMenu->addAction(browser->getCopySelectedSequenceAsStringAction());
276 if (browser) newMenu->addAction(browser->getCopySelectedSequenceAsFastaAction());
277 newMenu->addAction(createSubAnalysisAction);
278 if (browser) newMenu->addAction(browser->getEditSequencePropertiesAction());
280 newMenu = menuBar()->addMenu(tr("&View"));
281 newMenu->addAction(viewMussaAlignmentAction);
282 newMenu->addAction(showMussaViewToolbarAction);
284 newMenu = menuBar()->addMenu(tr("&Help"));
285 newMenu->addAction(mussaManualAssistantAction);
286 newMenu->addAction(whatsThisAction);
287 newMenu->addSeparator();
288 newMenu->addAction(aboutAction);
290 // add some extra features to the context menu
292 QMenu *popupMenu = browser->getPopupMenu();
294 popupMenu->addAction(viewMussaAlignmentAction);
295 popupMenu->addAction(createSubAnalysisAction);
300 void MussaWindow::setupWidgets()
302 setup_analysis_dialog = new MussaSetupDialog;
303 subanalysis_window.reset(new SubanalysisWindow(analysis));
304 browser = new SequenceBrowserWidget(default_dir);
305 mussaViewTB = new QToolBar("Path Views", this);
306 zoom = new ZoomWidget(mussaViewTB);
307 threshold = new ThresholdWidget(mussaViewTB);
310 void MussaWindow::setupAssistant()
312 #if defined(QT_QTASSISTANT_FOUND)
313 QStringList manualAssistantArgs;
314 manualAssistantArgs = QStringList();
315 manualAssistantArgs << "-profile" << "./doc/manual/mussagl_manual.adp";
316 manualAssistant = new QAssistantClient("assistant", this);
317 manualAssistant->setArguments(manualAssistantArgs);
318 connect(manualAssistant, SIGNAL(error(QString)),
319 this, SLOT(assistantError(QString)));
323 void MussaWindow::about()
326 msg += "Welcome to Multiple Species Sequence Analysis\n";
327 msg += "(c) 2005-2006 California Institute of Technology\n";
328 msg += "Diane Trout, Tristan De Buysscher, Brandon King\n";
330 msg += mussa_version;
336 msg += (char *)glGetString(GL_VERSION);
338 QMessageBox::about(this, tr("About mussa"), msg);
341 void MussaWindow::clear()
343 if (motif_editor != 0) {
344 motif_editor->hide();
348 aligned_windows.clear();
352 void MussaWindow::createNewAnalysis()
355 // ideally we should open a new window if there's an analysis
356 // but this should work for the moment.
357 if (not isClearingAnalysisSafe()) return;
359 if (setup_analysis_dialog->exec()) {
360 setAnalysis(setup_analysis_dialog->getMussa());
362 } catch(mussa_error e) {
363 QString msg(e.what());
364 QMessageBox::warning(this, tr("Create New Analysis"), msg);
368 void MussaWindow::createSubAnalysis()
370 list<SequenceLocation> result;
371 SequenceLocationModel& model = subanalysis_window->getModel();
372 browser->copySelectedTracksAsSeqLocation(result);
373 for(list<SequenceLocation>::iterator result_itor = result.begin();
374 result_itor != result.end();
377 model.push_back(*result_itor);
380 if (not subanalysis_window->isVisible()) {
381 subanalysis_window->show();
385 void MussaWindow::saveAnalysis()
387 // if we've got an analysis
388 if (analysis and not analysis->empty()) {
389 // if it doesn't have a name we need to pick one
390 if (analysis->get_analysis_path().empty()) {
393 // if we've got a name, has it changed any?
394 // this doesn't work when a sequence changes something (like its
396 //else if (analysis->is_dirty())
399 } catch (std::exception e) {
400 QMessageBox::critical(this,
401 tr("Mussa Save Error"),
403 QMessageBox::Ok, 0, 0);
410 void MussaWindow::saveAnalysisAs()
412 std::auto_ptr<QFileDialog> dialog(new QFileDialog(this));
413 dialog->setAcceptMode(QFileDialog::AcceptSave);
414 dialog->setFileMode(QFileDialog::AnyFile);
415 dialog->setDirectory(*default_dir);
417 QStringList fileNames;
418 if (not dialog->exec()) {
421 fileNames = dialog->selectedFiles();
423 if (fileNames.size() != 1) {
427 fs::path save_path(fileNames[0].toStdString(), fs::native);
428 // do you want to overwrite?
429 if (fs::exists(save_path) and
430 QMessageBox::question(
432 tr("Overwrite File? -- Mussa"),
433 tr("A file called %1 already exists"
434 "do you want to overwrite it?")
436 tr("&Yes"), tr("&No"),
441 analysis->save(save_path);
442 fs::path normalized_path = (save_path / "..").normalize();
443 default_dir->setPath(normalized_path.native_directory_string().c_str());
444 } catch (std::exception e) {
445 QMessageBox::critical(this,
446 tr("Mussa Save Error"),
448 QMessageBox::Ok, 0, 0);
452 bool MussaWindow::isClearingAnalysisSafe()
454 if (analysis and not analysis->empty() and analysis->is_dirty()) {
455 switch (QMessageBox::question(
457 tr("Save Unsaved Changes -- Mussa"),
458 tr("There are unsaved changes,\ndo you want to save?"),
459 tr("&Yes"), tr("&No"), tr("&Cancel"),
474 throw runtime_error("isClearingAnalysis QMesageBox failure");
477 // if we're here we've been saved and can replace
481 void MussaWindow::editMotifs()
483 if (not motif_editor) {
484 motif_editor = new MotifEditor(analysis);
485 connect(motif_editor, SIGNAL(changedMotifs()),
486 this, SLOT(updateAnnotations()));
488 motif_editor->show();
491 void MussaWindow::loadMotifList()
493 QString caption("Mussa Load Motifs");
494 QString filter("Motif list(*.txt *.mtl)");
495 QString path = QFileDialog::getOpenFileName(this,
497 default_dir->absolutePath(),
502 // try to load safely
504 fs::path converted_path(path.toStdString(), fs::native);
505 analysis->load_motifs(converted_path);
506 default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
507 emit changedMotifs();
508 } catch (std::exception e) {
509 QString msg("Unable to load ");
513 QMessageBox::warning(this, caption, msg);
517 void MussaWindow::saveMotifList()
519 QString caption("Mussa Save Motifs");
520 QString filter("Motif list(*.txt *.mtl)");
521 QString path = QFileDialog::getSaveFileName(this,
523 default_dir->absolutePath(),
528 // try to load safely
530 fs::path converted_path(path.toStdString(), fs::native);
531 if (fs::extension(converted_path).size() == 0) {
532 // no extension, so add one
533 fs::path base_path = converted_path.branch_path();
534 fs::path filename(converted_path.leaf() + ".mtl", fs::native);
535 converted_path = base_path / filename;
537 analysis->save_motifs(converted_path);
538 default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
539 } catch (std::exception e) {
540 QString msg("Unable to save ");
544 QMessageBox::warning(this, caption, msg);
547 void MussaWindow::loadMupa()
549 QString caption("Load a mussa parameter file");
550 QString filter("Mussa Parameters (*.mupa)");
551 QString mupa_path = QFileDialog::getOpenFileName(
554 default_dir->absolutePath(),
558 if (mupa_path.isNull())
560 // try to load safely
562 // ideally we should open a new window if there's an analysis
563 // but this should work for the moment.
564 if (not isClearingAnalysisSafe()) return;
566 MussaRef m = Mussa::init();
567 fs::path converted_path(mupa_path.toStdString(), fs::native);
568 connect(m.get(), SIGNAL(progress(const QString&, int, int)),
569 this, SLOT(updateProgress(const QString&, int, int)));
570 m->load_mupa_file(converted_path);
574 // grab the path ignoring the mupa file portion
575 default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
576 } catch (mussa_load_error e) {
577 QString msg("Unable to load ");
581 QMessageBox::warning(this, "Load Parameter", msg);
583 assert (analysis != 0);
586 void MussaWindow::loadSavedAnalysis()
588 QString caption("Load a previously run analysis");
589 QString muway_dir = QFileDialog::getExistingDirectory(
592 default_dir->absolutePath()
595 if (muway_dir.isNull())
597 // try to safely load
599 // ideally we should open a new window if there's an analysis
600 // but this should work for the moment.
601 if (not isClearingAnalysisSafe()) return;
603 MussaRef m = Mussa::init();
604 fs::path converted_path(muway_dir.toStdString(), fs::native);
605 connect(m.get(), SIGNAL(progress(const QString&, int, int)),
606 this, SLOT(updateProgress(const QString&, int, int)));
607 m->load(converted_path);
608 // only switch mussas if we loaded without error
609 if (analysis->empty()) {
610 // our current window is empty so load and replace.
613 default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
615 MussaWindow *win = new MussaWindow(m);
617 win->default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
620 } catch (boost::filesystem::filesystem_error e) {
621 QString msg("Unable to load ");
625 QMessageBox::warning(this, "Load Parameter", msg);
626 } catch (mussa_load_error e) {
627 QString msg("Unable to load ");
631 QMessageBox::warning(this, "Load Parameter", msg);
633 assert (analysis != 0);
636 void MussaWindow::newMussaWindow()
638 MussaWindow *win = new MussaWindow(Mussa::init());
639 win->default_dir = default_dir;
643 void MussaWindow::setSoftThreshold(int value)
645 //std::cout << "Soft: " << analysis->get_soft_threshold()
646 // << " Value: " << value << "\n";
647 if (analysis->get_soft_threshold() != value) {
648 threshold->setEnabled( false );
649 //std::cout << "Updating!!!!\n";
650 analysis->set_soft_threshold(value);
654 threshold->setEnabled( true );
658 // std::cout << "NOT Updating!!!!\n";
662 void MussaWindow::showMussaToolbar()
664 if (mussaViewTB->isVisible())
670 void MussaWindow::showBasePairsCopied(size_t bp_copied)
672 QString msg("Copied ");
674 num.setNum(bp_copied);
675 msg += num + " base pairs";
676 statusBar()->showMessage(msg, 5000);
680 void MussaWindow::toggleMotifs()
685 void MussaWindow::showManual()
687 #if defined(QT_QTASSISTANT_FOUND)
688 if (manualAssistant) {
689 manualAssistant->openAssistant();
691 QMessageBox::warning(this,
692 tr("Mussa Help Error"),
693 tr("QtAssistant not setup correctly"),
695 QMessageBox::NoButton,
696 QMessageBox::NoButton);
699 QUrl manual_url("http://woldlab.caltech.edu/~king/mussagl_manual/");
700 if (not QDesktopServices::openUrl(manual_url)) {
701 QMessageBox::warning(this,
702 tr("Mussa Help Error"),
703 tr("Unable to launch webbrowser"),
705 QMessageBox::NoButton,
706 QMessageBox::NoButton);
708 #endif //QT_QTASSISTANT_FOUND
711 void MussaWindow::assistantError(QString message)
713 //std::cout << "QAssistantError: " << message.toStdString() << "\n";
714 QMessageBox::warning ( this, "Warning: Mussagl Manual", message,
716 QMessageBox::NoButton);
719 void MussaWindow::NotImplementedBox()
721 QMessageBox::warning(this, QObject::tr("mussa"), QObject::tr("Not implemented yet"));
724 void MussaWindow::viewMussaAlignment()
726 const set<int>& selected_paths = browser->selectedPaths();
727 if (selected_paths.size() == 0 ) {
728 QMessageBox::warning(this,
729 QObject::tr("mussa"),
730 QObject::tr("you should probably select some paths "
733 MussaAlignedWindowRef ma_win(
734 new MussaAlignedWindow(analysis, default_dir, selected_paths, subanalysis_window)
737 aligned_windows.push_back(ma_win);
738 connect(this, SIGNAL(changedAnnotations()),
739 aligned_windows.back().get(), SLOT(update()));
740 aligned_windows.back()->show();
744 void MussaWindow::updateAnalysis()
746 const Mussa::vector_sequence_type& seqs = analysis->sequences();
747 browser->setSequences(seqs, analysis->colorMapper());
748 assert(browser->sequences().size() == analysis->size());
750 // setRange eventually emits something that causes updateLinks to be called
751 // but it's possible for us to not have had a chance to set out sequences
753 threshold->setRange(analysis->get_threshold(),analysis->get_window());
754 threshold->setBasepairThreshold(analysis->get_soft_threshold());
757 zoom->setValue(browser->zoom());
760 void MussaWindow::updateAnnotations()
762 // motifs were changed in the sequences by
763 // Mussa::update_sequences_motifs
764 emit changedAnnotations();
768 void MussaWindow::updateLinks()
770 if(browser->sequences().size() == 0) {
771 // we don't have any sequences load so we have no business setting links
775 browser->clear_links();
776 bool reversed = false;
777 const NwayPaths& nway = analysis->paths();
779 typedef list<ConservedPath> conserved_paths;
780 typedef conserved_paths::const_iterator const_conserved_paths_itor;
781 for(const_conserved_paths_itor path_itor = nway.refined_pathz.begin();
782 path_itor != nway.refined_pathz.end();
785 // since we were drawing to the start of a window, and opengl lines
786 // are centered around the two connecting points our lines were slightly
787 // offset. the idea of window_offset is to adjust them to the
788 // right for forward compliment or left for reverse compliment
789 // FIXME: figure out how to unit test these computations
790 //GLfloat window_offset = (path_itor->window_size)/2.0;
792 size_t track_len = path_itor->track_indexes.size();
793 vector<int> normalized_path;
794 normalized_path.reserve(track_len);
795 vector<bool> rc_flags(false, track_len);
796 for (size_t track_i=0; track_i != track_len; ++track_i)
798 int x = path_itor->track_indexes[track_i];
799 // at some point when we modify the pathz data structure to keep
800 // track of the score we can put grab the depth here.
802 // are we reverse complimented?
810 normalized_path.push_back(x);
811 rc_flags.push_back(reversed);
813 browser->link(normalized_path, rc_flags, path_itor->window_size);
819 MussaWindow::updateProgress(const QString& description, int current, int max)
822 if (current == max) {
823 if (progress_dialog != 0) {
824 progress_dialog->hide();
825 delete progress_dialog;
829 // if we're starting, create the dialog
830 if (progress_dialog == 0) {
831 QString cancel("Cancel");
832 progress_dialog = new QProgressDialog(description, cancel, current, max, this);
833 progress_dialog->show();
835 // just update the dialog
836 progress_dialog->setValue(current);
839 qApp->processEvents();
842 void MussaWindow::updateAnalysisModified(bool is_modified)
844 setWindowModified(is_modified);
847 void MussaWindow::updateTitle()
850 QString title(analysis->get_title().c_str());
852 setWindowTitle(title);