Skip to content

Commit efe58c5

Browse files
authoredDec 2, 2021
Merge pull request #3 from hcji/testing
0.99.5b
2 parents d475372 + 8c612d5 commit efe58c5

19 files changed

+2319
-304
lines changed
 

‎AnalTPCAUI.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ def LoadProteinFile(self):
144144
else:
145145
for fileName in fileNames:
146146
if fileName:
147-
if fileName.split('.')[1] in ['csv', 'xlsx']:
147+
if fileName.split('.')[-1] in ['csv', 'xlsx']:
148148
self.ListFile.addItem(fileName)
149149
else:
150-
pass
150+
self.WarnMsg("Invalid format")
151151

152152

153153
def ClearProteinFile(self):
@@ -159,10 +159,11 @@ def LoadProteinComplex(self):
159159
options |= QtWidgets.QFileDialog.DontUseNativeDialog
160160
fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self,"Load", "","All Files (*);;CSV Files (*.csv)", options=options)
161161
if fileName:
162-
if fileName.split('.')[1] in ['csv', 'xlsx']:
162+
if fileName.split('.')[-1] in ['csv', 'xlsx']:
163163
self.ListDatabase.addItem(fileName)
164164
else:
165165
self.ErrorMsg("Invalid format")
166+
return None
166167
else:
167168
pass
168169

@@ -192,11 +193,12 @@ def SelectProteinTable(self):
192193
self.ErrorMsg('No item is selected')
193194
return None
194195
try:
195-
if selectItem.text().split('.')[1] == 'csv':
196+
if selectItem.text().split('.')[-1] == 'csv':
196197
selectData = pd.read_csv(selectItem.text())
197-
elif selectItem.text().split('.')[1] == 'xlsx':
198+
elif selectItem.text().split('.')[-1] == 'xlsx':
198199
selectData = pd.read_excel(selectItem.text())
199200
else:
201+
self.ErrorMsg("Invalid format")
200202
return None
201203
except:
202204
self.ErrorMsg('Cannot be load the selected file')
@@ -290,12 +292,13 @@ def TakeProteinComplex(self):
290292
def SetProteinComplex(self):
291293
selectItem = self.ListDatabase.currentItem()
292294
try:
293-
if selectItem.text().split('.')[1] == 'csv':
295+
if selectItem.text().split('.')[-1] == 'csv':
294296
selectData = pd.read_csv(selectItem.text())
295-
elif selectItem.text().split('.')[1] == 'xlsx':
297+
elif selectItem.text().split('.')[-1] == 'xlsx':
296298
selectData = pd.read_excel(selectItem.text())
297299
else:
298-
pass
300+
self.ErrorMsg("Invalid format")
301+
return None
299302

300303
if 'Subunits_UniProt_IDs' not in selectData.columns:
301304
self.ErrorMsg("Subunits_UniProt_IDs' not in columns")
@@ -391,18 +394,19 @@ def LoadProteinPair(self):
391394
options |= QtWidgets.QFileDialog.DontUseNativeDialog
392395
fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self,"Load", "","All Files (*);;CSV Files (*.csv)", options=options)
393396
if fileName:
394-
if fileName.split('.')[1] == 'csv':
397+
if fileName.split('.')[-1] == 'csv':
395398
proteinPair = pd.read_csv(fileName)
396399
header = [c for c in proteinPair.columns if c in ['Protein A', 'Protein B', 'Publications']]
397400
proteinPair = proteinPair.loc[:, header]
398401
self.AnalROCUI.tableView.setModel(TableModel(proteinPair))
399-
elif fileName.split('.')[1] == 'xlsx':
402+
elif fileName.split('.')[-1] == 'xlsx':
400403
proteinPair = pd.read_excel(fileName)
401404
header = [c for c in proteinPair.columns if c in ['Protein A', 'Protein B', 'Publications']]
402405
proteinPair = proteinPair.loc[:, header]
403406
self.AnalROCUI.tableView.setModel(TableModel(proteinPair))
404407
else:
405408
self.ErrorMsg("Invalid format")
409+
return None
406410
self.AnalROCUI.spinBoxRandom.setProperty("value", len(proteinPair))
407411

408412

‎AnalTPP2D.py

+243
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Form implementation generated from reading ui file 'AnalTPP2D.ui'
4+
#
5+
# Created by: PyQt5 UI code generator 5.15.4
6+
#
7+
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
8+
# run again. Do not edit this file unless you know what you are doing.
9+
10+
11+
from PyQt5 import QtCore, QtGui, QtWidgets
12+
13+
14+
class Ui_Form(object):
15+
def setupUi(self, Form):
16+
Form.setObjectName("Form")
17+
Form.resize(1101, 782)
18+
self.gridLayout = QtWidgets.QGridLayout(Form)
19+
self.gridLayout.setObjectName("gridLayout")
20+
self.splitter = QtWidgets.QSplitter(Form)
21+
self.splitter.setOrientation(QtCore.Qt.Horizontal)
22+
self.splitter.setObjectName("splitter")
23+
self.widget = QtWidgets.QWidget(self.splitter)
24+
self.widget.setObjectName("widget")
25+
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
26+
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
27+
self.verticalLayout.setObjectName("verticalLayout")
28+
self.label_1 = QtWidgets.QLabel(self.widget)
29+
font = QtGui.QFont()
30+
font.setFamily("Times New Roman")
31+
font.setPointSize(12)
32+
font.setBold(False)
33+
font.setWeight(50)
34+
self.label_1.setFont(font)
35+
self.label_1.setObjectName("label_1")
36+
self.verticalLayout.addWidget(self.label_1)
37+
self.horizontalLayout = QtWidgets.QHBoxLayout()
38+
self.horizontalLayout.setObjectName("horizontalLayout")
39+
self.label_2 = QtWidgets.QLabel(self.widget)
40+
font = QtGui.QFont()
41+
font.setFamily("Times New Roman")
42+
font.setPointSize(11)
43+
self.label_2.setFont(font)
44+
self.label_2.setObjectName("label_2")
45+
self.horizontalLayout.addWidget(self.label_2)
46+
self.comboBoxMethod = QtWidgets.QComboBox(self.widget)
47+
self.comboBoxMethod.setObjectName("comboBoxMethod")
48+
self.horizontalLayout.addWidget(self.comboBoxMethod)
49+
self.verticalLayout.addLayout(self.horizontalLayout)
50+
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
51+
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
52+
self.label_9 = QtWidgets.QLabel(self.widget)
53+
font = QtGui.QFont()
54+
font.setFamily("Times New Roman")
55+
font.setPointSize(11)
56+
self.label_9.setFont(font)
57+
self.label_9.setObjectName("label_9")
58+
self.horizontalLayout_2.addWidget(self.label_9)
59+
self.spinBoxMaxIt = QtWidgets.QSpinBox(self.widget)
60+
self.spinBoxMaxIt.setMinimum(2)
61+
self.spinBoxMaxIt.setMaximum(1000)
62+
self.spinBoxMaxIt.setProperty("value", 200)
63+
self.spinBoxMaxIt.setObjectName("spinBoxMaxIt")
64+
self.horizontalLayout_2.addWidget(self.spinBoxMaxIt)
65+
self.verticalLayout.addLayout(self.horizontalLayout_2)
66+
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
67+
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
68+
self.label_12 = QtWidgets.QLabel(self.widget)
69+
font = QtGui.QFont()
70+
font.setFamily("Times New Roman")
71+
font.setPointSize(11)
72+
self.label_12.setFont(font)
73+
self.label_12.setObjectName("label_12")
74+
self.horizontalLayout_3.addWidget(self.label_12)
75+
self.spinBoxBoost = QtWidgets.QSpinBox(self.widget)
76+
self.spinBoxBoost.setMinimum(2)
77+
self.spinBoxBoost.setMaximum(1000)
78+
self.spinBoxBoost.setProperty("value", 2)
79+
self.spinBoxBoost.setObjectName("spinBoxBoost")
80+
self.horizontalLayout_3.addWidget(self.spinBoxBoost)
81+
self.verticalLayout.addLayout(self.horizontalLayout_3)
82+
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
83+
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
84+
self.label_10 = QtWidgets.QLabel(self.widget)
85+
font = QtGui.QFont()
86+
font.setFamily("Times New Roman")
87+
font.setPointSize(11)
88+
self.label_10.setFont(font)
89+
self.label_10.setObjectName("label_10")
90+
self.horizontalLayout_6.addWidget(self.label_10)
91+
self.doubleSpinBoxAlpha = QtWidgets.QDoubleSpinBox(self.widget)
92+
self.doubleSpinBoxAlpha.setSingleStep(0.01)
93+
self.doubleSpinBoxAlpha.setProperty("value", 0.1)
94+
self.doubleSpinBoxAlpha.setObjectName("doubleSpinBoxAlpha")
95+
self.horizontalLayout_6.addWidget(self.doubleSpinBoxAlpha)
96+
self.verticalLayout.addLayout(self.horizontalLayout_6)
97+
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
98+
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
99+
self.pushButtonData = QtWidgets.QPushButton(self.widget)
100+
font = QtGui.QFont()
101+
font.setFamily("Times New Roman")
102+
font.setPointSize(11)
103+
self.pushButtonData.setFont(font)
104+
self.pushButtonData.setObjectName("pushButtonData")
105+
self.horizontalLayout_5.addWidget(self.pushButtonData)
106+
self.pushButtonOK = QtWidgets.QPushButton(self.widget)
107+
font = QtGui.QFont()
108+
font.setFamily("Times New Roman")
109+
font.setPointSize(11)
110+
self.pushButtonOK.setFont(font)
111+
self.pushButtonOK.setObjectName("pushButtonOK")
112+
self.horizontalLayout_5.addWidget(self.pushButtonOK)
113+
self.pushButtonClose = QtWidgets.QPushButton(self.widget)
114+
font = QtGui.QFont()
115+
font.setFamily("Times New Roman")
116+
font.setPointSize(11)
117+
self.pushButtonClose.setFont(font)
118+
self.pushButtonClose.setObjectName("pushButtonClose")
119+
self.horizontalLayout_5.addWidget(self.pushButtonClose)
120+
self.verticalLayout.addLayout(self.horizontalLayout_5)
121+
self.labelDatabase = QtWidgets.QLabel(self.widget)
122+
font = QtGui.QFont()
123+
font.setFamily("Times New Roman")
124+
font.setPointSize(12)
125+
self.labelDatabase.setFont(font)
126+
self.labelDatabase.setObjectName("labelDatabase")
127+
self.verticalLayout.addWidget(self.labelDatabase)
128+
self.tableWidgetProteinList = QtWidgets.QTableWidget(self.widget)
129+
self.tableWidgetProteinList.setMinimumSize(QtCore.QSize(0, 500))
130+
self.tableWidgetProteinList.setObjectName("tableWidgetProteinList")
131+
self.tableWidgetProteinList.setColumnCount(0)
132+
self.tableWidgetProteinList.setRowCount(0)
133+
self.verticalLayout.addWidget(self.tableWidgetProteinList)
134+
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
135+
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
136+
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
137+
self.horizontalLayout_4.addItem(spacerItem)
138+
self.pushButtonSave = QtWidgets.QPushButton(self.widget)
139+
font = QtGui.QFont()
140+
font.setFamily("Times New Roman")
141+
font.setPointSize(11)
142+
self.pushButtonSave.setFont(font)
143+
self.pushButtonSave.setObjectName("pushButtonSave")
144+
self.horizontalLayout_4.addWidget(self.pushButtonSave)
145+
self.pushButtonShow = QtWidgets.QPushButton(self.widget)
146+
font = QtGui.QFont()
147+
font.setFamily("Times New Roman")
148+
font.setPointSize(11)
149+
self.pushButtonShow.setFont(font)
150+
self.pushButtonShow.setObjectName("pushButtonShow")
151+
self.horizontalLayout_4.addWidget(self.pushButtonShow)
152+
self.verticalLayout.addLayout(self.horizontalLayout_4)
153+
self.widget1 = QtWidgets.QWidget(self.splitter)
154+
self.widget1.setObjectName("widget1")
155+
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.widget1)
156+
self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
157+
self.verticalLayout_5.setObjectName("verticalLayout_5")
158+
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
159+
self.verticalLayout_2.setObjectName("verticalLayout_2")
160+
self.label_11 = QtWidgets.QLabel(self.widget1)
161+
font = QtGui.QFont()
162+
font.setFamily("Times New Roman")
163+
font.setPointSize(12)
164+
self.label_11.setFont(font)
165+
self.label_11.setObjectName("label_11")
166+
self.verticalLayout_2.addWidget(self.label_11)
167+
self.tableViewData = QtWidgets.QTableView(self.widget1)
168+
self.tableViewData.setMinimumSize(QtCore.QSize(0, 250))
169+
self.tableViewData.setObjectName("tableViewData")
170+
self.verticalLayout_2.addWidget(self.tableViewData)
171+
self.verticalLayout_5.addLayout(self.verticalLayout_2)
172+
self.tabWidget = QtWidgets.QTabWidget(self.widget1)
173+
self.tabWidget.setMinimumSize(QtCore.QSize(0, 300))
174+
font = QtGui.QFont()
175+
font.setFamily("Times New Roman")
176+
font.setPointSize(12)
177+
self.tabWidget.setFont(font)
178+
self.tabWidget.setObjectName("tabWidget")
179+
self.vocano = QtWidgets.QWidget()
180+
font = QtGui.QFont()
181+
font.setPointSize(12)
182+
self.vocano.setFont(font)
183+
self.vocano.setObjectName("vocano")
184+
self.gridLayout_5 = QtWidgets.QGridLayout(self.vocano)
185+
self.gridLayout_5.setObjectName("gridLayout_5")
186+
self.groupBoxVolcano = QtWidgets.QGroupBox(self.vocano)
187+
self.groupBoxVolcano.setMinimumSize(QtCore.QSize(0, 0))
188+
font = QtGui.QFont()
189+
font.setFamily("Arial")
190+
font.setPointSize(13)
191+
self.groupBoxVolcano.setFont(font)
192+
self.groupBoxVolcano.setTitle("")
193+
self.groupBoxVolcano.setObjectName("groupBoxVolcano")
194+
self.gridLayout_5.addWidget(self.groupBoxVolcano, 0, 0, 1, 1)
195+
self.tabWidget.addTab(self.vocano, "")
196+
self.heatmap = QtWidgets.QWidget()
197+
self.heatmap.setObjectName("heatmap")
198+
self.gridLayout_2 = QtWidgets.QGridLayout(self.heatmap)
199+
self.gridLayout_2.setObjectName("gridLayout_2")
200+
self.groupBoxHeatmap = QtWidgets.QGroupBox(self.heatmap)
201+
self.groupBoxHeatmap.setMinimumSize(QtCore.QSize(0, 0))
202+
font = QtGui.QFont()
203+
font.setFamily("Arial")
204+
font.setPointSize(13)
205+
self.groupBoxHeatmap.setFont(font)
206+
self.groupBoxHeatmap.setTitle("")
207+
self.groupBoxHeatmap.setObjectName("groupBoxHeatmap")
208+
self.gridLayout_2.addWidget(self.groupBoxHeatmap, 0, 0, 1, 1)
209+
self.tabWidget.addTab(self.heatmap, "")
210+
self.verticalLayout_5.addWidget(self.tabWidget)
211+
self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
212+
213+
self.retranslateUi(Form)
214+
self.tabWidget.setCurrentIndex(1)
215+
QtCore.QMetaObject.connectSlotsByName(Form)
216+
217+
def retranslateUi(self, Form):
218+
_translate = QtCore.QCoreApplication.translate
219+
Form.setWindowTitle(_translate("Form", "Form"))
220+
self.label_1.setText(_translate("Form", "Parameters for TPP2D analysis:"))
221+
self.label_2.setText(_translate("Form", "Select methods"))
222+
self.label_9.setText(_translate("Form", "Maximum Iter"))
223+
self.label_12.setText(_translate("Form", "Bootstrap Round"))
224+
self.label_10.setText(_translate("Form", "Significance Threshold"))
225+
self.pushButtonData.setText(_translate("Form", "Data"))
226+
self.pushButtonOK.setText(_translate("Form", "Confirm"))
227+
self.pushButtonClose.setText(_translate("Form", "Cancel"))
228+
self.labelDatabase.setText(_translate("Form", "Hit Targets Table"))
229+
self.pushButtonSave.setText(_translate("Form", "Save"))
230+
self.pushButtonShow.setText(_translate("Form", "Show Result"))
231+
self.label_11.setText(_translate("Form", "Data viewer"))
232+
self.tabWidget.setTabText(self.tabWidget.indexOf(self.vocano), _translate("Form", "Volcano"))
233+
self.tabWidget.setTabText(self.tabWidget.indexOf(self.heatmap), _translate("Form", "Heatmap"))
234+
235+
236+
if __name__ == "__main__":
237+
import sys
238+
app = QtWidgets.QApplication(sys.argv)
239+
Form = QtWidgets.QWidget()
240+
ui = Ui_Form()
241+
ui.setupUi(Form)
242+
Form.show()
243+
sys.exit(app.exec_())

0 commit comments

Comments
 (0)
Please sign in to comment.