py-packman 1.4.0__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Program Files/Python39/Lib/site-packages/packman/__init__.py +18 -0
- Program Files/Python39/Lib/site-packages/packman/__main__.py +4 -0
- Program Files/Python39/Lib/site-packages/packman/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/__pycache__/__main__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__init__.py +25 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/anm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/__pycache__/hd_anm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/anm/anm.py +317 -0
- Program Files/Python39/Lib/site-packages/packman/anm/hd_anm.py +656 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__init__.py +25 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/calculate_entropy.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/dci.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/hdanm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/__pycache__/predict_hinge.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/apps/calculate_entropy.py +60 -0
- Program Files/Python39/Lib/site-packages/packman/apps/dci.py +323 -0
- Program Files/Python39/Lib/site-packages/packman/apps/hdanm.py +47 -0
- Program Files/Python39/Lib/site-packages/packman/apps/predict_hinge.py +375 -0
- Program Files/Python39/Lib/site-packages/packman/bin/GUI.py +709 -0
- Program Files/Python39/Lib/site-packages/packman/bin/PACKMAN.py +154 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__init__.py +27 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/GUI.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/PACKMAN.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/bin/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/bin/logo.ico +0 -0
- Program Files/Python39/Lib/site-packages/packman/constants/Constants.py +236 -0
- Program Files/Python39/Lib/site-packages/packman/constants/__init__.py +3 -0
- Program Files/Python39/Lib/site-packages/packman/constants/__pycache__/Constants.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/constants/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/__init__.py +12 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/__pycache__/entropy.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/entropy/entropy.py +155 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/__init__.py +17 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/__pycache__/geometry.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/geometry/geometry.py +112 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__init__.py +45 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/annotations.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/atom.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/bond.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/chain.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/hetmol.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/model.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/molecule.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/protein.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/__pycache__/residue.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/annotations.py +92 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/atom.py +332 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/bond.py +186 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/chain.py +323 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/hetmol.py +224 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/model.py +703 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/molecule.py +470 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/protein.py +162 -0
- Program Files/Python39/Lib/site-packages/packman/molecule/residue.py +322 -0
- Program Files/Python39/Lib/site-packages/packman/tests/__init__.py +4 -0
- Program Files/Python39/Lib/site-packages/packman/tests/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/__pycache__/test_anm.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/anm/test_anm.py +52 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/1prw.hng +3 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/1prw.pdb +1871 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/4hla.cif +5058 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/data/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/__pycache__/test_entropy.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/entropy/test_entropy.py +30 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/__init__.py +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/__pycache__/test_molecule.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/tests/molecule/test_molecule.py +95 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/__init__.py +1 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/__pycache__/__init__.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/__pycache__/utilities.cpython-39.pyc +0 -0
- Program Files/Python39/Lib/site-packages/packman/utilities/utilities.py +180 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/PKG-INFO +86 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/SOURCES.txt +51 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/dependency_links.txt +1 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/entry_points.txt +3 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/requires.txt +5 -0
- Program Files/Python39/Lib/site-packages/py_packman-1.4.0-py3.9.egg-info/top_level.txt +1 -0
- Program Files/Python39/Scripts/packman-script.py +33 -0
- Program Files/Python39/Scripts/packman.exe +0 -0
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""The PACKMAN Graphical User Interface (GUI) host file.
|
|
3
|
+
|
|
4
|
+
How to use::
|
|
5
|
+
python -m packman gui #(For GUI)
|
|
6
|
+
python -m packman #(For CLI)
|
|
7
|
+
|
|
8
|
+
Authors:
|
|
9
|
+
* Pranav Khade(https://github.com/Pranavkhade)
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
'''
|
|
13
|
+
##################################################################################################
|
|
14
|
+
# GUI #
|
|
15
|
+
##################################################################################################
|
|
16
|
+
'''
|
|
17
|
+
import numpy
|
|
18
|
+
import logging
|
|
19
|
+
|
|
20
|
+
from .. import molecule
|
|
21
|
+
from ..apps import predict_hinge
|
|
22
|
+
from ..anm import hdANM
|
|
23
|
+
from ..entropy import PackingEntropy
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
import tkinter as tk
|
|
27
|
+
from tkinter.messagebox import showinfo, showerror
|
|
28
|
+
from tkinter import N, S, E, W, Grid, END, BooleanVar, StringVar, DISABLED
|
|
29
|
+
from tkinter.filedialog import askopenfilename
|
|
30
|
+
except:
|
|
31
|
+
print("The Python version doesn't the (built in) tkinter package. Please make sure you are using right Python interpreter. ( try: python3 -m packman gui )")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Skeleton(tk.Tk):
|
|
35
|
+
def __init__(self,frame_name):
|
|
36
|
+
tk.Tk.__init__(self)
|
|
37
|
+
|
|
38
|
+
#Global Variable
|
|
39
|
+
numberofcolumns = 3
|
|
40
|
+
self.title_content = ''
|
|
41
|
+
|
|
42
|
+
for i in range(0,numberofcolumns):
|
|
43
|
+
#Grid.rowconfigure(self, i+1, weight=1)
|
|
44
|
+
Grid.columnconfigure(self, i, weight=1)
|
|
45
|
+
#All the frames
|
|
46
|
+
self.frames = {}
|
|
47
|
+
self.frames['HomePage'] = HomePage(self)
|
|
48
|
+
self.frames['HingePrediction'] = HingePrediction(self)
|
|
49
|
+
self.frames['hdANM_GUI'] = hdANM_GUI(self)
|
|
50
|
+
self.frames['Voronoi_Packing_Entropy_GUI'] = Voronoi_Packing_Entropy_GUI(self)
|
|
51
|
+
self.frames['TopMenu'] = top_menu(self)
|
|
52
|
+
|
|
53
|
+
self.geometry("800x600")
|
|
54
|
+
|
|
55
|
+
#Icon for windows
|
|
56
|
+
try:
|
|
57
|
+
self.iconbitmap(False,'logo.ico')
|
|
58
|
+
except:
|
|
59
|
+
None
|
|
60
|
+
|
|
61
|
+
self.show_frame(frame_name)
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
self.title_content = "PACKMAN GUI"
|
|
65
|
+
self.title( self.title_content )
|
|
66
|
+
except:
|
|
67
|
+
self.title_content = "PACKMAN GUI"
|
|
68
|
+
self.title( self.title_content )
|
|
69
|
+
showinfo('Notification', 'PACKMAN was not loaded properly or has older version than 1.1.3\n\nTry:\n\npython -n pip install packman\npython -n pip install packman --upgrade')
|
|
70
|
+
self.focus_force()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def show_frame(self,frame_name):
|
|
74
|
+
for i in self.frames:
|
|
75
|
+
if(i!='TopMenu'):self.frames[i].hide()
|
|
76
|
+
self.frames[frame_name].show()
|
|
77
|
+
|
|
78
|
+
class top_menu(tk.Frame):
|
|
79
|
+
def __init__(self,parent):
|
|
80
|
+
number_of_buttons = 4
|
|
81
|
+
Canvas_top_menu = tk.Canvas(parent)
|
|
82
|
+
Canvas_top_menu.grid(row=0,column=0,columnspan=4, sticky=E+W )
|
|
83
|
+
|
|
84
|
+
for i in range(0,number_of_buttons):
|
|
85
|
+
Grid.columnconfigure(Canvas_top_menu, i, weight=1)
|
|
86
|
+
|
|
87
|
+
#tk.Frame.__init__(self)
|
|
88
|
+
tk.Button(Canvas_top_menu, text = 'Home', command = lambda: parent.show_frame('HomePage') ).grid( row=0,column=0,sticky=E+W )
|
|
89
|
+
tk.Button(Canvas_top_menu, text = 'Hinge Prediction', command = lambda: parent.show_frame('HingePrediction') ).grid( row=0,column=1,sticky=E+W )
|
|
90
|
+
tk.Button(Canvas_top_menu, text = 'hdANM', command = lambda: parent.show_frame('hdANM_GUI') ).grid( row=0,column=2,sticky=E+W )
|
|
91
|
+
tk.Button(Canvas_top_menu, text = 'Packing Entropy (Voronoi)', command = lambda: parent.show_frame('Voronoi_Packing_Entropy_GUI') ).grid( row=0,column=3,sticky=E+W )
|
|
92
|
+
|
|
93
|
+
def load_gui():
|
|
94
|
+
app = Skeleton('HomePage')
|
|
95
|
+
app.mainloop()
|
|
96
|
+
|
|
97
|
+
'''
|
|
98
|
+
##################################################################################################
|
|
99
|
+
# Home #
|
|
100
|
+
##################################################################################################
|
|
101
|
+
'''
|
|
102
|
+
|
|
103
|
+
class HomePage(tk.Frame):
|
|
104
|
+
def __init__(self,parent):
|
|
105
|
+
tk.Frame.__init__(self)
|
|
106
|
+
self.Label1 = tk.Label(parent, text="PACKMAN")
|
|
107
|
+
self.Label2 = tk.Label(parent, text="PACKMAN is a multi-utility tool to study protein packing and its effect on protein dynamics.\n\nImportant Links:")
|
|
108
|
+
|
|
109
|
+
#Input
|
|
110
|
+
self.Text1 = tk.Text(parent, height=10)
|
|
111
|
+
self.Text1.insert(END,"1. Tutorials: https://py-packman.readthedocs.io/en/latest/index.html\n2. GitHub: https://github.com/Pranavkhade/PACKMAN\n3. Online Hinge Prediction Server: https://packman.bb.iastate.edu/\n4. Online hdANM Server: https://hdanm.bb.iastate.edu/\n5. Online Voronoi Entropy Server: https://packing-entropy.bb.iastate.edu/")
|
|
112
|
+
self.Text1.config(state=DISABLED)
|
|
113
|
+
|
|
114
|
+
self.all_objects = self.__dict__
|
|
115
|
+
|
|
116
|
+
def show(self):
|
|
117
|
+
self.Label1.grid(row=1,columnspan=3, sticky=E+W, padx=10, pady=10 )
|
|
118
|
+
self.Label2.grid(row=2,columnspan=3, sticky=E+W, padx=10, pady=10 )
|
|
119
|
+
self.Text1.grid(row=3,columnspan=3, sticky=E+W, padx=10, pady=10 )
|
|
120
|
+
|
|
121
|
+
def hide(self):
|
|
122
|
+
for i in self.all_objects:
|
|
123
|
+
try:
|
|
124
|
+
self.all_objects[i].grid_forget()
|
|
125
|
+
except:
|
|
126
|
+
continue
|
|
127
|
+
|
|
128
|
+
'''
|
|
129
|
+
##################################################################################################
|
|
130
|
+
# Hinge Prediction #
|
|
131
|
+
##################################################################################################
|
|
132
|
+
'''
|
|
133
|
+
|
|
134
|
+
class HingePrediction(tk.Frame):
|
|
135
|
+
def __init__(self,parent):
|
|
136
|
+
tk.Frame.__init__(self)
|
|
137
|
+
self.grid(padx=50)
|
|
138
|
+
self.Text1 = tk.Text(parent, height=10)
|
|
139
|
+
self.Label1 = tk.Label(parent, text="Hinge Prediction")
|
|
140
|
+
self.Label2 = tk.Label(parent, text="Note: Keep increasing the Alpha Value if hinges do not show up in the results.", borderwidth=2, relief="groove")
|
|
141
|
+
self.Label3 = tk.Label(parent, text="Filename/PDB ID:")
|
|
142
|
+
self.Label4 = tk.Label(parent, text="Chain ID:")
|
|
143
|
+
self.Label5 = tk.Label(parent, text="Alpha Value:")
|
|
144
|
+
self.Label6 = tk.Label(parent, text="Number of Eccentricity Clusters:")
|
|
145
|
+
self.Label7 = tk.Label(parent, text="Minimum Hinge Length:")
|
|
146
|
+
|
|
147
|
+
#Input
|
|
148
|
+
self.Text1.insert(END,"Interface to the functionality to identify the protein hinges (separating the domains) using PACKMAN. It can also be used to read, write, manipulate and analyze protein molecules and it's properties through its API.\n\nCitation:\nKhade PM, Kumar A, Jernigan RL. Characterizing and Predicting Protein Hinges for Mechanistic\nInsight. J Mol Biol. November 2019. doi:10.1016/j.jmb.2019.11.018\n\nNOTE: Please specify filename with appropriate extension (.pdb/.cif); if the file specified is not present, it will be downloaded automatically.(if the PDB ID is valid)" )
|
|
149
|
+
self.Text1.config(state=DISABLED)
|
|
150
|
+
self.Box1 = tk.Entry(parent)
|
|
151
|
+
self.Box2 = tk.Entry(parent)
|
|
152
|
+
self.Box3 = tk.Entry(parent)
|
|
153
|
+
self.Box4 = tk.Entry(parent)
|
|
154
|
+
self.Box5 = tk.Entry(parent)
|
|
155
|
+
|
|
156
|
+
self.Box3.insert(END, '2.8')
|
|
157
|
+
self.Box4.insert(END, '4')
|
|
158
|
+
self.Box5.insert(END, '5')
|
|
159
|
+
|
|
160
|
+
self.Browse1 = tk.Button(parent, text = "Browse", command = lambda: self.browseFiles() )
|
|
161
|
+
self.Button1 = tk.Button(parent, text = "Run", command = lambda: self.run_PACKMAN() )
|
|
162
|
+
|
|
163
|
+
self.all_objects = self.__dict__
|
|
164
|
+
|
|
165
|
+
def show(self):
|
|
166
|
+
self.Text1.grid(row=2,columnspan=4,sticky=E+W, padx=10, pady=10 )
|
|
167
|
+
self.Label1.grid(row=1,columnspan=4,sticky=E+W, padx=10, pady=10 )
|
|
168
|
+
self.Label2.grid(row=3,columnspan=4,sticky=E+W, padx=10, pady=10 )
|
|
169
|
+
self.Label3.grid(row=4,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
170
|
+
self.Label4.grid(row=5,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
171
|
+
self.Label5.grid(row=6,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
172
|
+
self.Label6.grid(row=7,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
173
|
+
self.Label7.grid(row=8,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
174
|
+
|
|
175
|
+
self.Box1.grid(row=4,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
176
|
+
self.Box2.grid(row=5,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
177
|
+
self.Box3.grid(row=6,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
178
|
+
self.Box4.grid(row=7,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
179
|
+
self.Box5.grid(row=8,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
180
|
+
|
|
181
|
+
self.Browse1.grid(row=4,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
182
|
+
self.Button1.grid(row=9, column=2)
|
|
183
|
+
|
|
184
|
+
def hide(self):
|
|
185
|
+
for i in self.all_objects:
|
|
186
|
+
try:
|
|
187
|
+
self.all_objects[i].grid_forget()
|
|
188
|
+
except:
|
|
189
|
+
continue
|
|
190
|
+
|
|
191
|
+
def browseFiles(self):
|
|
192
|
+
filename = askopenfilename( title = "Select a File", filetypes = [ ('mmCIF','*.cif'),('PDB','*.pdb'),("All files", "*") ] )
|
|
193
|
+
self.Box1.delete(0,END)
|
|
194
|
+
self.Box1.insert(END,filename)
|
|
195
|
+
|
|
196
|
+
def run_PACKMAN(self):
|
|
197
|
+
"""
|
|
198
|
+
PACKMAN Hinge Prediction Algorithm
|
|
199
|
+
"""
|
|
200
|
+
try:
|
|
201
|
+
mol = molecule.load_structure(self.Box1.get())
|
|
202
|
+
except:
|
|
203
|
+
showinfo('Notification','File not found in the folder, downloading it from the PDB.')
|
|
204
|
+
|
|
205
|
+
#For file availability
|
|
206
|
+
try:
|
|
207
|
+
try:
|
|
208
|
+
molecule.download_structure(self.Box1.get().split('.')[0], ftype= self.Box1.get().split('.')[1])
|
|
209
|
+
except:
|
|
210
|
+
molecule.download_structure( self.Box1.get() )
|
|
211
|
+
except:
|
|
212
|
+
showerror('Error','Please check the internet connection or the validity of the PDB ID')
|
|
213
|
+
exit()
|
|
214
|
+
try:
|
|
215
|
+
mol = molecule.load_structure( self.Box1.get() )
|
|
216
|
+
except:
|
|
217
|
+
mol = molecule.load_structure(self.Box1.get()+'.cif')
|
|
218
|
+
|
|
219
|
+
#Other parameter validity
|
|
220
|
+
try:
|
|
221
|
+
alpha = float(self.Box3.get())
|
|
222
|
+
ecc_clust = int(self.Box4.get())
|
|
223
|
+
min_length = int(self.Box5.get())
|
|
224
|
+
except:
|
|
225
|
+
showerror('Error','Check the value of the parameters:\n\nAlpha Value(float)\nNumber of Eccentricity Clusters (int)\nMinimum Hinge Length (int)')
|
|
226
|
+
|
|
227
|
+
#For checking if the format is right and chain id is right
|
|
228
|
+
try:
|
|
229
|
+
backbone = [j for i in mol[0][self.Box2.get()].get_backbone() for j in i if j is not None]
|
|
230
|
+
predict_hinge(backbone, Alpha=alpha, nclusters=ecc_clust, MinimumHingeLength=min_length, outputfile=open('output.txt', 'w'))
|
|
231
|
+
except:
|
|
232
|
+
showinfo('Notification','Chain ID is either not specified or not valid. Running PACKMAN on all the chains.')
|
|
233
|
+
try:
|
|
234
|
+
for chain in mol[0].get_chains():
|
|
235
|
+
try:
|
|
236
|
+
backbone = [j for i in mol[0][chain.get_id()].get_backbone() for j in i if j is not None]
|
|
237
|
+
predict_hinge(backbone, Alpha=alpha, nclusters=ecc_clust, MinimumHingeLength=min_length, outputfile=open('output.txt', 'w'))
|
|
238
|
+
except:
|
|
239
|
+
None
|
|
240
|
+
|
|
241
|
+
except:
|
|
242
|
+
showerror('Error','Possible Solutions:\n1. Provide valid chain ID or check the PDB file format.\n2. Try changing Alpha Value')
|
|
243
|
+
exit()
|
|
244
|
+
|
|
245
|
+
#At this point, everything is okay
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
#Hinge Prediction Results
|
|
249
|
+
pop_up1 = tk.Toplevel()
|
|
250
|
+
pop_up1.title('PACKMAN Results')
|
|
251
|
+
|
|
252
|
+
Canvas1 = tk.Canvas(pop_up1)
|
|
253
|
+
Canvas1.grid(row=0,column=0,columnspan=6,sticky=N+S+E+W, padx=10, pady=10 )
|
|
254
|
+
|
|
255
|
+
#Scrollbar
|
|
256
|
+
vsb = tk.Scrollbar(pop_up1, orient="vertical", command=Canvas1.yview)
|
|
257
|
+
vsb.grid(row=0, column=7, rowspan=10 , sticky=N+S)
|
|
258
|
+
Canvas1.configure(yscrollcommand=vsb.set)
|
|
259
|
+
|
|
260
|
+
#Frame
|
|
261
|
+
canvas1_frame1 = tk.Frame(Canvas1)
|
|
262
|
+
Canvas1.create_window((0, 0), window=canvas1_frame1, anchor='nw')
|
|
263
|
+
|
|
264
|
+
tk.Label(canvas1_frame1, text = 'NOTE: Please check in front of the hinges you want to keep and click on the "Save HNG file" button to generate input file for hdANM. Please provide a valid filename\n Tip: p-value ideally should be <0.05 ').grid(row=0,columnspan=5)
|
|
265
|
+
tk.Label(canvas1_frame1, text = 'Hinge ID').grid(row=1,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
266
|
+
tk.Label(canvas1_frame1, text = 'PDB ID/Filename').grid(row=1,column=1,sticky=N+S+E+W, padx=10, pady=10 )
|
|
267
|
+
tk.Label(canvas1_frame1, text = 'Chain ID').grid(row=1,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
268
|
+
tk.Label(canvas1_frame1, text = 'Residue IDs').grid(row=1,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
269
|
+
tk.Label(canvas1_frame1, text = 'p-value').grid(row=1,column=4,sticky=N+S+E+W, padx=10, pady=10 )
|
|
270
|
+
tk.Label(canvas1_frame1, text = 'Select').grid(row=1,column=5,sticky=N+S+E+W, padx=10, pady=10 )
|
|
271
|
+
|
|
272
|
+
All_Hinges = []
|
|
273
|
+
if(self.Box2.get()!=''):
|
|
274
|
+
All_Hinges = mol[0][self.Box2.get()].get_hinges()
|
|
275
|
+
else:
|
|
276
|
+
for i in mol[0].get_chains():
|
|
277
|
+
All_Hinges.extend( mol[0][i.get_id()].get_hinges() )
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
Selected_Hinges = [False]*len(All_Hinges)
|
|
281
|
+
for numi, i in enumerate(All_Hinges):
|
|
282
|
+
Residue_IDs = sorted([j.get_id() for j in i.get_elements()])
|
|
283
|
+
ChainOfHinge = i.get_elements()[0].get_parent().get_id()
|
|
284
|
+
|
|
285
|
+
tk.Label(canvas1_frame1, text = numi+1).grid(row=numi+2,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
286
|
+
tk.Label(canvas1_frame1, text = self.Box1.get() ).grid(row=numi+2,column=1,sticky=N+S+E+W, padx=10, pady=10 )
|
|
287
|
+
tk.Label(canvas1_frame1, text = ChainOfHinge ).grid(row=numi+2,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
288
|
+
tk.Label(canvas1_frame1, text = str(Residue_IDs[0])+':'+str(Residue_IDs[-1]) ).grid(row=numi+2,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
289
|
+
tk.Label(canvas1_frame1, text = i.get_pvalue()).grid(row=numi+2,column=4,sticky=N+S+E+W, padx=10, pady=10 )
|
|
290
|
+
|
|
291
|
+
Selected_Hinges[numi] = BooleanVar(canvas1_frame1)
|
|
292
|
+
Check = tk.Checkbutton(canvas1_frame1, variable=Selected_Hinges[numi], onvalue=True, offvalue=False)
|
|
293
|
+
Check.grid(row=numi+2,column=5,sticky=N+S+E+W, padx=10, pady=10 )
|
|
294
|
+
|
|
295
|
+
#Details Button
|
|
296
|
+
tk.Button(canvas1_frame1,text = 'Details', command= lambda i=i:show_details( i.get_stats() ) ).grid(row=numi+2,column=6,sticky=N+S+E+W, padx=10, pady=10 )
|
|
297
|
+
|
|
298
|
+
#Fix the length of the result
|
|
299
|
+
canvas1_frame1.update_idletasks()
|
|
300
|
+
Canvas1.config(width=1000 ,height = 400)
|
|
301
|
+
Canvas1.config(scrollregion = Canvas1.bbox("all"))
|
|
302
|
+
|
|
303
|
+
tk.Label(pop_up1, text = 'output filename (.hng)').grid(row=2,column=1,sticky=N+S+E+W, padx=10, pady=10 )
|
|
304
|
+
self.output_filename = tk.Entry(pop_up1)
|
|
305
|
+
tk.Button(pop_up1,text = 'Save HNG file', command=lambda: write_hng_file() ).grid(row=2,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
306
|
+
|
|
307
|
+
self.output_filename.insert(END,self.Box1.get()+'.hng')
|
|
308
|
+
self.output_filename.grid(row=2,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
309
|
+
|
|
310
|
+
def write_hng_file():
|
|
311
|
+
ALL_RESIDUES = {}
|
|
312
|
+
for i in mol[0].get_chains():
|
|
313
|
+
try:
|
|
314
|
+
ALL_RESIDUES[i.get_id()] = sorted([i.get_id() for i in mol[0][i.get_id()].get_residues() if i!=None])
|
|
315
|
+
except:
|
|
316
|
+
None
|
|
317
|
+
|
|
318
|
+
select_count = 0
|
|
319
|
+
last_hinge_end = 0
|
|
320
|
+
fh = open(self.output_filename.get(), 'w')
|
|
321
|
+
for numi, i in enumerate(Selected_Hinges):
|
|
322
|
+
current_hinge = All_Hinges[numi]
|
|
323
|
+
ChainOfHinge = current_hinge.get_elements()[0].get_parent().get_id()
|
|
324
|
+
|
|
325
|
+
if( i.get() and select_count==0 ):
|
|
326
|
+
hinge_res_ids = sorted([j.get_id() for j in current_hinge.get_elements()])
|
|
327
|
+
|
|
328
|
+
select_count += 1
|
|
329
|
+
if(ALL_RESIDUES[ChainOfHinge][0]!=hinge_res_ids[0]):
|
|
330
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(ALL_RESIDUES[ChainOfHinge][0])+':'+str(hinge_res_ids[0]-1)+'\n' )
|
|
331
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
|
|
332
|
+
else:
|
|
333
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
|
|
334
|
+
last_hinge_end = hinge_res_ids[-1]
|
|
335
|
+
elif( i.get() ):
|
|
336
|
+
hinge_res_ids = sorted([j.get_id() for j in current_hinge.get_elements()])
|
|
337
|
+
select_count += 1
|
|
338
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(hinge_res_ids[0]-1)+'\n' )
|
|
339
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'H'+str(select_count) +'\t'+ str(hinge_res_ids[0])+':'+str(hinge_res_ids[-1])+'\n' )
|
|
340
|
+
last_hinge_end = hinge_res_ids[-1]
|
|
341
|
+
try:
|
|
342
|
+
if(ChainOfHinge != All_Hinges[numi+1].get_elements()[0].get_parent().get_id() ):
|
|
343
|
+
select_count += 1
|
|
344
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(ALL_RESIDUES[ChainOfHinge][-1])+'\n' )
|
|
345
|
+
last_hinge_end = 0
|
|
346
|
+
except:
|
|
347
|
+
None
|
|
348
|
+
|
|
349
|
+
if(last_hinge_end != ALL_RESIDUES[ChainOfHinge][-1]):
|
|
350
|
+
select_count += 1
|
|
351
|
+
fh.write(self.Box1.get()+'_'+ChainOfHinge +'\t'+ 'D'+str(select_count) +'\t'+ str(last_hinge_end+1)+':'+str(ALL_RESIDUES[ChainOfHinge][-1])+'\n' )
|
|
352
|
+
fh.flush()
|
|
353
|
+
fh.close()
|
|
354
|
+
showinfo('Notification',self.output_filename.get()+' file saved!')
|
|
355
|
+
|
|
356
|
+
def show_details(content):
|
|
357
|
+
pop_up1_2 = tk.Toplevel()
|
|
358
|
+
pop_up1_2.title('Hinge Details')
|
|
359
|
+
|
|
360
|
+
for numi, i in enumerate(content):
|
|
361
|
+
for numj,j in enumerate(i):
|
|
362
|
+
tk.Label(pop_up1_2, text = j).grid(row=numi+2,column=numj,sticky=N+S+E+W, padx=10, pady=10 )
|
|
363
|
+
|
|
364
|
+
return True
|
|
365
|
+
|
|
366
|
+
#on_click() Ends here
|
|
367
|
+
return True
|
|
368
|
+
|
|
369
|
+
'''
|
|
370
|
+
##################################################################################################
|
|
371
|
+
# hd-ANM #
|
|
372
|
+
##################################################################################################
|
|
373
|
+
'''
|
|
374
|
+
|
|
375
|
+
class hdANM_GUI(tk.Frame):
|
|
376
|
+
def __init__(self,parent):
|
|
377
|
+
#Varible
|
|
378
|
+
self.mass_type = StringVar(parent)
|
|
379
|
+
self.mass_type.set("Molecular Weight") # default value
|
|
380
|
+
|
|
381
|
+
#
|
|
382
|
+
tk.Frame.__init__(self)
|
|
383
|
+
self.Text1 = tk.Text(parent, height=10)
|
|
384
|
+
self.Label1 = tk.Label(parent, text="hdANM")
|
|
385
|
+
self.Label2 = tk.Label(parent, text="Note: .hng file can be obtained from the 'Hinge Prediction' section. ", borderwidth=2, relief="groove")
|
|
386
|
+
|
|
387
|
+
self.Label3 = tk.Label(parent, text="Filename/PDB ID:")
|
|
388
|
+
self.Label4 = tk.Label(parent, text="Chain ID:")
|
|
389
|
+
|
|
390
|
+
self.Label5 = tk.Label(parent, text="Cutoff Value")
|
|
391
|
+
self.Label6 = tk.Label(parent, text="Power of Distance")
|
|
392
|
+
self.Label7 = tk.Label(parent, text="Mass of the residue")
|
|
393
|
+
self.Label7 = tk.Label(parent, text="Input (.hng) Filename")
|
|
394
|
+
self.Label8 = tk.Label(parent, text="Mass of the residue")
|
|
395
|
+
|
|
396
|
+
#Input
|
|
397
|
+
self.Text1.insert(END,"hdANM is a comprehensive Elastic Network Model. Please read the paper for more details.\n\nCitation:\n\nPranav M. Khade, Domenico Scaramozzino, Ambuj Kumar, Giuseppe Lacidogna, Alberto Carpinteri, Robert L. Jernigan, \nhdANM: a new comprehensive dynamics model for protein hinges,\nBiophysical Journal, 2021, https://doi.org/10.1016/j.bpj.2021.10.017.\n\nNOTE: Please specify filename with appropriate extension (.pdb/.cif); if the file specified is not present, it will be downloaded automatically.(if the PDB ID is valid)" )
|
|
398
|
+
self.Text1.config(state=DISABLED)
|
|
399
|
+
|
|
400
|
+
self.Box1 = tk.Entry(parent)
|
|
401
|
+
self.Box2 = tk.Entry(parent)
|
|
402
|
+
self.Box3 = tk.Entry(parent)
|
|
403
|
+
self.Box4 = tk.Entry(parent)
|
|
404
|
+
self.Box5 = tk.Entry(parent)
|
|
405
|
+
|
|
406
|
+
self.Box3.insert(END, '15')
|
|
407
|
+
self.Box4.insert(END, '0')
|
|
408
|
+
self.Box5.insert(END, 'output.hng')
|
|
409
|
+
self.dropdown1 = tk.OptionMenu(parent, self.mass_type, "Molecular Weight", "Unit", "Atomics Mass")
|
|
410
|
+
|
|
411
|
+
self.Browse1 = tk.Button(parent, text = "Browse", command = lambda: self.browseFiles(1, filetypes = [ ('mmCIF','*.cif'),('PDB','*.pdb'),("All files", "*") ] ) )
|
|
412
|
+
self.Browse2 = tk.Button(parent, text = "Browse", command = lambda: self.browseFiles(5, filetypes = [ ('HNG','*.hng'),("All files", "*") ]) )
|
|
413
|
+
self.Button1 = tk.Button(parent, text = "Run", command = lambda: self.run_hdANM() )
|
|
414
|
+
|
|
415
|
+
self.all_objects = self.__dict__
|
|
416
|
+
|
|
417
|
+
def show(self):
|
|
418
|
+
self.Text1.grid(row=2,columnspan=4,sticky=N+S+E+W, padx=10, pady=10 )
|
|
419
|
+
self.Label1.grid(row=1,columnspan=4,sticky=N+S+E+W, padx=10, pady=10 )
|
|
420
|
+
self.Label2.grid(row=3,columnspan=4,sticky=N+S+E+W, padx=10, pady=10 )
|
|
421
|
+
self.Label3.grid(row=4,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
422
|
+
self.Label4.grid(row=5,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
423
|
+
self.Label5.grid(row=6,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
424
|
+
self.Label6.grid(row=7,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
425
|
+
self.Label7.grid(row=8,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
426
|
+
self.Label8.grid(row=9,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
self.Box1.grid(row=4,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
430
|
+
self.Box2.grid(row=5,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
431
|
+
self.Box3.grid(row=6,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
432
|
+
self.Box4.grid(row=7,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
433
|
+
self.Box5.grid(row=8,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
434
|
+
self.dropdown1.grid(row=9,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
435
|
+
|
|
436
|
+
self.Browse1.grid(row=4,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
437
|
+
self.Browse2.grid(row=8,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
438
|
+
self.Button1.grid(row=10, column=2)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def hide(self):
|
|
442
|
+
for i in self.all_objects:
|
|
443
|
+
try:
|
|
444
|
+
self.all_objects[i].grid_forget()
|
|
445
|
+
except:
|
|
446
|
+
continue
|
|
447
|
+
|
|
448
|
+
def browseFiles(self,fill_box_num,filetypes):
|
|
449
|
+
filename = askopenfilename( title = "Select a File", filetypes=filetypes )
|
|
450
|
+
if(fill_box_num==1):
|
|
451
|
+
self.Box1.delete(0,END)
|
|
452
|
+
self.Box1.insert(END,filename)
|
|
453
|
+
elif(fill_box_num==5):
|
|
454
|
+
self.Box5.delete(0,END)
|
|
455
|
+
self.Box5.insert(END,filename)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
def run_hdANM(self):
|
|
459
|
+
try:
|
|
460
|
+
mol = molecule.load_structure(self.Box1.get())
|
|
461
|
+
except:
|
|
462
|
+
showinfo('Notification','File not found in the folder, downloading it from the PDB.')
|
|
463
|
+
|
|
464
|
+
#For file availability
|
|
465
|
+
try:
|
|
466
|
+
try:
|
|
467
|
+
molecule.download_structure(self.Box1.get().split('.')[0], ftype= self.Box1.get().split('.')[1])
|
|
468
|
+
except:
|
|
469
|
+
molecule.download_structure( self.Box1.get() )
|
|
470
|
+
except:
|
|
471
|
+
showerror('Error','Please check the internet connection or the validity of the PDB ID')
|
|
472
|
+
exit()
|
|
473
|
+
try:
|
|
474
|
+
mol = molecule.load_structure( self.Box1.get() )
|
|
475
|
+
except:
|
|
476
|
+
mol = molecule.load_structure(self.Box1.get()+'.cif')
|
|
477
|
+
|
|
478
|
+
#Other parameter validity
|
|
479
|
+
try:
|
|
480
|
+
cutoff_value = float(self.Box3.get())
|
|
481
|
+
power_of_distance = int(self.Box4.get())
|
|
482
|
+
except:
|
|
483
|
+
showerror('Error','Check the value of the parameters:\n\nCutoff Value (float)\nPower of Distance (float)')
|
|
484
|
+
|
|
485
|
+
#For checking if the format is right and chain id is right
|
|
486
|
+
try:
|
|
487
|
+
calpha=[i for i in mol[0][self.Box2.get()].get_calpha() if i is not None]
|
|
488
|
+
except:
|
|
489
|
+
showinfo('Notification','Chain ID is either not specified or not valid. Running hdANM on all the chains.')
|
|
490
|
+
try:
|
|
491
|
+
calpha = []
|
|
492
|
+
for chain in mol[0].get_chains():
|
|
493
|
+
try:
|
|
494
|
+
calpha.extend( [i for i in mol[0][chain.get_id()].get_calpha() if i is not None] )
|
|
495
|
+
except:
|
|
496
|
+
None
|
|
497
|
+
|
|
498
|
+
except:
|
|
499
|
+
showerror('Error','Provide valid chain ID or check the PDB file format.')
|
|
500
|
+
exit()
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
Model=hdANM( calpha,dr=cutoff_value,power=power_of_distance,hng_file=self.Box5.get() )
|
|
504
|
+
|
|
505
|
+
if(self.mass_type.get() == "Molecular Weight"):
|
|
506
|
+
Model.calculate_hessian(mass_type='residue')
|
|
507
|
+
elif(self.mass_type.get() == "Unit"):
|
|
508
|
+
Model.calculate_hessian(mass_type='unit')
|
|
509
|
+
elif(self.mass_type.get() == "Atomics Mass"):
|
|
510
|
+
Model.calculate_hessian(mass_type='atom')
|
|
511
|
+
|
|
512
|
+
Model.calculate_decomposition()
|
|
513
|
+
|
|
514
|
+
#Results
|
|
515
|
+
pop_up1 = tk.Toplevel()
|
|
516
|
+
pop_up1.title('hdANM Results')
|
|
517
|
+
tk.Label(pop_up1,text="Save the hdANM output matrices", borderwidth=2, relief="groove").grid(row=0,columnspan=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
518
|
+
|
|
519
|
+
tk.Label(pop_up1,text="Select the matrix ").grid(row=2,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
520
|
+
|
|
521
|
+
#Section 1
|
|
522
|
+
user_matrix_choise = StringVar(pop_up1)
|
|
523
|
+
user_matrix_choise.set("hdANM Eigen Vectors")
|
|
524
|
+
tk.OptionMenu(pop_up1, user_matrix_choise, "hdANM Eigen Vectors", "hdANM Eigen Values ").grid(row=2,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
525
|
+
tk.Button(pop_up1,text='Save .CSV file',command=lambda user_matrix_choise=user_matrix_choise : save_matrix(user_matrix_choise.get()) ).grid(row=3,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
#Section 2
|
|
529
|
+
tk.Label(pop_up1,text="Generate Movies from Eigenvectors",borderwidth=2, relief="groove").grid(row=5,columnspan=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
530
|
+
tk.Label(pop_up1, text="Note: Non rigid modes start from 6").grid(row=6,columnspan=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
531
|
+
tk.Label(pop_up1, text="Projection Method").grid(row=7,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
532
|
+
tk.Label(pop_up1, text="Mode Number").grid(row=8,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
533
|
+
tk.Label(pop_up1, text="Number of Frames").grid(row=9,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
534
|
+
tk.Label(pop_up1, text="Movie Scale").grid(row=10,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
535
|
+
|
|
536
|
+
user_projection_choise = StringVar(pop_up1)
|
|
537
|
+
user_projection_choise.set("Curvilinear")
|
|
538
|
+
tk.OptionMenu(pop_up1, user_projection_choise, "Curvilinear", "Linear").grid(row=7,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
539
|
+
n_mode = tk.Entry(pop_up1)
|
|
540
|
+
n_mode.grid(row=8 ,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
541
|
+
n_mode.insert(END,6)
|
|
542
|
+
n_frames = tk.Entry(pop_up1)
|
|
543
|
+
n_frames.grid(row=9 ,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
544
|
+
n_frames.insert(END,10)
|
|
545
|
+
n_scale = tk.Entry(pop_up1)
|
|
546
|
+
n_scale.grid(row=10,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
547
|
+
n_scale.insert(END,2)
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
self.save_movie_button = tk.Button(pop_up1,text='Save Movie',command=lambda : save_movie( n_mode, n_frames, n_scale, user_projection_choise.get() ) )
|
|
551
|
+
self.save_movie_button.grid(row=11,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
def save_matrix(choise):
|
|
555
|
+
if(choise == "hdANM Eigen Vectors"):
|
|
556
|
+
numpy.savetxt("hdANM Eigen Vectors.csv",Model.get_eigenvectors(),delimiter=",")
|
|
557
|
+
showinfo('Notification','hdANM Eigen Vectors.csv file saved!')
|
|
558
|
+
elif(choise== "hdANM Eigen Values" ):
|
|
559
|
+
numpy.savetxt("hdANM Eigen Values.csv",Model.get_eigenvalues(),delimiter=",")
|
|
560
|
+
showinfo('Notification','hdANM Eigen Values.csv file saved!')
|
|
561
|
+
return True
|
|
562
|
+
|
|
563
|
+
def save_movie(n_mode, n_frames, n_scale, projection):
|
|
564
|
+
try:
|
|
565
|
+
n_mode = int(n_mode.get())
|
|
566
|
+
n_frames = int(n_frames.get())
|
|
567
|
+
n_scale = float(n_scale.get())
|
|
568
|
+
except:
|
|
569
|
+
showinfo('Notification','Please check the parameters.\n\nMode Number (int)\nNumber of Frames (int)\nMovie Scale (float)')
|
|
570
|
+
|
|
571
|
+
if(projection == "Curvilinear"):
|
|
572
|
+
Model.calculate_movie(n_mode, n=n_frames,scale=n_scale,extrapolation="curvilinear")
|
|
573
|
+
elif(projection =="Linear"):
|
|
574
|
+
Model.calculate_movie(n_mode, n=n_frames,scale=n_scale,extrapolation="linear")
|
|
575
|
+
showinfo('Notification',str(n_mode)+'.pdb /.cif movie generated & saved.')
|
|
576
|
+
return True
|
|
577
|
+
|
|
578
|
+
return True
|
|
579
|
+
|
|
580
|
+
'''
|
|
581
|
+
##################################################################################################
|
|
582
|
+
# Entropy #
|
|
583
|
+
##################################################################################################
|
|
584
|
+
'''
|
|
585
|
+
|
|
586
|
+
class Voronoi_Packing_Entropy_GUI(tk.Frame):
|
|
587
|
+
def __init__(self,parent):
|
|
588
|
+
tk.Frame.__init__(self)
|
|
589
|
+
self.grid(padx=50)
|
|
590
|
+
self.Text1 = tk.Text(parent, height=10)
|
|
591
|
+
self.Label1 = tk.Label(parent, text="Entropy")
|
|
592
|
+
self.Label2 = tk.Label(parent, text="Note: Important information in the section above. (Use scrolling)", borderwidth=2, relief="groove")
|
|
593
|
+
self.Label3 = tk.Label(parent, text="Filename/PDB ID:")
|
|
594
|
+
self.Label4 = tk.Label(parent, text="Chain IDs (comma separated):")
|
|
595
|
+
self.Label5 = tk.Label(parent, text="Probe size:")
|
|
596
|
+
self.Label6 = tk.Label(parent, text="On Sphere Points:")
|
|
597
|
+
self.Label7 = tk.Label(parent, text="Output Filename:")
|
|
598
|
+
|
|
599
|
+
#Input
|
|
600
|
+
self.Text1.insert(END,"Interface to the functionality to calculate Packing Entropy using PACKMAN. The same program is available via API and CLI.\n\nCitation:\nPaper Under Review\n\nNOTE: Please specify filename with appropriate extension (.pdb/.cif); if the file specified is not present, it will be downloaded automatically.(if the PDB ID is valid).\n\nPlease note that selecting Chain IDs option is used to calculate the entropy with or without the other chains. For example, if a protein has three chains A, B & C, and the user wants to calculate the entropy of chains A & B in the absence of chain C, the user can use Chain IDs A,B parameter-option do so. However, the presence of the chain C is not an issue, but the user wants to calculate the entropy of chain A & B (with C present), Chain IDs option can be ignored, and chain column in the output should be used to select only A & B chains. The use of API is recommended to control these types of situations efficiently that require more control. Also, we recommend reading the publication for more details on the other parameters." )
|
|
601
|
+
self.Text1.config(state=DISABLED)
|
|
602
|
+
self.Box1 = tk.Entry(parent)
|
|
603
|
+
self.Box2 = tk.Entry(parent)
|
|
604
|
+
self.Box3 = tk.Entry(parent)
|
|
605
|
+
self.Box4 = tk.Entry(parent)
|
|
606
|
+
self.Box5 = tk.Entry(parent)
|
|
607
|
+
|
|
608
|
+
self.Box3.insert(END, '1.4')
|
|
609
|
+
self.Box4.insert(END, '30')
|
|
610
|
+
self.Box5.insert(END, 'voronoi_packing_entropy_output.txt')
|
|
611
|
+
|
|
612
|
+
self.Browse1 = tk.Button(parent, text = "Browse", command = lambda: self.browseFiles() )
|
|
613
|
+
self.Button1 = tk.Button(parent, text = "Run", command = lambda: self.run_Entropy() )
|
|
614
|
+
|
|
615
|
+
self.all_objects = self.__dict__
|
|
616
|
+
|
|
617
|
+
def show(self):
|
|
618
|
+
self.Text1.grid(row=2,columnspan=4,sticky=E+W, padx=10, pady=10 )
|
|
619
|
+
self.Label1.grid(row=1,columnspan=4,sticky=E+W, padx=10, pady=10 )
|
|
620
|
+
self.Label2.grid(row=3,columnspan=4,sticky=E+W, padx=10, pady=10 )
|
|
621
|
+
self.Label3.grid(row=4,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
622
|
+
self.Label4.grid(row=5,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
623
|
+
self.Label5.grid(row=6,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
624
|
+
self.Label6.grid(row=7,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
625
|
+
self.Label7.grid(row=8,column=0,sticky=N+S+E+W, padx=10, pady=10 )
|
|
626
|
+
|
|
627
|
+
self.Box1.grid(row=4,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
628
|
+
self.Box2.grid(row=5,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
629
|
+
self.Box3.grid(row=6,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
630
|
+
self.Box4.grid(row=7,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
631
|
+
self.Box5.grid(row=8,column=2,sticky=N+S+E+W, padx=10, pady=10 )
|
|
632
|
+
|
|
633
|
+
self.Browse1.grid(row=4,column=3,sticky=N+S+E+W, padx=10, pady=10 )
|
|
634
|
+
self.Button1.grid(row=9, column=2)
|
|
635
|
+
|
|
636
|
+
def hide(self):
|
|
637
|
+
for i in self.all_objects:
|
|
638
|
+
try:
|
|
639
|
+
self.all_objects[i].grid_forget()
|
|
640
|
+
except:
|
|
641
|
+
continue
|
|
642
|
+
|
|
643
|
+
def browseFiles(self):
|
|
644
|
+
filename = askopenfilename( title = "Select a File", filetypes = [ ('mmCIF','*.cif'),('PDB','*.pdb'),("All files", "*") ] )
|
|
645
|
+
self.Box1.delete(0,END)
|
|
646
|
+
self.Box1.insert(END,filename)
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
def run_Entropy(self):
|
|
650
|
+
"""
|
|
651
|
+
PACKMAN Hinge Prediction Algorithm
|
|
652
|
+
"""
|
|
653
|
+
try:
|
|
654
|
+
mol = molecule.load_structure(self.Box1.get())
|
|
655
|
+
except:
|
|
656
|
+
showinfo('Notification','File not found in the folder, downloading it from the PDB.')
|
|
657
|
+
|
|
658
|
+
#For file availability
|
|
659
|
+
try:
|
|
660
|
+
try:
|
|
661
|
+
molecule.download_structure(self.Box1.get().split('.')[0], ftype= self.Box1.get().split('.')[1])
|
|
662
|
+
except:
|
|
663
|
+
molecule.download_structure( self.Box1.get() )
|
|
664
|
+
except:
|
|
665
|
+
showerror('Error','Please check the internet connection or the validity of the PDB ID')
|
|
666
|
+
exit()
|
|
667
|
+
try:
|
|
668
|
+
mol = molecule.load_structure( self.Box1.get() )
|
|
669
|
+
except:
|
|
670
|
+
mol = molecule.load_structure(self.Box1.get()+'.cif')
|
|
671
|
+
|
|
672
|
+
#Other parameter validity
|
|
673
|
+
try:
|
|
674
|
+
input_probe_size = float(self.Box3.get())
|
|
675
|
+
input_onspherepoints = int(self.Box4.get())
|
|
676
|
+
output_file = open(self.Box5.get(),'w')
|
|
677
|
+
except:
|
|
678
|
+
showerror('Error','Check the value of the parameters:\n\nAlpha Value(float)\nNumber of Eccentricity Clusters (int)\nMinimum Hinge Length (int)')
|
|
679
|
+
|
|
680
|
+
try:
|
|
681
|
+
input_chains = self.Box2.get().split(',')
|
|
682
|
+
except:
|
|
683
|
+
input_chains = None
|
|
684
|
+
|
|
685
|
+
if(input_chains==['']):
|
|
686
|
+
input_chains=None
|
|
687
|
+
|
|
688
|
+
output_file.write('Frame\tChain\tResidueID\tResidueName\tPackingEntropy\n')
|
|
689
|
+
for i in mol:
|
|
690
|
+
try:
|
|
691
|
+
result = PackingEntropy(i.get_atoms(), chains=input_chains, probe_size=input_probe_size, onspherepoints=input_onspherepoints)
|
|
692
|
+
except:
|
|
693
|
+
logging.error('Please check the parameters.')
|
|
694
|
+
exit()
|
|
695
|
+
|
|
696
|
+
for j in i.get_residues():
|
|
697
|
+
try:
|
|
698
|
+
output_file.write( str(i.get_id())+'\t'+str(j.get_parent().get_id())+'\t'+str(j.get_id())+'\t'+str(j.get_name())+'\t'+str(j.get_entropy('PackingEntropy'))+'\n' )
|
|
699
|
+
except:
|
|
700
|
+
None
|
|
701
|
+
try:
|
|
702
|
+
output_file.write('Total (Frame '+str(i.get_id())+')\t'+str(result.get_total_entropy())+'\n' )
|
|
703
|
+
except:
|
|
704
|
+
None
|
|
705
|
+
output_file.flush()
|
|
706
|
+
output_file.close()
|
|
707
|
+
showinfo('Notification','The Voronoi Packing Entropy calculation is completed successfully. Please check the output file.')
|
|
708
|
+
#on_click() Ends here
|
|
709
|
+
return True
|