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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
"""
RosettaSimulationPopUpDialog.py
Qt Dialog for setting the arguments for a rosetta simulation
@author: Urmi
@version: $Id$
@copyright:2008 Nanorex, Inc. See LICENSE file for details.
"""
from PyQt4.Qt import SIGNAL, SLOT
from PyQt4.Qt import QSizePolicy
from PyQt4.QtGui import QDialog, QLineEdit, QPushButton, QLabel, QCheckBox
from PyQt4.QtGui import QHBoxLayout, QVBoxLayout, QApplication, QTextEdit
from PyQt4.QtGui import QSpinBox, QSpacerItem
import string
from utilities.icon_utilities import geticon, getpixmap
class RosettaSimulationPopUpDialog(QDialog):
def __init__(self, parent = None):
"""
Constructor for Rosetta simulation parameters dialog
"""
self.parentWidget = parent
super(RosettaSimulationPopUpDialog, self).__init__(parent)
self.setWindowIcon(geticon('ui/border/Rosetta.png'))
self.setWindowTitle("Rosetta Simulation Parameters")
self._loadWidgets()
self.connectSignals()
self.show()
return
def _loadLogoWidget(self):
"""
load logo widget
"""
logoLayout = QHBoxLayout()
self.imageLabel = QLabel()
self.imageLabel.setPixmap(
getpixmap("ui/images/Rosetta.png"))
# Horizontal spacer
hSpacer = QSpacerItem(1, 1,
QSizePolicy.Expanding,
QSizePolicy.Minimum)
logoLayout.addItem(hSpacer)
logoLayout.addWidget(self.imageLabel)
logoLayout.addItem(hSpacer)
return logoLayout
def _loadNumSimWidget(self):
"""
Load number of simulations widget
"""
idLayout = QHBoxLayout()
self.label = QLabel("Enter number of simulations:")
self.numSimSpinBox = QSpinBox()
self.numSimSpinBox.setMinimum(1)
self.numSimSpinBox.setMaximum(999)
idLayout.addWidget(self.label)
idLayout.addWidget(self.numSimSpinBox)
return idLayout
def _loadParameterCheckBoxWidget(self):
"""
load rosetta simulation parameters checkboxes
"""
idLayout1 = QVBoxLayout()
self.ex1Checkbox = QCheckBox("Expand rotamer library for chi1 angle")
self.ex1aroCheckbox = QCheckBox("Use large chi1 library for aromatic residues")
self.ex2Checkbox = QCheckBox("Expand rotamer library for chi2 angle")
self.ex2aroOnlyCheckbox = QCheckBox("Use large chi2 library only for aromatic residues")
self.ex3Checkbox = QCheckBox("Expand rotamer library for chi3 angle")
self.ex4Checkbox = QCheckBox("Expand rotamer library for chi4 angle")
self.rotOptCheckbox = QCheckBox("Optimize one-body energy")
self.tryBothHisTautomersCheckbox = QCheckBox("Try both histidine tautomers")
self.softRepDesignCheckbox = QCheckBox("Use softer Lennard-Jones repulsive term")
self.useElecRepCheckbox = QCheckBox("Use electrostatic repulsion")
self.norepackDisulfCheckbox = QCheckBox("Don't re-pack disulphide bonds")
idLayout1.addWidget(self.ex1Checkbox)
idLayout1.addWidget(self.ex1aroCheckbox)
idLayout1.addWidget(self.ex2Checkbox)
idLayout1.addWidget(self.ex2aroOnlyCheckbox)
idLayout1.addWidget(self.ex3Checkbox)
idLayout1.addWidget(self.ex4Checkbox)
idLayout1.addWidget(self.rotOptCheckbox)
idLayout1.addWidget(self.tryBothHisTautomersCheckbox)
idLayout1.addWidget(self.softRepDesignCheckbox)
idLayout1.addWidget(self.useElecRepCheckbox)
idLayout1.addWidget(self.norepackDisulfCheckbox)
return idLayout1
def _loadCommandLineOptionWidget(self):
"""
Load command line options text edit
"""
self.otherOptionsLabel = QLabel("Command line options:")
self.otherCommandLineOptions = QTextEdit()
self.otherCommandLineOptions.setFixedHeight(80)
idLayout3 = QVBoxLayout()
idLayout3.addWidget(self.otherOptionsLabel)
idLayout3.addWidget(self.otherCommandLineOptions)
return idLayout3
def _loadButtonLayoutWidget(self):
"""
Load OK/Cancel buttons
"""
self.okButton = QPushButton("&OK")
self.cancelButton = QPushButton("Cancel")
buttonLayout = QHBoxLayout()
buttonLayout.addStretch()
buttonLayout.addWidget(self.okButton)
buttonLayout.addWidget(self.cancelButton)
return buttonLayout
def _loadWidgets(self):
"""
Load all the widgets for this dialog
"""
layout = QVBoxLayout()
logoLayout = self._loadLogoWidget()
idLayout = self._loadNumSimWidget()
idLayout1 = self._loadParameterCheckBoxWidget()
idLayout3 = self._loadCommandLineOptionWidget()
buttonLayout = self._loadButtonLayoutWidget()
layout.addLayout(logoLayout)
layout.addLayout(idLayout)
layout.addLayout(idLayout1)
layout.addLayout(idLayout3)
layout.addLayout(buttonLayout)
self.setLayout(layout)
return
def connectSignals(self):
"""
Signal slot connections for rosetta simulation parameters dialog
"""
#signal slot connections for various parameter checkboxes
self.connect(self.ex1Checkbox, SIGNAL("stateChanged(int)"), self.update_ex1)
self.connect(self.ex1aroCheckbox, SIGNAL("stateChanged(int)"), self.update_ex1aro)
self.connect(self.ex2Checkbox, SIGNAL("stateChanged(int)"), self.update_ex2)
self.connect(self.ex2aroOnlyCheckbox, SIGNAL("stateChanged(int)"), self.update_ex2aro_only)
self.connect(self.ex3Checkbox, SIGNAL("stateChanged(int)"), self.update_ex3)
self.connect(self.ex4Checkbox, SIGNAL("stateChanged(int)"), self.update_ex4)
self.connect(self.rotOptCheckbox, SIGNAL("stateChanged(int)"), self.update_rot_opt)
self.connect(self.tryBothHisTautomersCheckbox, SIGNAL("stateChanged(int)"), self.update_try_both_his_tautomers)
self.connect(self.softRepDesignCheckbox, SIGNAL("stateChanged(int)"), self.update_soft_rep_design)
self.connect(self.useElecRepCheckbox, SIGNAL("stateChanged(int)"), self.update_use_elec_rep)
self.connect(self.norepackDisulfCheckbox, SIGNAL("stateChanged(int)"), self.update_norepack_disulf)
#signal slot connections for the push buttons
self.connect(self.okButton, SIGNAL("clicked()"), self.getRosettaParameters)
self.connect(self.cancelButton, SIGNAL("clicked()"), self, SLOT("reject()"))
return
def update_ex1(self, state):
"""
Update the command text edit depending on the state of the update_ex1
checkbox
@param state:state of the update_ex1 checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.ex1Checkbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -ex1 '
else:
otherOptionsText = otherOptionsText.replace(' -ex1 ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_ex1aro(self, state):
"""
Update the command text edit depending on the state of the update_ex1aro
checkbox
@param state:state of the update_ex1aro checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.ex1aroCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -ex1aro '
else:
otherOptionsText = otherOptionsText.replace(' -ex1aro ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_ex2(self, state):
"""
Update the command text edit depending on the state of the update_ex2
checkbox
@param state:state of the update_ex2 checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.ex2Checkbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -ex2 '
else:
otherOptionsText = otherOptionsText.replace(' -ex2 ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_ex2aro_only(self, state):
"""
Update the command text edit depending on the state of the update_ex2aro_only
checkbox
@param state:state of the update_ex2aro_only checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.ex2aroOnlyCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -ex2aro_only '
else:
otherOptionsText = otherOptionsText.replace(' -ex2aro_only ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_ex3(self, state):
"""
Update the command text edit depending on the state of the update_ex3
checkbox
@param state:state of the update_ex3 checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.ex3Checkbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -ex3 '
else:
otherOptionsText = otherOptionsText.replace(' -ex3 ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_ex4(self, state):
"""
Update the command text edit depending on the state of the update_ex4
checkbox
@param state:state of the update_ex4 checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.ex4Checkbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -ex4 '
else:
otherOptionsText = otherOptionsText.replace(' -ex4 ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_rot_opt(self, state):
"""
Update the command text edit depending on the state of the update_rot_opt
checkbox
@param state:state of the update_rot_opt checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.rotOptCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -rot_opt '
else:
otherOptionsText = otherOptionsText.replace(' -rot_opt ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_try_both_his_tautomers(self, state):
"""
Update the command text edit depending on the state of the update_try_both_his_tautomers
checkbox
@param state:state of the update_try_both_his_tautomers checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.tryBothHisTautomersCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -try_both_his_tautomers '
else:
otherOptionsText = otherOptionsText.replace(' -try_both_his_tautomers ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_soft_rep_design(self, state):
"""
Update the command text edit depending on the state of the update_soft_rep_design
checkbox
@param state:state of the update_soft_rep_design checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.softRepDesignCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -soft_rep_design '
else:
otherOptionsText = otherOptionsText.replace(' -soft_rep_design ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_use_elec_rep(self, state):
"""
Update the command text edit depending on the state of the update_use_elec_rep
checkbox
@param state:state of the update_use_elec_rep checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.useElecRepCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -use_electrostatic_repulsion '
else:
otherOptionsText = otherOptionsText.replace(' -use_electrostatic_repulsion ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def update_norepack_disulf(self, state):
"""
Update the command text edit depending on the state of the update_no_repack
checkbox
@param state:state of the update_no_repack checkbox
@type state: int
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
if self.norepackDisulfCheckbox.isChecked() == True:
otherOptionsText = otherOptionsText + ' -norepack_disulf '
else:
otherOptionsText = otherOptionsText.replace(' -norepack_disulf ', '')
self.otherCommandLineOptions.setText(otherOptionsText)
return
def getRosettaParameters(self):
"""
Get all the parameters from the Rosetta pop up dialog
"""
otherOptionsText = str(self.otherCommandLineOptions.toPlainText())
numSim = self.numSimSpinBox.value()
self.parentWidget.setRosettaParameters(numSim, otherOptionsText)
self.close()
self.emit(SIGNAL("editingFinished()"))
return
|