File: TreeFormatOptions.cpp

package info (click to toggle)
clustalx 2.1%2Blgpl-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,320 kB
  • sloc: cpp: 40,050; sh: 163; xml: 102; makefile: 16
file content (148 lines) | stat: -rw-r--r-- 3,861 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include <QPushButton>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QSizePolicy>
#include <QComboBox>
#include <QtWidgets>
#include <QLabel>
#include <QCheckBox>
#include "TreeFormatOptions.h"
#include "clustalW/general/userparams.h"

TreeFormatOptions::TreeFormatOptions()
{
    fileGridBox = new QGroupBox("Output Files");
    otherParams = new QGroupBox;
    QVBoxLayout* mainLayout = new QVBoxLayout;
     
    okButton = new QPushButton(tr("OK"));
    okButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
    
    setUpLayout();
    
    mainLayout->addWidget(okButton);
    mainLayout->addWidget(fileGridBox);
    mainLayout->addWidget(otherParams);
    setLayout(mainLayout);
}

void TreeFormatOptions::setUpLayout()
{
   setUpRadioButtons(); 
   QGridLayout *grid = new QGridLayout; 
   grid->addWidget(clustal, 0, 0);
   grid->addWidget(phylip, 0, 1);
   grid->addWidget(phylipDistMat, 1, 0);
   grid->addWidget(nexus, 1, 1);
   grid->addWidget(percIdentMat, 2, 0);
   fileGridBox->setLayout(grid);
   
   setUpOtherParams();
   QGridLayout *otherParamLayout = new QGridLayout; 
   otherParamLayout->addWidget(bootStrapLabel, 0, 0);
   otherParamLayout->addWidget(bootStrap, 0, 1);
   otherParams->setLayout(otherParamLayout);   
}

void TreeFormatOptions::setUpRadioButtons()
{
    clustal = new QCheckBox("CLUSTAL format tree");
    percIdentMat = new QCheckBox("% identity matrix");
    phylip = new QCheckBox("Phylip format tree");
    phylipDistMat = new QCheckBox("Phylip distance matrix");
    nexus = new QCheckBox("Nexus format tree");
    
    if(clustalw::userParameters->getOutputTreeClustal())
    {
        clustal->setChecked(true);
    }
    if(clustalw::userParameters->getOutputPim())
    {
        percIdentMat->setChecked(true);
    } 
    if(clustalw::userParameters->getOutputTreePhylip())
    {
        phylip->setChecked(true);
    }
    if(clustalw::userParameters->getOutputTreeDistances())
    {
        phylipDistMat->setChecked(true);
    }
    if(clustalw::userParameters->getOutputTreeNexus())
    {
        nexus->setChecked(true);
    }
}

void TreeFormatOptions::setUpOtherParams()
{
    bootStrap = new QComboBox();
    bootStrap->addItem("Branch");    
    bootStrap->addItem("Node");
    if(clustalw::userParameters->getBootstrapFormat() == clustalw::BS_NODE_LABELS)
    {
        bootStrap->setCurrentIndex(1);
    }
    else
    {
        bootStrap->setCurrentIndex(0);
    }    
    bootStrapLabel = new QLabel(tr("Bootstrap labels on :"));    
}

void TreeFormatOptions::accept()
{
    if(clustal->isChecked())
    {
        clustalw::userParameters->setOutputTreeClustal(true);
    }
    else
    {
        clustalw::userParameters->setOutputTreeClustal(false);
    }
    if(percIdentMat->isChecked())
    {
        clustalw::userParameters->setOutputPim(true);
    }
    else
    {
        clustalw::userParameters->setOutputPim(false);
    } 
    if(phylip->isChecked())
    {
        clustalw::userParameters->setOutputTreePhylip(true);
    }
    else
    {
        clustalw::userParameters->setOutputTreePhylip(false);
    }
    if(phylipDistMat->isChecked())
    {
        clustalw::userParameters->setOutputTreeDistances(true);
    }
    else
    {
        clustalw::userParameters->setOutputTreeDistances(false);
    }
    if(nexus->isChecked())
    {
        clustalw::userParameters->setOutputTreeNexus(true);
    }
    else
    {
        clustalw::userParameters->setOutputTreeNexus(false);
    }
    
    if(bootStrap->currentIndex() == 1)
    {
        clustalw::userParameters->setBootstrapFormat(clustalw::BS_NODE_LABELS);
    }
    else
    {
        clustalw::userParameters->setBootstrapFormat(clustalw::BS_BRANCH_LABELS);
    }
    setResult(QDialog::Accepted);
    hide();    
}