Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
menu.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 
3 # (c) Copyright Rosetta Commons Member Institutions.
4 # (c) This file is part of the Rosetta software suite and is made available under license.
5 # (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
6 # (c) For more information, see http://www.rosettacommons.org. Questions about this can be
7 # (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
8 
9 ## @file /GUIs/pyrosetta_toolkit/window_main/menu.py
10 ## @brief Handles main menu component of the GUI
11 ## @author Jared Adolf-Bryfogle (jadolfbr@gmail.com)
12 
13 #Python Imports
14 import os
15 import webbrowser
16 import time
17 
18 #Tkinter Imports
19 from Tkinter import *
20 import tkSimpleDialog
21 import tkFileDialog
22 import tkMessageBox
23 
24 #Module Imports
25 from app.pyrosetta_toolkit.modules.tools import output as output_tools
26 from app.pyrosetta_toolkit.modules.tools import analysis as analysis_tools
27 from app.pyrosetta_toolkit.modules.tools import general_tools
28 from app.pyrosetta_toolkit.modules.tools import sequence
29 
30 from app.pyrosetta_toolkit.modules import help as help_tools
31 from app.pyrosetta_toolkit.modules.tools import input as input_tools
32 from app.pyrosetta_toolkit.modules import calibur
33 from app.pyrosetta_toolkit.modules.ScoreAnalysis import ScoreAnalysis
34 from app.pyrosetta_toolkit.modules.DesignBreakdown import DesignBreakdown
37 from app.pyrosetta_toolkit.modules.protocols.LowResLoopModelingProtocols import LowResLoopModelingProtocols
38 from app.pyrosetta_toolkit.modules.protocols.HighResLoopModelingProtocols import HighResLoopModelingProtocols
43 
45 
46 
51 
52 import global_variables
53 from app.pyrosetta_toolkit.window_main.IO import SessionIO
54 
55 #### Import of other GUIs in rosetta_source. Nessessary check for eventual inclusion into PyRosetta Binaries.
56 flag_file_builder_import = True
57 try:
58  from rosetta_flag_file_builder.RosettaFlagFileBuilder import RosettaFlagFileBuilder
59 except ImportError:
60  flag_file_builder_import = False
61 ####
62 
63 
64 class Menus():
65  def __init__(self, main, toolkit):
66  """
67  @main: Tk
68  @toolkit: pyrosetta_toolkit
69  """
70  self.main = main
71  self.toolkit = toolkit; #Need to figure out how to tell Python what this 'toolkit' is so IDEs can make sense out of it!
72  self.main_menu=Menu(self.main)
73  self.score_analyzer = ScoreAnalysis(); #Needs to exist as instance due to holding data from load data. Eventually these functions can go into it's own window.
74 
75 
76  def setTk(self):
77  """
78  Sets up the Menu. Order is important here.
79  """
80 
81 
82  self._set_file_menu()
83  self._set_options_menu()
85  self._set_advanced_menu()
86  self._set_protocols_menu()
87  self._set_pdblist_menu()
88  self._set_help_menu()
89 
90  def shoTk(self):
91  """
92  Shows the menu via main.
93  """
94 
95  self.main.config(menu=self.main_menu)
96  def _set_file_menu(self):
97  """
98  Sets import, export, and main File menu
99  """
100 
101  #### Import ####
102  self.import_menu = Menu(self.main_menu, tearoff=0)
103  self.import_menu.add_command(label="GUI Session", command = lambda:SessionIO.SessionIO(self.toolkit).load_session())
104  self.import_menu.add_separator()
105  self.import_menu.add_command(label="Param PathList File", command = lambda: self.toolkit.input_class.load_param_list())
106  self.import_menu.add_command(label="Rosetta Loop File", command = lambda: self.toolkit.input_frame.load_loop())
107  #self.import_menu.add_command(label="Rosetta Resfile", command = lambda: input_tools.load_resfile())
108 
109 
110  #### Export ####
111  self.export_menu = Menu(self.main_menu, tearoff=0)
112  self.export_menu.add_command(label="GUI Session", command = lambda: SessionIO.SessionIO(self.toolkit).save_session())
113  self.export_menu.add_separator()
114  self.export_menu.add_command(label="SCWRL seq File", command=lambda: output_tools.saveSeqFile(self.toolkit.pose, None, self.toolkit.input_class.loops_as_strings))
115  self.export_menu.add_separator()
116  self.export_menu.add_command(label="Rosetta Loop File", command = lambda: output_tools.save_loop_file(self.toolkit.pose, self.toolkit.input_class.regions))
117  self.export_menu.add_command(label="Rosetta Basic ResFile", command = lambda: output_tools.save_basic_resfile(self.toolkit.pose))
118  self.export_menu.add_command(label="Rosetta Basic Blueprint File", command = lambda: output_tools.save_basic_blueprint(self.toolkit.pose))
119  self.export_menu.add_separator()
120  self.export_menu.add_command(label="Param PathList File", command = lambda: output_tools.save_param_path_list(self.toolkit.input_class.param_paths))
121  self.export_menu.add_separator()
122  self.export_menu.add_command(label = "FASTA (Pose)", command=lambda: output_tools.save_FASTA(self.toolkit.pose, self.toolkit.output_class.outname.get(), False ))
123  self.export_menu.add_command(label = "FASTA (Regions)", command = lambda: output_tools.save_FASTA(self.toolkit.pose, self.toolkit.output_class.outname.get(), False, self.toolkit.input_class.regions))
124  #self.export_menu.add_command(label="Save Database")
125  #self.export_menu.add_command(label="Save loops as new PDBs")
126 
127  #### File Menu ####
128  self.file_menu=Menu(self.main_menu, tearoff=0)
129 
130  self.file_menu.add_command(label="Load PDB", command=lambda: self.toolkit.input_class.select_pose_then_launch_fixpdb())
131  self.file_menu.add_command(label="Fetch PDB", command = lambda: self.toolkit.input_class.fetch_pdb())
132  self.file_menu.add_separator()
133  self.file_menu.add_command(label="Reload PDB", command = lambda: self.toolkit.input_class.load_pose(self.toolkit.input_class.pdb_path.get()))
134  self.file_menu.add_separator()
135  self.file_menu.add_cascade(label="Import", menu=self.import_menu)
136  self.file_menu.add_cascade(label="Export", menu=self.export_menu)
137  self.file_menu.add_separator()
138  self.file_menu.add_command(label ="Setup PDB for Rosetta", command=lambda: self.show_fxpdb_window())
139 
140  ## Note: There is no disable for menu items. Which is why we either show the item or not, instead of disabling it.
141  if flag_file_builder_import:
142  self.file_menu.add_command(label= "Rosetta Flag File Builder", command = lambda: self.show_RosettaProtocolBuilder())
143 
144  self.main_menu.add_cascade(label="File", menu=self.file_menu)
145  def _set_options_menu(self):
146  self.options_menu = Menu(self.main_menu, tearoff=0)
147 
148  self.rounds_options_menu=Menu(self.main_menu, tearoff=0)
149 
150  #Could be it's own window in the future.
151  self.rounds_options_menu.add_command(label = "Set processors to use", command = lambda: self.toolkit.output_class.processors.set(tkSimpleDialog.askinteger(title="Processesors", prompt= "Please set the number of processess you wish to create for protocol runs.", initialvalue=self.toolkit.output_class.processors.get())))
152  self.rounds_options_menu.add_checkbutton(label = "Use Boltzmann criterion each round", variable=self.toolkit.output_class.use_boltzmann)
153  self.rounds_options_menu.add_command(label = "Set Temperature", command = lambda: self.toolkit.output_class.set_temperature())
154  self.rounds_options_menu.add_checkbutton(label = "Recover lowest energy from all rounds", variable = self.toolkit.output_class.recover_low)
155  self.options_menu.add_command(label="Configure Option System",command = lambda: self.show_OptionsSystemManager())
156  self.options_menu.add_command(label="Configure Score Function", command =lambda: self.toolkit.score_class.makeWindow(Toplevel(self.main), self.toolkit.pose))
157  self.options_menu.add_cascade(label="Set General Protocol Options", menu = self.rounds_options_menu)
158  self.options_menu.add_separator()
159 
160  self.options_menu.add_checkbutton(label="Set output to terminal", variable = self.toolkit.output_class.terminal_output)
161 
162 
163  self.main_menu.add_cascade(label="Options", menu=self.options_menu)
164 
166  self.vis_menu = Menu(self.main_menu, tearoff=0)
167  self.vis_menu.add_command(label = "Show Pose in PyMOL", command = lambda: self.toolkit.pymol_class.pymover.apply(self.toolkit.pose))
168  #self.vis_menu.add_command(label = "Show current regions")
169  self.vis_menu.add_command(label = "Show current region", command = lambda: self.toolkit.input_frame.color_region_from_entry())
170  self.vis_menu.add_command(label = "Show current residue", command = lambda: self.toolkit.input_frame.color_residue())
171 
172  self.vis_observer_menu = Menu(self.main_menu, tearoff=0)
173  self.vis_observer_menu.add_checkbutton(label="Set Pymol Observer", variable=self.toolkit.pymol_class.auto_send)
174  self.vis_observer_menu.add_separator()
175  self.vis_observer_menu.add_checkbutton(label="Send as new states", variable=self.toolkit.pymol_class.keep_history)
176  self.vis_observer_menu.add_checkbutton(label="Send energies", variable=self.toolkit.pymol_class.send_energies)
177 
178 
179 
180  self.vis_menu.add_separator()
181 
182  self.vis_menu.add_checkbutton(label = "Color current region on addition", variable=self.toolkit.pymol_class.auto_send_region_colors)
183  self.vis_menu.add_checkbutton(label = "Color current residue on selection", variable = self.toolkit.pymol_class.auto_send_residue_colors)
184 
185  self.vis_menu.add_separator()
186  self.vis_menu.add_cascade(label = "PyMol Observer", menu=self.vis_observer_menu)
187  self.vis_menu.add_command(label="Advanced PyMOL Visualization", command=lambda: self.toolkit.pymol_class.makeWindow(0, 0, Toplevel(self.main), self.toolkit.score_class))
188 
189  self.main_menu.add_cascade(label="Visualization", menu=self.vis_menu)
190 
192  """
193  Sets the advanced control menu
194  """
195 
196  self.advanced_menu=Menu(self.main_menu, tearoff=0)
197 
198  ###Analysis###
199  self.analysis_menu = Menu(self.main_menu, tearoff=0)
200 
201  self.analysis_menu.add_command(label = "Interface Analyzer", command=lambda: analysis_tools.analyze_interface(self.toolkit.pose, self.toolkit.score_class.score, self.toolkit))
202  self.analysis_menu.add_command(label = "Packing Analyzer", command = lambda: analysis_tools.analyze_packing(self.toolkit.pose))
203  self.analysis_menu.add_command(label = "Loops Analyzer", command = lambda: analysis_tools.analyze_loops(self.toolkit.pose, self.toolkit.input_class.loops_as_strings))
204  self.analysis_menu.add_command(label = "VIP Analyzer", command = lambda: AnalysisProtocols(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class).analyze_vip())
205  self.analysis_menu.add_separator()
206  self.analysis_menu.add_command(label = "Insert Data into B-Factor", command=lambda:InsertBFactor(self.toolkit.input_class).show_window(self.main))
207  self.advanced_menu.add_cascade(label = "Analysis", menu = self.analysis_menu)
208 
209  ###Design###
210  self.design_menu=Menu(self.main_menu, tearoff=0)
211  self.design_menu.add_command(label="Setup Resfile for PDB", command=lambda: self.show_ResfileDesignWindow())
212  self.design_menu.add_command(label="Setup Blueprint for PDB", foreground='red')
213  #self.design_menu.add_command(label="Structure Editing and Grafting", foreground='red')
214  self.advanced_menu.add_cascade(label = "Design", menu=self.design_menu)
215  self.advanced_menu.add_separator()
216  self.advanced_menu.add_command(label ="Add Constraints", command = lambda: self.toolkit.input_class.constraint_file_paths.append(\
217  input_tools.add_constraints_to_pose_and_scorefunction(self.toolkit.pose, self.toolkit.score_class.score)))
218  #self.advanced_menu.add_command(label ="Enable Symmetry", foreground='red')
219 
220  ###NonStandard###
221  self.non_standard_menu = Menu(self.main_menu, tearoff=0)
222  self.non_standard_menu.add_command(label = "Ligand/NCAA/PTM Manager", command = lambda: self.show_ligand_ncaa_ptm_manager())
223  self.non_standard_menu.add_separator()
224  self.non_standard_menu.add_command(label = "Download Rosetta NCAA Rotamer Library", command=lambda: webbrowser.open("http://carl.bio.nyu.edu/~renfrew/ncaa/"))
225  self.non_standard_menu.add_command(label = "Convert molfile to param files", command = lambda: output_tools.output_molfile_to_params())
226  self.non_standard_menu.add_separator()
227  self.non_standard_menu.add_command(label = "Documentation", command = lambda: webbrowser.open("http://www.pyrosetta.org/obtaining-and-preparing-ligand-pdb-files"))
228 
229  self.advanced_menu.add_cascade(label ="Enable NCAA/PTM/Ligands", menu=self.non_standard_menu)
230  self.advanced_menu.add_separator()
231 
232 
233  self.advanced_menu.add_command(label="Per Residue Control and Analysis", command=lambda: self.show_fullcontrol_window())
234  #self.advanced_menu.add_command(label="Extract PDB from SQLite3 DB", command = lambda: output_tools.extract_pdb_from_sqlite3db())
235  #self.advanced_menu.add_command(label="Interactive Terminal", foreground='red',command = lambda: self.show_IpythonWindow())
236  #self.advanced_menu.add_command(label="Jump into Session", foreground='red', command = lambda: embed())
237  self.main_menu.add_cascade(label = "Advanced", menu = self.advanced_menu)
238 
240  """
241  Menu for running protocols through PyRosetta.
242  """
243 
244  self.protocols_menu = Menu(self.main_menu, tearoff=0)
245 
246  #self.protocols_menu.add_command(label = "Enable MPI Mode", foreground = 'red')
247 
248  self.protocols_menu.add_separator()
249 
250  #Setup Protocol Classes. Should this go to Main File? They are very light weight classes.
251  self.design_class = DesignProtocols(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
252  self.docking_class = DockingProtocols(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
253  self.low_res_loop_modeling_class = LowResLoopModelingProtocols(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
254  self.high_res_loop_modeling_class = HighResLoopModelingProtocols(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
255  self.floppy_tail_class = FloppyTailProtocol(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
256  self.minimize_class = MinimizationProtocols(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
257 
258  #Design
259 
260  self.design_protocols = Menu(self.main_menu, tearoff=0)
261  self.design_protocols.add_command(label = "FixedBB", command = lambda: self.design_class.setupPackDesign(self.main))
262  self.design_protocols.add_command(label = "Grafting", command = lambda:self.show_graftmover_window())
263  #self.design_protocols.add_command(label = "Remodel", foreground='red')
264 
265  #Docking
266 
267  self.docking_protocols = Menu(self.main_menu, tearoff=0)
268  self.docking_protocols.add_command(label = "Low Resolution", command = lambda: self.docking_class.low_res_dock())
269  self.docking_protocols.add_command(label = "High Resolution", command = lambda: self.docking_class.high_res_dock())
270  #self.docking_protocols.add_command(label = "Ligand", foreground='red')
271 
272  #Loop Modeling
273 
274  self.loop_modeling_protocols=Menu(self.main_menu, tearoff=0)
275  self.loop_modeling_protocols_low = Menu(self.main_menu,tearoff=0)
276  self.loop_modeling_protocols_low.add_command(label = "CCD", command = lambda: self.low_res_loop_modeling_class.default_CCD())
277  self.loop_modeling_protocols_low.add_command(label = "KIC", command = lambda: self.low_res_loop_modeling_class.default_KIC())
278  self.loop_modeling_protocols_high = Menu(self.main_menu, tearoff=0)
279  self.loop_modeling_protocols_high.add_command(label = "CCD", command = lambda: self.high_res_loop_modeling_class.default_CCD())
280  self.loop_modeling_protocols_high.add_command(label = "KIC", command = lambda: self.high_res_loop_modeling_class.default_KIC())
281  self.loop_modeling_protocols.add_cascade(label = "Low Resolution", menu = self.loop_modeling_protocols_low)
282  self.loop_modeling_protocols.add_cascade(label = "High Resolution", menu = self.loop_modeling_protocols_high)
283 
284  #Minimization. Just so it's here too.
285  self.minimization_protocols = Menu(self.main_menu, tearoff=0)
286  self.minimization_protocols.add_command(label = "RePack Region Rotamers", command = lambda:self.minimize_class.optimize_rotamers())
287  self.minimization_protocols.add_command(label = "RePack Region Rotamers (SCWRL)", command = lambda:self.minimize_class.SCWRL())
288  self.minimization_protocols.add_separator()
289  self.minimization_protocols.add_command(label = "Minimize Backbone+Sidechains", command = lambda:self.minimize_class.minimize())
290  self.minimization_protocols.add_command(label = "Minimize Backbone only", command = lambda:self.minimize_class.minimize(False, False, True))
291  self.minimization_protocols.add_command(label = "Minimize Sidechains only", command = lambda:self.minimize_class.minimize(False, False, False, True))
292  self.minimization_protocols.add_separator()
293  self.minimization_protocols.add_command(label = "FastRelax Backbone+Sidechains", command = lambda:self.minimize_class.relax(1))
294  self.minimization_protocols.add_command(label = "FastRelax Backbone only", command = lambda:self.minimize_class.relax(1, False, True))
295  self.minimization_protocols.add_command(label = "FastRelax Sidechains only", command = lambda:self.minimize_class.relax(1, False, False, True))
296  self.minimization_protocols.add_separator()
297  self.minimization_protocols.add_command(label = "ClassicRelax Backbone+Sidechains", command = lambda:self.minimize_class.relax(0))
298  self.minimization_protocols.add_command(label = "ClassicRelax Backbone only", command = lambda:self.minimize_class.relax(0, False, True))
299  self.minimization_protocols.add_command(label = "ClassicRelax Sidechains only", command = lambda:self.minimize_class.relax(0, False, False, True))
300 
301  #General Modeling (Homology/Abinitio)
302  self.general_protocols = Menu(self.main_menu, tearoff=0)
303  self.servers = Menu(self.main_menu, tearoff = 0); #Because why not?
304 
305  #Servers. Because there are tons of work in these, and I can't add everything.
306  self.servers.add_command(label = "ROSIE Servers", command = lambda: webbrowser.open("http://rosie.rosettacommons.org/"))
307  self.servers.add_separator()
308  self.servers.add_command(label = "Backrub", command = lambda: webbrowser.open("https://kortemmelab.ucsf.edu/backrub/cgi-bin/rosettaweb.py?query=submit"))
309  self.servers.add_command(label = "Fragments", command = lambda: webbrowser.open("http://robetta.bakerlab.org/fragmentsubmit.jsp"))
310  self.servers.add_command(label = "Interface Alanine Scan", command = lambda: webbrowser.open("http://robetta.bakerlab.org/alascansubmit.jsp"))
311  self.servers.add_command(label = "DNA Interface Scan", command = lambda: webbrowser.open("http://robetta.bakerlab.org/dnainterfacescansubmit.jsp"))
312  self.servers.add_command(label = "Scaffold Select", command = lambda: webbrowser.open("http://rosettadesign.med.unc.edu/scaffold/"))
313  self.rna_protocols = Menu(self.main_menu, tearoff=0)
314 
315  self.dna_protocols = Menu(self.main_menu, tearoff=0)
316 
317  self.general_protocols.add_cascade(label = "Web Servers", menu = self.servers)
318  self.general_protocols.add_separator()
319  #self.general_protocols.add_cascade(label = "RNA", menu = self.rna_protocols)
320  #self.general_protocols.add_cascade(label = "DNA", menu = self.dna_protocols)
321  self.general_protocols.add_command(label = "FloppyTail", command=lambda: self.floppy_tail_class.setup_protocol(self.main))
322  #self.general_protocols.add_command(label = "Ab Initio", foreground='red')
323  #self.general_protocols.add_command(label = "Homology Modeling", foreground='red')
324  self.protocols_menu.add_cascade(label = "General", menu = self.general_protocols)
325  self.protocols_menu.add_separator()
326 
327  self.protocols_menu.add_cascade(label = "Loop Modeling", menu = self.loop_modeling_protocols)
328  self.protocols_menu.add_cascade(label = "Docking", menu = self.docking_protocols)
329  self.protocols_menu.add_cascade(label = "Design", menu = self.design_protocols)
330  #self.protocols_menu.add_separator()
331  self.protocols_menu.add_cascade(label = "Minimization", menu=self.minimization_protocols)
332 
333  self.main_menu.add_cascade(label = "Protocols", menu=self.protocols_menu)
334 
335  def _set_pdblist_menu(self):
336  """
337  Sets a Menu for interacting with a simple PDBList. Useful since Rosetta is pretty much all about thousands of models.
338  """
339 
340  self.pdblist_tools_menu = Menu(self.main_menu, tearoff=0)
341  #There are scripts in RosettaTools that do this welll...
342  self.pdblist_tools_menu.add_command(label = "Load PDBList", command=lambda: self.toolkit.input_class.set_PDBLIST())
343  self.pdblist_tools_menu.add_command(label = "Create PDBList + Load", command = lambda: self.toolkit.input_class.PDBLIST.set(output_tools.make_PDBLIST()))
344  self.pdblist_tools_menu.add_command(label = "Create PDBList Recursively + Load", command = lambda: self.toolkit.input_class.PDBLIST.set(output_tools.make_PDBLIST_recursively()))
345  self.pdblist_tools_menu.add_separator()
346  self.score_menu = Menu(self.main_menu, tearoff=0)
347  self.score_menu.add_command(label = "Rescore PDBList + Output ScoredPDBList + Load", command = lambda: self.score_analyzer.set_filepath(output_tools.score_PDBLIST(self.toolkit.input_class.PDBLIST.get(), self.toolkit.score_class.score, self.toolkit.output_class.processors.get(), self.toolkit.output_class)))
348  self.score_menu.add_command(label = "Load Scores (.sc, .fasc, or ScoredPDBList)", command = lambda: self.load_scores_for_score_analysis())
349  self.score_menu.add_separator()
350  self.score_menu.add_command(label = "Get top model", command = lambda: self.score_analyzer.get_top_scoring())
351  self.score_menu.add_command(label = "Get top % models", command = lambda: self.score_analyzer.get_top_scoring_by_percent())
352  self.score_menu.add_command(label = "Get top # models", command = lambda: self.score_analyzer.get_top_scoring_by_number())
353  self.score_menu.add_separator()
354  self.score_menu.add_command(label = "Energy vs RMSD", command=lambda:self.score_analyzer.get_score_vs_rmsd(self.toolkit.pose, self.toolkit.input_class.loops_as_strings))
355  self.score_menu.add_separator()
356 
357  #self.plot_menu = Menu(self.main_menu, tearoff=0)
358  #self.plot_menu.add_command(label = "Plot Score KDE", command = lambda:self.score_analyzer.plot_score_kde(), foreground='red')
359  #self.plot_menu.add_command(label = "Plot Score vs RMSD", command = lambda: self.score_analyzer.plot_score_vs_rmsd(), foreground='red')
360  #self.plot_menu.add_command(label = "Plot Score vs RMSD KDE", command = lambda: self.score_analyzer.plot_score_vs_rmsd_KDE(), foreground='red')
361  #self.score_menu.add_cascade(label = "R Plots", menu = self.plot_menu)
362 
363  self.pdblist_tools_menu.add_cascade(label = "Score Analysis", menu=self.score_menu)
364 
365  self.sequence_menu = Menu(self.main_menu, tearoff=0)
366  self.sequence_menu.add_command(label = "Output FASTA for Each PDB", command = lambda: output_tools.save_FASTA_PDBLIST(self.toolkit.input_class.PDBLIST.get(), False))
367  self.sequence_menu.add_command(label = "Output FASTA for Each Region", command = lambda: output_tools.save_FASTA_PDBLIST(self.toolkit.input_class.PDBLIST.get(), False, self.toolkit.input_class.regions))
368  #If you need this, you know how to program: self.sequence_menu.add_command(label = "Output LOOP file for each PDB", command = lambda: output_tools.save_LOOP_PDBLIST(self.toolkit.input_class.PDBLIST.get()))
369  self.sequence_menu.add_command(label = "Use FASTA for design statistics", command = lambda: self.run_design_breakdown())
370  self.pdblist_tools_menu.add_cascade(label = "Sequence Analysis", menu=self.sequence_menu)
371  self.pdblist_tools_menu.add_separator()
372 
373  #self.pdblist_tools_menu.add_command(label = "Cluster PDBList using Calibur", foreground='red')
374  #self.pdblist_tools_menu.add_command(label = "Convert PDBList to SQLite3 DB", command = lambda: output_tools.convert_PDBLIST_to_sqlite3db(self.toolkit.input_class.PDBLIST.get()))
375  #self.pdblist_tools_menu.add_command(label = "Extract PDBList from SQLite3 DB", command = lambda: output_tools.extract_pdbs_from_sqlite3db(self.toolkit.input_class.PDBLIST.get()))
376  #self.pdblist_tools_menu.add_separator()
377  self.pdblist_tools_menu.add_command(label = "Rename All PDBs Recursively + Copy to Outpath", command = lambda: output_tools.rename_and_save(self.toolkit.input_class.PDBLIST.get()))
378 
379  self.main_menu.add_cascade(label = "PDBLists", menu=self.pdblist_tools_menu)
380 
381  def _set_help_menu(self):
382  """
383  Sets the help Menu. TK kinda sucks for formating dialog windows. Just FYI.
384  """
385 
386  self.help_menu=Menu(self.main_menu, tearoff=0)
387  self.help_menu.add_command(label="About", command=lambda: help_tools.about())
388  self.help_menu.add_command(label = "License", command = lambda: help_tools.show_license())
389  self.help_menu.add_separator()
390  self.help_menu.add_command(label = "Region Selection", command = lambda: help_tools.region_selection())
391  self.help_menu.add_command(label = "PyMOL Setup", command = lambda:webbrowser.open("http://www.pyrosetta.org/pymol_mover-tutorial"))
392  self.help_menu.add_separator()
393  self.help_menu.add_command(label="Rosetta Manual", command = lambda: webbrowser.open("http://www.rosettacommons.org/manual_guide"))
394  self.help_menu.add_command(label="Rosetta Glossary", command=lambda: help_tools.print_glossary())
395  self.help_menu.add_command(label="Rosetta Forums", command = lambda: webbrowser.open("http://www.rosettacommons.org/forum"))
396  self.help_menu.add_command(label="Rosetta BugTracker", command = lambda: webbrowser.open("http://bugs.rosettacommons.org"))
397  self.help_menu.add_separator()
398  self.help_menu.add_command(label="PyRosetta Tutorials", command = lambda: webbrowser.open("http://www.pyrosetta.org/tutorials"))
399  self.help_devel_menu = Menu(self.main_menu, tearoff=0)
400  self.help_devel_menu.add_command(label = "Wiki Page", command = lambda: webbrowser.open("https://wiki.rosettacommons.org/index.php/PyRosetta_Toolkit"))
401  self.help_menu.add_cascade(label = "Developers: ", menu = self.help_devel_menu)
402  self.help_desmut_menu =Menu(self.main_menu, tearoff=0)
403  self.help_desmut_menu.add_command(label= "Accessible Surface Area", command=lambda: help_tools.mutSA())
404  self.help_desmut_menu.add_command(label = "Relative Mutability", command=lambda: help_tools.mutRM())
405  self.help_desmut_menu.add_command(label = "Surface Probability", command=lambda: help_tools.mutSP())
406  self.help_menu.add_cascade(label="Mutability Data", menu=self.help_desmut_menu)
407  self.help_menu.add_separator()
408  self.help_menu_scwrl = Menu(self.main_menu, tearoff=0)
409  self.help_menu_scwrl.add_command(label = "Download", command = lambda: webbrowser.open("http://dunbrack.fccc.edu/scwrl4/SCWRL4.php"))
410  self.help_menu_scwrl.add_command(label = "Install", command = lambda: webbrowser.open("http://dunbrack.fccc.edu/scwrl4/SCWRL4.php#installation"))
411  self.help_menu_scwrl.add_command(label = "GUI Install", command = lambda: help_tools.scwrl())
412  self.help_menu.add_cascade(label = "SCWRL", menu=self.help_menu_scwrl)
413  self.main_menu.add_cascade(label="Help", menu=self.help_menu)
414 
415 
416 ##### MENU FUNCTIONS #######
417 
419  filename = tkFileDialog.askopenfilename(title="Open ScoredPDBList, .fasc, or .sc file", initialdir=global_variables.current_directory)
420  if not filename:return
421  global_variables.current_directory = os.path.dirname(filename)
422  self.score_analyzer.set_filepath(filename)
423 
424  #These are bullshit.
425  def get_path(self, string):
426  path = tkFileDialog.askopenfilename(title=string,initialdir = global_variables.current_directory)
427  return path
428 
430 
431  #Super huge bug in Tkinter, which is not allowing multiple dialog boxes to be called in succession. ~jadolfbr
432  #Jan 2013 MacBookPro~2010 OS 10.6, Python 2.6.
433 
434  if self.toolkit.pose.total_residue()==0:
435  print "Please load a pose for reference."
436  return
437 
438  fasta_path = self.get_path("FASTA Path")
439  if not fasta_path:return
440  global_variables.current_directory = os.path.dirname(fasta_path)
441  outpath = os.path.dirname(fasta_path)+"/RESULTS"
442 
443 
444 
445  #else:
446  #answer = tkMessageBox.askokcancel(title = "Current", message = "Using current pose as reference. Continue?")
447  #if not answer: return
448  reference_path=self.toolkit.input_class.pdb_path.get()
449  if not reference_path:return
450  #native = tkMessageBox.askyesno(title="Native", message="Use pose as Native?")
451 
452  breakdown = DesignBreakdown(fasta_path, reference_path, outpath)
453  breakdown.run_outputs()
454 
455 #### WINDOWS ##### (ADD NEW WINDOWS TO THIS THAT NEED TO BE SET UP) #######
457  self.fullcontrol_class = FullControlWindow(self.toolkit.score_class, self.toolkit.pose, self.toolkit.input_class, self.toolkit.output_class);
458  self.fullcontrol_class.show_window(self.main, 0, 0)
459 
461  grafter = GraftMoverWindow(self.toolkit.pose, self.toolkit.score_class, self.toolkit.input_class, self.toolkit.output_class)
462  top_level_tk = Toplevel(self.main)
463  grafter.setTk(top_level_tk)
464  grafter.shoTk(0,0)
465 
466  def show_fxpdb_window(self):
467  cleaner = FixPDBWindow(self.toolkit.input_class, self.toolkit.score_class, self.toolkit.pose)
468  cleaner.runfixPDBWindow(self.main, 0, 0)
469 
471  top_level_tk = Toplevel(self.main)
472  ptm = ligand_ncaa_ptm_manager(self.toolkit.input_class, self.toolkit.score_class, self.toolkit.pose)
473  ptm.setTk(top_level_tk)
474  ptm.shoTk(0, 0)
475 
477  """
478  Main Design window interacting with options system
479  """
480 
481  top_level_tk = Toplevel(self.main)
482  self.toolkit.input_class.options_manager.setTk(top_level_tk)
483  self.toolkit.input_class.options_manager.shoTk()
484 
486  """
487  Main Design window for creating a ResFile
488  """
489 
490  top_level_tk = Toplevel(self.main)
491  resfile_design_window = ResfileDesignWindow(top_level_tk, self.toolkit.DesignDic, self.toolkit.pose)
492  resfile_design_window.setTk()
493  resfile_design_window.shoTk()
494  resfile_design_window.setTypes()
495 
497  """
498  Rosetta Protocols - Used to make commands from lists of possible options.
499  """
500 
501  top_level_tk = Toplevel(self.main)
502  rosetta_protocol_builder = RosettaFlagFileBuilder(top_level_tk)
503  if not rosetta_protocol_builder.result:return
504  rosetta_protocol_builder.setTk()
505  rosetta_protocol_builder.shoTk(0, 0)
506  rosetta_protocol_builder.setMenu(top_level_tk)
507 
509  """
510  IPython Interactive Window. Isolated from variables for now.
511  """
512  term = IPythonView(Toplevel(self.main))
513  term.pack()
def load_scores_for_score_analysis
MENU FUNCTIONS #######.
Definition: menu.py:418
def show_fullcontrol_window
WINDOWS ##### (ADD NEW WINDOWS TO THIS THAT NEED TO BE SET UP) #######.
Definition: menu.py:456