#include "type1.h"
#include "ui_type1.h"
#include "type1.h"
#include "ui_type1.h"
#include <QtGui>
ui(new Ui::Type1)
{
ui->setupUi(this);
Qt::WindowFlags flags; // remove maximize button
flags = Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint;
setWindowFlags( flags );
// To load your Application at center of screen
int screenWidth, width;
int screenHeight, height;
int x, y;
screenWidth = desktop->width(); // get width of screen
screenHeight = desktop->height(); // get height of screen
windowSize = size(); // size of our application window
width = windowSize.width();
height = windowSize.height();
// little computations
x = (screenWidth - width) / 2;
y = (screenHeight - height) / 2;
y -= 50;
// move window to desired coordinates
move ( x, y );
connect(ui->pushButton_browse,SIGNAL(clicked()),this,SLOT(getpath()));
connect(ui->pushButton_submit,SIGNAL(clicked()),this,SLOT(start()));
connect(ui->pushButton_help,SIGNAL(clicked()),this,SLOT(help()));
connect(ui->pushButton_result,SIGNAL(clicked()),this,SLOT(result()));
connect(ui->pushButton_open,SIGNAL(clicked()),this,SLOT(open()));
}
void Type1::getpath(){ //choose file 1
this,
"Choose query file",
ui->lineEdit->setText(path);
}
void Type1::result()
{
this,
"open directory"),
ui->lineEdit_2->setText(res);
}
{
moveToThread(this); //initiates thread
}
void mythread::run()
{
QTimer::singleShot(0,
this,
SLOT(doTheWork
()));
exec();
}
void mythread::doTheWork() // main program running in a thread
{
system("perl .type1/run.pl");
emit done("finished 1");
}
void Type1::start() // main GUI with progress bar dialogue
{
mythread *wrapper = new mythread(); // connecting thread and main gui
connect(wrapper,
SIGNAL(done
(QString)),
this,
SLOT(wrapperDone
(QString)),Qt
::QueuedConnection);
wrapper->start();
/*QTimer *timer1 = new QTimer();
connect(timer1, SIGNAL(timeout()),this, SLOT(check()));
timer1->start(2000);
*/
dlg.setLabelText("please wait..");
dlg.setRange(0,0);
dlg.show();
mismatch = ui->comboBox_mm->currentText().toAscii().data();
energy = ui->comboBox_energy->currentText().toAscii().data();
svm = ui->comboBox_svm->currentText().toAscii().data();
QFile file (".type1/userinfo");
line.append("path:");
line.append(path.toAscii().data());
line.append("\n");
line.append(mismatch);
line.append("\n");
line.append(energy);
line.append("\n");
line.append("100\n");
line.append(svm);
line.append("\n");
line.append("result:");
line.append(res.toAscii().data());
line.append("\n");
lines += line;
for ( QStringList::Iterator it
= lines.
begin(); it
!= lines.
end();
++it
) stream << *it<<"\n";
file.close();
}
void Type1::time()
{
connect(timer, SIGNAL(timeout()), this, SLOT(cancel()));
timer->start(1000);
}
void Type1
::wrapperDone(const QString &results
) {
// The wrapper is now done with its long, blocking
// operation, and we didn't freeze the application.
/
dlg.close();
"TAref proces over");
qDebug() << "Here are your results:" << results;
}
void mythread::stop() // stop thread
{
{
if(currentThread() != this)
{
Qt::QueuedConnection);
}
else
{
quit();
}
}
}
void Type1::help() // help button in GUI this will open a new widget :)
{
label->setText("\t\t\tTYPE1 \n\n1) Please upload the sequence file in which you want to find the target \t\n\n2) Choose the Energy cut off value which is required\nfor the RNA-hybrid program \n\n3)Choose the mismatch cutoff\n\n4) Choose the SVM model\n\n5)Press submit to start the job\n\n6) A dialoge box will apper which means your job is processing\n\n7) On complition of job another box will apperar stating 'Process over'");
layout->addWidget(label);
win->setLayout(layout);
win->show();
}
void Type1::open()
{
file =res.toAscii().data();
qDebug() << "Fail to run the file";
}
Type1::~Type1()
{
delete ui;
}
#include "type1.h"
#include "ui_type1.h"
#include "type1.h"
#include "ui_type1.h"
#include <QtGui>
Type1::Type1(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Type1)
{
ui->setupUi(this);
Qt::WindowFlags flags; // remove maximize button
flags = Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint;
setWindowFlags( flags );
QDesktopWidget *desktop = QApplication::desktop();
// To load your Application at center of screen
int screenWidth, width;
int screenHeight, height;
int x, y;
QSize windowSize;
screenWidth = desktop->width(); // get width of screen
screenHeight = desktop->height(); // get height of screen
windowSize = size(); // size of our application window
width = windowSize.width();
height = windowSize.height();
// little computations
x = (screenWidth - width) / 2;
y = (screenHeight - height) / 2;
y -= 50;
// move window to desired coordinates
move ( x, y );
connect(ui->pushButton_browse,SIGNAL(clicked()),this,SLOT(getpath()));
connect(ui->pushButton_submit,SIGNAL(clicked()),this,SLOT(start()));
connect(ui->pushButton_help,SIGNAL(clicked()),this,SLOT(help()));
connect(ui->pushButton_result,SIGNAL(clicked()),this,SLOT(result()));
connect(ui->pushButton_open,SIGNAL(clicked()),this,SLOT(open()));
}
QString path;
void Type1::getpath(){ //choose file 1
path = QFileDialog::getOpenFileName(
this,
"Choose query file",
QString::null,
QString::null);
ui->lineEdit->setText(path);
}
QString res;
void Type1::result()
{
res = QFileDialog::getExistingDirectory(
this,
"open directory"),
ui->lineEdit_2->setText(res);
}
mythread::mythread() : QThread()
{
moveToThread(this); //initiates thread
}
void mythread::run()
{
QTimer::singleShot(0, this, SLOT(doTheWork()));
exec();
}
void mythread::doTheWork() // main program running in a thread
{
system("perl .type1/run.pl");
emit done("finished 1");
}
void Type1::start() // main GUI with progress bar dialogue
{
mythread *wrapper = new mythread(); // connecting thread and main gui
connect(wrapper,SIGNAL(done(QString)),this,SLOT(wrapperDone(QString)),Qt::QueuedConnection);
wrapper->start();
/*QTimer *timer1 = new QTimer();
connect(timer1, SIGNAL(timeout()),this, SLOT(check()));
timer1->start(2000);
*/
dlg.setLabelText("please wait..");
dlg.setRange(0,0);
dlg.show();
QString mismatch;
mismatch = ui->comboBox_mm->currentText().toAscii().data();
QString energy;
energy = ui->comboBox_energy->currentText().toAscii().data();
QString svm;
svm = ui->comboBox_svm->currentText().toAscii().data();
QStringList lines; // writing to file "userinfo"
QFile file (".type1/userinfo");
QString line;
line.append("path:");
line.append(path.toAscii().data());
line.append("\n");
line.append(mismatch);
line.append("\n");
line.append(energy);
line.append("\n");
line.append("100\n");
line.append(svm);
line.append("\n");
line.append("result:");
line.append(res.toAscii().data());
line.append("\n");
lines += line;
file.open(QIODevice::ReadWrite | QIODevice::Text);
QTextStream stream (&file);
for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it )
stream << *it<<"\n";
file.close();
}
void Type1::time()
{
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(cancel()));
timer->start(1000);
}
void Type1::wrapperDone(const QString &results)
{
// The wrapper is now done with its long, blocking
// operation, and we didn't freeze the application.
/
dlg.close();
QMessageBox::information(this,"type1",
"TAref proces over");
qDebug() << "Here are your results:" << results;
}
void mythread::stop() // stop thread
{
{
if(currentThread() != this)
{
QMetaObject::invokeMethod(this, "stop",
Qt::QueuedConnection);
}
else
{
quit();
}
}
}
void Type1::help() // help button in GUI this will open a new widget :)
{
QWidget *win = new QWidget;
QLabel *label = new QLabel(this);
label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
label->setText("\t\t\tTYPE1 \n\n1) Please upload the sequence file in which you want to find the target \t\n\n2) Choose the Energy cut off value which is required\nfor the RNA-hybrid program \n\n3)Choose the mismatch cutoff\n\n4) Choose the SVM model\n\n5)Press submit to start the job\n\n6) A dialoge box will apper which means your job is processing\n\n7) On complition of job another box will apperar stating 'Process over'");
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(label);
win->setLayout(layout);
win->show();
}
void Type1::open()
{
QString file;
file =res.toAscii().data();
if(!QDesktopServices::openUrl(QUrl::fromLocalFile(file)))
qDebug() << "Fail to run the file";
}
Type1::~Type1()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
Bookmarks