X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=qui%2Fmussa_setup_dialog%2FMussaSetupWidget.cpp;h=c116a9a2e12fc6e9983760a6f80f83906cd69961;hb=4c1d1e263deea85ab00823282c5ca5fc00fa8c26;hp=63e9845274c6ed9c43c8ff9064d662dff27a332c;hpb=3798c713abe45f51c256c2fd47bdbd594662b9cb;p=mussa.git diff --git a/qui/mussa_setup_dialog/MussaSetupWidget.cpp b/qui/mussa_setup_dialog/MussaSetupWidget.cpp index 63e9845..c116a9a 100644 --- a/qui/mussa_setup_dialog/MussaSetupWidget.cpp +++ b/qui/mussa_setup_dialog/MussaSetupWidget.cpp @@ -22,42 +22,67 @@ namespace fs = boost::filesystem; MussaSetupWidget::MussaSetupWidget(QWidget *parent) : QWidget(parent), - createPushButton(tr("Create")), - cancelPushButton(tr("Cancel")), + analysisNameLineEdit(new QLineEdit), + windowEdit(new QSpinBox), + thresholdEdit(new QSpinBox), + numOfSequencesSpinBox(new QSpinBox), + createPushButton(new QPushButton(tr("Create"))), + cancelPushButton(new QPushButton(tr("Cancel"))), seqSetupFrame(0) { - + analysisNameLineEdit = new QLineEdit; + windowEdit = new QSpinBox; + thresholdEdit = new QSpinBox; + numOfSequencesSpinBox = new QSpinBox; + createPushButton = new QPushButton(tr("Create")); + cancelPushButton = new QPushButton(tr("Cancel")); + // Analysis name QLabel *analysisNameLabel = new QLabel(tr("Analysis Name")); - analysisNameLabel->setBuddy(&analysisNameLineEdit); + analysisNameLabel->setBuddy(analysisNameLineEdit); + analysisNameLabel->setWhatsThis("Meaningful name for your analysis "); + analysisNameLineEdit->setWhatsThis("Meaningful name for your analysis "); // Window + windowEdit->setMinimum(1); + windowEdit->setValue(30); + windowEdit->setWhatsThis("Sliding window size to use in analysis.\n\nSee Mussagl Manual for more information by selecting the 'Help > Mussagl Manual' menu option. "); QLabel *windowLabel = new QLabel(tr("Window (nt)")); - windowLabel->setBuddy(&windowLineEdit); + windowLabel->setBuddy(windowEdit); + windowLabel->setWhatsThis("Sliding window size to use in analysis.\n\nSee Mussagl Manual for more information by selecting the 'Help > Mussagl Manual' menu option. "); // Threshold + thresholdEdit->setMinimum(1); + thresholdEdit->setMaximum(windowEdit->value()); + thresholdEdit->setValue(21); + thresholdEdit->setWhatsThis("Threshold of minimum number of matches required in a window to be considered a match.\n\nSee Mussagl Manual for more information by selecting the 'Help > Mussagl Manual' menu option. "); QLabel *thresholdLabel = new QLabel(tr("Threshold (nt)")); - thresholdLabel->setBuddy(&thresholdLineEdit); + thresholdLabel->setBuddy(thresholdEdit); + thresholdLabel->setWhatsThis("Threshold of minimum number of matches required in a window to be considered a match.\n\nSee Mussagl Manual for more information by selecting the 'Help > Mussagl Manual' menu option. "); + connect(windowEdit, SIGNAL(valueChanged(int)), + this, SLOT(updateThreshold(int))); // Number of sequences QLabel *numOfSequencesLabel = new QLabel(tr("Number of sequences")); - numOfSequencesLabel->setBuddy(&numOfSequencesSpinBox); - numOfSequencesSpinBox.setMinimum(1); + numOfSequencesLabel->setBuddy(numOfSequencesSpinBox); + numOfSequencesLabel->setWhatsThis("Number of sequences to include in analysis. "); + numOfSequencesSpinBox->setMinimum(1); + numOfSequencesSpinBox->setWhatsThis("Number of sequences to include in analysis. "); //Sequence setup frame seqSetupFrame = new SequenceSetupFrame; - connect(&numOfSequencesSpinBox, SIGNAL(valueChanged(int)), + connect(numOfSequencesSpinBox, SIGNAL(valueChanged(int)), seqSetupFrame, SLOT(changeSequenceCount(int))); - numOfSequencesSpinBox.setValue(2); + numOfSequencesSpinBox->setValue(2); // Create Experiment Button - connect(&createPushButton, SIGNAL(pressed()), + connect(createPushButton, SIGNAL(pressed()), this, SLOT(mussaCreatePushed())); // Cancle Button - connect(&cancelPushButton, SIGNAL(pressed()), + connect(cancelPushButton, SIGNAL(pressed()), this, SLOT(mussaCancelPushed())); // LAYOUT @@ -67,24 +92,24 @@ MussaSetupWidget::MussaSetupWidget(QWidget *parent) QHBoxLayout *buttonLayout = new QHBoxLayout; row1Layout->addWidget(analysisNameLabel); - row1Layout->addWidget(&analysisNameLineEdit); + row1Layout->addWidget(analysisNameLineEdit); - row2Layout->addWidget(windowLabel); - row2Layout->addWidget(&windowLineEdit); row2Layout->addWidget(thresholdLabel); - row2Layout->addWidget(&thresholdLineEdit); + row2Layout->addWidget(thresholdEdit); + row2Layout->addWidget(windowLabel); + row2Layout->addWidget(windowEdit); row2Layout->addWidget(numOfSequencesLabel); - row2Layout->addWidget(&numOfSequencesSpinBox); + row2Layout->addWidget(numOfSequencesSpinBox); - buttonLayout->addWidget(&createPushButton); - buttonLayout->addWidget(&cancelPushButton); + buttonLayout->addStretch(1); + buttonLayout->addWidget(createPushButton); + buttonLayout->addWidget(cancelPushButton); mainLayout->addLayout(row1Layout); mainLayout->addLayout(row2Layout); mainLayout->addWidget(seqSetupFrame); mainLayout->addLayout(buttonLayout); setLayout(mainLayout); - } void MussaSetupWidget::mussaCreatePushed() @@ -97,9 +122,14 @@ void MussaSetupWidget::mussaCancelPushed() emit cancelButtonPushed(); } -Mussa* MussaSetupWidget::getMussaObject() +void MussaSetupWidget::updateThreshold(int new_threshold) +{ + thresholdEdit->setMaximum(new_threshold); +} + +MussaRef MussaSetupWidget::getMussaObject() { - Mussa *mussa = new Mussa; + MussaRef mussa = Mussa::init(); int fastaIndex; int start; @@ -124,11 +154,13 @@ Mussa* MussaSetupWidget::getMussaObject() } setupInfoList.clear(); - int win_size = windowLineEdit.text().toInt(); - int threshold = thresholdLineEdit.text().toInt(); + int win_size = windowEdit->value(); + int threshold = thresholdEdit->value(); + std::string name = analysisNameLineEdit->text().toStdString(); if (win_size == 0 or threshold == 0) { throw mussa_load_error("must set analysis parameters"); } else { + mussa->set_name(name); mussa->set_window(win_size); mussa->set_threshold(threshold); mussa->set_analysis_mode(Mussa::TransitiveNway); @@ -139,11 +171,3 @@ Mussa* MussaSetupWidget::getMussaObject() return mussa; } -//MussaSetupWidget::MussaSetupWidget(const MussaSetupWidget& msw) -// : analysisNameLineEdit(msw.analysisNameLineEdit), -// windowLineEdit(msw.windowLineEdit), -// thresholdLineEdit(msw.thresholdLineEdit), -// numOfSequencesLineEdit(msw.numOfSequencesLineEdit), -// seqSetupFrame(msw.seqSetupFrame) -//{ -//}