31 self.main.title(
"Design Toolbox")
82 InterfacePhoto =PhotoImage(file = (self.
pwd+
"/Media/InterfaceDesignSmall.gif"))
84 self.Photo.image = InterfacePhoto
88 self.label_Chain.grid(row=2, column=0)
89 self.listbox_restypes.grid(row=0, column=4, rowspan=10)
90 self.listbox_residues.grid(row=0, column=5, rowspan=10)
92 self.label_Res.grid(row=1, column=0)
93 self.shoRes.grid(row=0, column=1)
94 self.entry_residue.grid(row=1, column=1)
95 self.button_check_residue.grid(row=3, column=1)
96 self.button_previous_residue.grid(row=3, column=0)
97 self.button_next_residue.grid(row=3, column=2)
98 self.listbox_current_designs.grid(row=12, column=4, rowspan=10)
99 self.entry_chain.grid(row=2, column=1)
100 self.button_save_resfile.grid(row=12, column=5, sticky=W+E)
102 self.button_clear_resfile.grid(row=14, column=5, sticky=W+E)
104 self.label_accessible_SA.grid(row=4, column=0); self.active_label_current_accessible_sa.grid(row=6, column=0); self.active_label_design_accessible_sa.grid(row=5, column=0)
105 self.label_relative_mutability.grid(row=4, column=1); self.active_label_current_relative_mutability.grid(row=6, column=1); self.active_label_design_relative_mutability.grid(row=5, column=1)
106 self.label_surface_probability.grid(row=4, column=2); self.active_label_current_surface_probability.grid(row=6, column=2); self.active_label_design_surface_probability.grid(row=5, column=2)
113 self.Photo.grid(row =12, column = 6, rowspan=5)
114 self.main.grid_columnconfigure(ALL, weight=1)
121 What happens when you click check residue. Should be a callback, but need both res and chain specified before update.
127 self.listbox_current_designs.delete(0, END)
131 self.listbox_restypes.delete(9)
132 self.listbox_restypes.insert(9,
"Conserved")
136 if not self.pose.total_residue():
139 resType = self.pose.pdb_info().pdb2pose(self.current_chain.get(),
int(self.current_residue.get()))
141 resName = self.pose.residue(resType).
name()
142 except PyRosettaException:
143 print "Residue does not exist in PDB..."
147 self.current_residue_name_full.set(resName)
148 three_letter_name = resName.split(
"_")[0];
149 self.current_residue_name.set(resName)
153 self.design_accessible_sa.set(self.residue_definitions.resinfo[three_letter_name][0])
154 self.design_relative_mutability.set(self.residue_definitions.resinfo[three_letter_name][1])
155 self.design_surface_probability.set(self.residue_definitions.resinfo[three_letter_name][2])
157 print "No Data for restype"
158 self.design_accessible_sa.set(
"")
159 self.design_relative_mutability.set(
"")
160 self.design_surface_probability.set(
"")
162 con =
"Conserved:" +three_letter_name
163 self.listbox_restypes.delete(9)
164 self.listbox_restypes.insert(9, con)
165 if self.DesignDic.has_key(res):
167 self.listbox_current_designs.insert(END, residues)
171 What happens when you click a design type (conserved, polar, etc.)
178 ListTypesFull.delete(0, END)
179 type = ListTypes.get(ListTypes.curselection())
180 self.TypeCurSelection.set(type)
181 ListTypesFull.insert(END,
"All")
182 ListTypesFull.insert(END,
"All+Self")
184 for res
in self.residue_definitions.restype_info[type]:
185 ListTypesFull.insert(END, res)
191 What happens when you add a residue type to the design. Updates other listboxes, etc.
200 if (ListTypesFull.get(ListTypesFull.curselection()))==
"All":
201 for ResType
in self.residue_definitions.restype_info[self.TypeCurSelection.get()]:
203 for i
in range(ResStart, ResEnd+1):
204 res = repr(i) +
":"+self.current_chain.get()
205 if self.DesignDic.has_key(res):
209 if (ListTypesFull.get(ListTypesFull.curselection()))==
"All+Self":
210 start = self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResStart)
211 end = self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResEnd)
212 for ResType
in self.residue_definitions.restype_info[self.TypeCurSelection.get()]:
213 for i
in range(ResStart, ResEnd+1):
214 res = repr(i) +
":"+self.current_chain.get()
215 if self.DesignDic.has_key(res):
220 resType = self.pose.pdb_info().pdb2pose(self.current_chain.get(), i)
222 resType = self.pose.residue(resType).
name()
223 resType = resType.split(
"_")[0];
224 for y
in self.residue_definitions.restype_info[
"All"]:
228 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"NATRO":
229 for i
in range(ResStart, ResEnd+1):
230 res = repr(i) +
":"+self.current_chain.get()
232 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"NATAA":
233 for i
in range(ResStart, ResEnd+1):
234 res = repr(i) +
":"+self.current_chain.get()
237 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"ALLAA":
238 for i
in range(ResStart, ResEnd+1):
239 res = repr(i) +
":"+self.current_chain.get()
241 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"All Conserved Mutations":
242 start = self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResStart)
243 end = self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResEnd)
244 print repr(start);
print repr(end)
245 for i
in range(start, end+1):
248 resType = self.pose.residue(resType).
name()
249 resType = resType.split(
"_")[0];
250 resType =
"Conserved:"+resType
251 res = self.pose.pdb_info().pose2pdb(i).
split()[0]+
":"+self.current_chain.get()
252 for types
in self.residue_definitions.restype_info[resType]:
253 if self.DesignDic.has_key(res):
257 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"All Conserved Mutations+Self":
259 start = self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResStart)
260 end = self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResEnd)
261 for i
in range(start, end+1):
263 resType = self.pose.residue(resType).
name()
264 resType = resType.split(
"_")[0];
265 res = self.pose.pdb_info().pose2pdb(i).
split()[0]+
":"+self.current_chain.get()
266 resType =
"Conserved:"+resType
267 for types
in self.residue_definitions.restype_info[resType]:
268 if self.DesignDic.has_key(res):
273 resTypei = self.pose.residue(i).
name()
274 for y
in self.residue_definitions.restype_info[
"All"]:
279 ResType= ListTypesFull.get(ListTypesFull.curselection())
280 for i
in range(ResStart, ResEnd+1):
281 res = repr(i) +
":"+ self.current_chain.get()
282 if self.DesignDic.has_key(res):
287 check_button_ckList.delete(0, END)
288 res = repr(ResStart) +
":" + self.current_chain.get()
290 check_button_ckList.insert(END, residues)
292 resType = self.pose.pdb_info().pdb2pose(self.current_chain.get(),
int(self.current_residue.get()))
293 res = self.pose.residue(resType).
name()
295 self.current_residue_name_full.set(res)
296 res= res.split(
"_")[0];
297 self.current_residue_name.set(res)
299 self.design_accessible_sa.set(self.residue_definitions.resinfo[self.pose.residue(resType).
name()][0])
300 self.design_relative_mutability.set(self.residue_definitions.resinfo[self.pose.residue(resType).
name()][1])
301 self.design_surface_probability.set(self.residue_definitions.resinfo[self.pose.residue(resType).
name()][2])
304 res = self.current_residue.get() +
":" + self.current_chain.get()
305 if (ListTypesFull.get(ListTypesFull.curselection()))==
"All":
306 for ResType
in self.residue_definitions.restype_info[self.TypeCurSelection.get()]:
307 if self.DesignDic.has_key(res):
311 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"All+Self":
312 for ResType
in self.residue_definitions.restype_info[self.TypeCurSelection.get()]:
313 if self.DesignDic.has_key(res):
317 for y
in self.residue_definitions.restype_info[
"All"]:
319 if self.current_residue_name.get() == z[1]:
322 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"NATRO":
324 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"NATAA":
327 elif (ListTypesFull.get(ListTypesFull.curselection()))==
"ALLAA":
330 ResType= ListTypesFull.get(ListTypesFull.curselection())
331 if self.DesignDic.has_key(res):
336 check_button_ckList.delete(0, END)
338 check_button_ckList.insert(END, residues)
342 What happens when you double click the bottom listbox to remove a residue.
348 for i
in range(ResStart, ResEnd +1):
349 res = repr(i) +
":" +self.current_chain.get()
350 self.
DesignDic[res].remove(check_button_ckList.get(check_button_ckList.curselection()))
351 check_button_ckList.delete(0, END)
352 res = repr(ResStart) +
":" +self.current_chain.get()
354 check_button_ckList.insert(END, residues)
356 res = self.current_residue.get() +
":" + self.current_chain.get()
357 self.
DesignDic[res].remove(check_button_ckList.get(check_button_ckList.curselection()))
358 check_button_ckList.delete(0, END)
360 check_button_ckList.insert(END, residues)
364 Checks to make sure residue/residues exist before adding to the residue checkbox.
365 Returns False if something is wrong.
367 if not self.pose.total_residue():
368 print "No pose Loaded."
371 if not self.current_chain.get()
or not self.current_residue.get():
372 print "Chain or residue not set"
375 current_region = self.current_residue.get().
split(
":")
376 if len(current_region)>1:
377 ResStart =
int(current_region[0]); ResEnd =
int(self.current_region[1])
380 if self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResStart)==0
or self.pose.pdb_info().pdb2pose(self.current_chain.get(), ResEnd)==0:
381 print "Region not found in pose"
384 if self.pose.pdb_info().pdb2pose(self.current_chain.get(),
int(self.current_residue.get())) ==0:
386 print "Residue not found in pose"
393 Restype = ListTypesFull.get(ListTypesFull.curselection())
394 typefull = Restype.split(
":")
398 self.current_accessible_sa.set(self.residue_definitions.resinfo[typefull[1]][0])
399 self.current_relative_mutability.set(self.residue_definitions.resinfo[typefull[1]][1])
400 self.current_surface_probability.set(self.residue_definitions.resinfo[typefull[1]][2])
406 Update functions when residue is +1
411 res =
int(self.current_residue.get())+1
412 self.current_residue.set(res)
415 print "Please Change selection to get info..."
419 Update functions when residue is -1
424 res =
int(self.current_residue.get())-1
425 self.current_residue.set(res)
428 print "Please Change selection to get info..."
431 for type
in self.residue_definitions.restypes:
432 self.listbox_restypes.insert(END, type)
435 self.DesignDic.clear()
437 print "Design Data Cleared..."
446 out = tkFileDialog.asksaveasfilename(initialdir = global_variables.current_directory, title =
"Save As...")
448 output_tools.save_resfile_w_designdic(self.pose, self.DesignDic, out)
449 outSP = out.split(
"/")
451 folder = outSP[length-2]
452 if folder ==
"FragSets_Designs":
453 prot.LisProt1Frag.insert(END, outSP[length-1])
457 Allows the script to be self-aware of it's path.
458 So that it can be imported/ran from anywhere.
461 p = os.path.abspath(__file__)
462 pathSP = os.path.split(p)
Fstring::size_type len(Fstring const &s)
Length.
utility::vector1< std::string > split(const std::string &s)
split given std::string using ' ' symbol.
rule< Scanner, string_closure::context_t > name