-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsagasui
More file actions
executable file
·176 lines (142 loc) · 4.63 KB
/
sagasui
File metadata and controls
executable file
·176 lines (142 loc) · 4.63 KB
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
#!/usr/bin/env python3
"""
Created on Mon Mar 30 16:56:12 2020
@author: Christian M. Orr
"""
import sagasu_core
import tkinter as tk
import os
import sys
from mpl_toolkits.mplot3d import Axes3D
import subprocess
import shlex
# =============================================================================
# class IORedirector(object):
# '''A general class for redirecting I/O to this Text widget.'''
# def __init__(self, text_area):
# self.text_area = text_area
#
#
# class StdoutRedirector(IORedirector):
# '''A class for redirecting stdout to this Text widget.'''
# def write(self, str):
# self.text_area.write(str, False)
#
#
# def redirector(inputStr=""):
# import sys
# root = Toplevel()
# T = Text(root)
# sys.stdout = StdoutRedirector(T)
# T.pack()
# T.insert(END, inputStr)
# =============================================================================
os.system("module load mx")
os.system("module load global/cluster")
path = os.getcwd()
HEIGHT = 1200
WIDTH = 1000
def run_sagasu(
projname, pro_or_ana, highres, lowres, highsites, lowsites, fa_path, ntry, clust
):
os.chdir(path)
clusteranalysis = "y"
projname = projname
pro_or_ana = str(pro_or_ana).lower()
highres = int((10 * float(highres)))
lowres = int((10 * float(lowres)))
highsites = int(highsites)
lowsites = int(lowsites)
insin = os.path.join(fa_path, projname + "_fa.ins")
hklin = os.path.join(fa_path, projname + "_fa.hkl")
ntry = int(ntry)
statusofrun = "-hold_jid "
clust = str(clust).lower()
sagasu_core.shelx_write(projname)
sagasu_core.run_sagasu_proc(
pro_or_ana,
projname,
highres,
lowres,
highsites,
lowsites,
insin,
hklin,
path,
ntry,
statusofrun,
clust,
)
sagasu_core.cleanup_prev(path, projname, highres, lowres, highsites, lowsites)
sagasu_core.run_sagasu_analysis(
projname, highres, lowres, highsites, lowsites, path, clusteranalysis
)
sagasu_core.tophits(projname, path)
height = 1000
width = 1000
root = tk.Tk()
root.title("Sagasu - SHELXD Grid Search")
root.configure(background="white", height=height, width=width)
sagasutitle = tk.Label(root, text="探す", font=120, bg="blue", fg="black").grid(
row=0, column=0, columnspan=4
)
frame = tk.Frame(root, bg="#80c1ff", bd=5)
frame.grid(row=1, column=1)
pa = tk.StringVar()
tk.Radiobutton(frame, text="Processing", variable=pa, value="p").grid(
row=1, column=0, columnspan=2, padx=5, pady=5
)
tk.Radiobutton(frame, text="Analysis", variable=pa, value="a").grid(
row=1, column=2, columnspan=2, padx=5, pady=5
)
projnameTxt = tk.Label(frame, text="Project name: ", fg="black").grid(row=2, column=0)
projnameIn = tk.Entry(frame, width=10, bg="green")
projnameIn.grid(row=2, column=1, columnspan=3, sticky="W")
fa_pathTxt = tk.Label(frame, text="Project path: ", fg="black").grid(row=3, column=0)
fa_pathIn = tk.Entry(frame, width=40)
fa_pathIn.grid(row=3, column=1, columnspan=3, sticky="W")
lowresTxt = tk.Label(frame, text="Low res: ", fg="black").grid(row=4, column=0)
lowresIn = tk.Entry(frame, width=4)
lowresIn.grid(row=4, column=1)
highresTxt = tk.Label(frame, text="High res: ", fg="black").grid(row=4, column=2)
highresIn = tk.Entry(frame, width=4)
highresIn.grid(row=4, column=3)
lowsitesTxt = tk.Label(frame, text="Low sites: ", fg="black").grid(row=5, column=0)
lowsitesIn = tk.Entry(frame, width=4)
lowsitesIn.grid(row=5, column=1)
highsitesTxt = tk.Label(frame, text="High sites: ", fg="black").grid(row=5, column=2)
highsitesIn = tk.Entry(frame, width=4)
highsitesIn.grid(row=5, column=3)
ntryTxt = tk.Label(frame, text="Trys: ", fg="black").grid(row=6, column=0)
ntryIn = tk.Entry(frame, width=7)
ntryIn.grid(row=6, column=2, columnspan=2)
cl = tk.StringVar()
tk.Radiobutton(frame, text="Cluster", variable=cl, value="c").grid(
row=7, column=0, columnspan=2, padx=5, pady=5
)
tk.Radiobutton(frame, text="Local", variable=cl, value="l").grid(
row=7, column=2, columnspan=2, padx=5, pady=5
)
sub = tk.Button(
frame,
text="Run Sagasu",
width=15,
command=lambda: run_sagasu(
projnameIn.get(),
pa.get(),
highresIn.get(),
lowresIn.get(),
highsitesIn.get(),
lowsitesIn.get(),
fa_pathIn.get(),
ntryIn.get(),
cl.get(),
),
).grid(row=8, column=1, columnspan=3, sticky="E")
output = tk.Frame(root, bg="white", bd=5)
output.grid(row=2, column=1)
scroll = tk.Scrollbar(output)
text = tk.Text(output, height=20, width=100)
scroll.pack(side=tk.RIGHT, fill=tk.Y)
text.pack(side=tk.LEFT, fill=tk.Y)
root.mainloop()