-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
53 lines (35 loc) · 1.26 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "bamtrack.h"
#include "oliviertrack.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
mViewer = new TrackViewer;
setCentralWidget(mViewer);
mViewer->setReference("/home/sacha/Linux_data/bioinfo/data/hg19.fa");
mViewer->addTrack(new BamTrack("/home/sacha/Linux_data/bioinfo/data/bam/IonXpress_001_R_2018_02_06_11_44_40_user_run18C28_Auto_user_run18C28_349.bam"));
mViewer->setRegion("chr1", 1, 100);
mEdit = new QLineEdit;
mSlider = new QSlider(Qt::Horizontal);
QToolBar * tool = new QToolBar;
tool->addWidget(mEdit);
tool->addWidget(mSlider);
addToolBar(Qt::BottomToolBarArea, tool);
connect(mViewer, SIGNAL(regionChanged(QString)), mEdit, SLOT(setText(QString)));
connect(mEdit, &QLineEdit::returnPressed,[this](){
QRegularExpression exp("(\\w+):(\\d+)-(\\d+)");
auto match = exp.match(mEdit->text());
if (match.hasMatch())
{
QString name = match.captured(1);
int start = match.captured(2).toInt();
int end = match.captured(3).toInt();
mViewer->setRegion(name, start, end);
}
});
resize(900, 400);
}
MainWindow::~MainWindow()
{
}