11 //#include "qui/mussa_setup_dialog/SequenceSetupWidget.hpp"
12 #include "qui/mussa_setup_dialog/SequenceSetupFrame.hpp"
13 #include "qui/mussa_setup_dialog/MussaSetupWidget.hpp"
14 #include "qui/mussa_setup_dialog/SetupInfo.hpp"
15 #include "alg/mussa.hpp"
17 MussaSetupWidget::MussaSetupWidget(QWidget *parent)
19 analysisNameLineEdit(0),
22 numOfSequencesSpinBox(0),
29 analysisNameLineEdit = new QLineEdit;
30 QLabel *analysisNameLabel = new QLabel(tr("Analysis Name"));
31 analysisNameLabel->setBuddy(analysisNameLineEdit);
34 windowLineEdit = new QLineEdit;
35 QLabel *windowLabel = new QLabel(tr("Window"));
36 windowLabel->setBuddy(windowLineEdit);
39 thresholdLineEdit = new QLineEdit;
40 QLabel *thresholdLabel = new QLabel(tr("Threshold"));
41 thresholdLabel->setBuddy(thresholdLineEdit);
43 // Number of sequences
44 numOfSequencesSpinBox = new QSpinBox;
45 QLabel *numOfSequencesLabel = new QLabel(tr("Number of sequences"));
46 numOfSequencesLabel->setBuddy(numOfSequencesSpinBox);
47 numOfSequencesSpinBox->setMinimum(1);
50 //Sequence setup frame
51 seqSetupFrame = new SequenceSetupFrame;
53 connect(numOfSequencesSpinBox, SIGNAL(valueChanged(int)),
54 seqSetupFrame, SLOT(changeSequenceCount(int)));
56 numOfSequencesSpinBox->setValue(1);
58 // Create Experiment Button
59 createPushButton = new QPushButton(tr("Create"));
60 connect(createPushButton, SIGNAL(pressed()),
61 this, SLOT(mussaCreatePushed()));
64 cancelPushButton = new QPushButton(tr("Cancel"));
65 connect(cancelPushButton, SIGNAL(pressed()),
66 this, SLOT(mussaCancelPushed()));
69 QHBoxLayout *row1Layout = new QHBoxLayout;
70 QHBoxLayout *row2Layout = new QHBoxLayout;
71 QVBoxLayout *mainLayout = new QVBoxLayout;
72 QHBoxLayout *buttonLayout = new QHBoxLayout;
74 row1Layout->addWidget(analysisNameLabel);
75 row1Layout->addWidget(analysisNameLineEdit);
77 row2Layout->addWidget(windowLabel);
78 row2Layout->addWidget(windowLineEdit);
79 row2Layout->addWidget(thresholdLabel);
80 row2Layout->addWidget(thresholdLineEdit);
81 row2Layout->addWidget(numOfSequencesLabel);
82 row2Layout->addWidget(numOfSequencesSpinBox);
84 buttonLayout->addWidget(createPushButton);
85 buttonLayout->addWidget(cancelPushButton);
87 mainLayout->addLayout(row1Layout);
88 mainLayout->addLayout(row2Layout);
89 mainLayout->addWidget(seqSetupFrame);
90 mainLayout->addLayout(buttonLayout);
91 setLayout(mainLayout);
95 void MussaSetupWidget::mussaCreatePushed()
97 emit createButtonPushed();
100 void MussaSetupWidget::mussaCancelPushed()
102 emit cancelButtonPushed();
105 Mussa* MussaSetupWidget::getMussaObject()
107 Mussa *mussa = new Mussa;
112 std::string annotFile;
117 std::list<SetupInfo *> setupInfoList = seqSetupFrame->getSetupInfo();
119 const int count = setupInfoList.size();
121 SetupInfo *setupInfo = 0;
122 for (int i=0; i < count; i++)
124 setupInfo = setupInfoList.back();
125 setupInfoList.pop_back();
127 seqFile = setupInfo->getSeqFile();
128 annotFile = setupInfo->getAnnotFile();
129 fastaIndex = setupInfo->getFastaIndex();
130 start = setupInfo->getSubSeqStart();
131 end = setupInfo->getSubSeqEnd();
133 mussa->load_sequence(seqFile, annotFile, fastaIndex, start, end);
137 mussa->analyze(0, 0, Mussa::TransitiveNway, 0.0);
142 //MussaSetupWidget::MussaSetupWidget(const MussaSetupWidget& msw)
143 // : analysisNameLineEdit(msw.analysisNameLineEdit),
144 // windowLineEdit(msw.windowLineEdit),
145 // thresholdLineEdit(msw.thresholdLineEdit),
146 // numOfSequencesLineEdit(msw.numOfSequencesLineEdit),
147 // seqSetupFrame(msw.seqSetupFrame)