Skip to content

Commit

Permalink
adjust ui
Browse files Browse the repository at this point in the history
  • Loading branch information
hcji committed Jun 16, 2021
1 parent 96d183d commit 848b36c
Show file tree
Hide file tree
Showing 6 changed files with 821 additions and 0 deletions.
122 changes: 122 additions & 0 deletions AnalDist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'AnalDist.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(1082, 784)
Form.setMinimumSize(QtCore.QSize(1082, 784))
Form.setMaximumSize(QtCore.QSize(1082, 784))
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setObjectName("gridLayout")
self.tableWidgetProteinList = QtWidgets.QTableWidget(Form)
self.tableWidgetProteinList.setObjectName("tableWidgetProteinList")
self.tableWidgetProteinList.setColumnCount(0)
self.tableWidgetProteinList.setRowCount(0)
self.gridLayout.addWidget(self.tableWidgetProteinList, 7, 0, 1, 5)
self.label_7 = QtWidgets.QLabel(Form)
font = QtGui.QFont()
font.setPointSize(11)
self.label_7.setFont(font)
self.label_7.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 1, 0, 1, 1)
self.progressBar = QtWidgets.QProgressBar(Form)
self.progressBar.setProperty("value", 0)
self.progressBar.setObjectName("progressBar")
self.gridLayout.addWidget(self.progressBar, 8, 11, 1, 1)
self.ButtonShow = QtWidgets.QPushButton(Form)
self.ButtonShow.setObjectName("ButtonShow")
self.gridLayout.addWidget(self.ButtonShow, 8, 1, 1, 1)
self.label = QtWidgets.QLabel(Form)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(11)
self.label.setFont(font)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 6, 0, 1, 1)
self.label_4 = QtWidgets.QLabel(Form)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(13)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 0, 0, 1, 1)
self.label_5 = QtWidgets.QLabel(Form)
self.label_5.setText("")
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 8, 0, 1, 1)
self.pushButtonSave = QtWidgets.QPushButton(Form)
self.pushButtonSave.setObjectName("pushButtonSave")
self.gridLayout.addWidget(self.pushButtonSave, 8, 2, 1, 1)
self.ButtonCancel = QtWidgets.QPushButton(Form)
self.ButtonCancel.setObjectName("ButtonCancel")
self.gridLayout.addWidget(self.ButtonCancel, 4, 2, 1, 1)
self.groupBoxAvg = QtWidgets.QGroupBox(Form)
self.groupBoxAvg.setMinimumSize(QtCore.QSize(0, 200))
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(11)
self.groupBoxAvg.setFont(font)
self.groupBoxAvg.setObjectName("groupBoxAvg")
self.gridLayout.addWidget(self.groupBoxAvg, 0, 11, 6, 1)
self.comboBox = QtWidgets.QComboBox(Form)
self.comboBox.setObjectName("comboBox")
self.gridLayout.addWidget(self.comboBox, 2, 0, 1, 1)
self.ButtonConfirm = QtWidgets.QPushButton(Form)
self.ButtonConfirm.setObjectName("ButtonConfirm")
self.gridLayout.addWidget(self.ButtonConfirm, 3, 2, 1, 1)
self.groupBox = QtWidgets.QGroupBox(Form)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(11)
self.groupBox.setFont(font)
self.groupBox.setObjectName("groupBox")
self.gridLayout.addWidget(self.groupBox, 6, 11, 2, 1)
self.label_6 = QtWidgets.QLabel(Form)
font = QtGui.QFont()
font.setPointSize(11)
self.label_6.setFont(font)
self.label_6.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 3, 0, 1, 1)
self.BoxR2 = QtWidgets.QDoubleSpinBox(Form)
self.BoxR2.setSingleStep(0.01)
self.BoxR2.setProperty("value", 0.8)
self.BoxR2.setObjectName("BoxR2")
self.gridLayout.addWidget(self.BoxR2, 4, 0, 1, 1)

self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)

def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.label_7.setText(_translate("Form", "Method Selection"))
self.ButtonShow.setText(_translate("Form", "Show Curve"))
self.label.setText(_translate("Form", "Protein list sorted by scores:"))
self.label_4.setText(_translate("Form", "Distance-based TPP analysis:"))
self.pushButtonSave.setText(_translate("Form", "Save Result"))
self.ButtonCancel.setText(_translate("Form", "Cancel"))
self.groupBoxAvg.setTitle(_translate("Form", "Average thermal shift curves:"))
self.ButtonConfirm.setText(_translate("Form", "Confirm"))
self.groupBox.setTitle(_translate("Form", "Thermal shift curves comparison:"))
self.label_6.setText(_translate("Form", "minR2"))


if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())

179 changes: 179 additions & 0 deletions AnalDist.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1082</width>
<height>784</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>1082</width>
<height>784</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1082</width>
<height>784</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="7" column="0" colspan="5">
<widget class="QTableWidget" name="tableWidgetProteinList"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Method Selection</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="11">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="ButtonShow">
<property name="text">
<string>Show Curve</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Arial</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Protein list sorted by scores:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<family>Arial</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="text">
<string>Distance-based TPP analysis:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QPushButton" name="pushButtonSave">
<property name="text">
<string>Save Result</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="ButtonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="11" rowspan="6">
<widget class="QGroupBox" name="groupBoxAvg">
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="title">
<string>Average thermal shift curves:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="ButtonConfirm">
<property name="text">
<string>Confirm</string>
</property>
</widget>
</item>
<item row="6" column="11" rowspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="font">
<font>
<family>Arial</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="title">
<string>Thermal shift curves comparison:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>minR2</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QDoubleSpinBox" name="BoxR2">
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.800000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
63 changes: 63 additions & 0 deletions AnalDistUI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
"""
Created on Tue May 11 10:00:45 2021
@author: hcji
"""

import numpy as np

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt, QVariant
from PyQt5.QtWidgets import QApplication, QMainWindow, QGridLayout, QHBoxLayout

from AnalDist import Ui_Form
from MakeFigure import MakeFigure
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT as NavigationToolbar

class AnalDistUI(QtWidgets.QWidget, Ui_Form):

def __init__(self, parent=None):
super(AnalDistUI, self).__init__(parent)
self.setupUi(self)
self.setWindowTitle("NPTSA Analysis")
self.setWindowIcon(QtGui.QIcon("img/TPCA.ico"))

self.figureTSA = MakeFigure(10, 10, dpi=250)
self.figureTSA_ntb = NavigationToolbar(self.figureTSA, self)
self.gridlayoutTSA = QGridLayout(self.groupBox)
self.gridlayoutTSA.addWidget(self.figureTSA)
self.gridlayoutTSA.addWidget(self.figureTSA_ntb)

self.figureAvg = MakeFigure(10, 10, dpi=150)
self.gridlayoutAvg = QGridLayout(self.groupBoxAvg)
self.gridlayoutAvg.addWidget(self.figureAvg)

self.tableWidgetProteinList.setSortingEnabled(True)
self.comboBox.addItems(['euclidean', 'cityblock', 'chebychev', 'cosine'])


def FillTable(self, TSA_table):
self.tableWidgetProteinList.setRowCount(TSA_table.shape[0])
self.tableWidgetProteinList.setColumnCount(TSA_table.shape[1])
self.tableWidgetProteinList.setHorizontalHeaderLabels(TSA_table.columns)
self.tableWidgetProteinList.setVerticalHeaderLabels(TSA_table.index.astype(str))
for i in range(TSA_table.shape[0]):
for j in range(TSA_table.shape[1]):
if type(TSA_table.iloc[i,j]) == np.float64:
item = QtWidgets.QTableWidgetItem()
item.setData(Qt.EditRole, QVariant(float(TSA_table.iloc[i,j])))
# item = QtWidgets.QTableWidgetItem(str(TSA_table.iloc[i,j]))
else:
item = QtWidgets.QTableWidgetItem(str(TSA_table.iloc[i,j]))
self.tableWidgetProteinList.setItem(i, j, item)



if __name__ == '__main__':
import sys

app = QApplication(sys.argv)
ui = AnalDistUI()
ui.show()
sys.exit(app.exec_())
Loading

0 comments on commit 848b36c

Please sign in to comment.