def dope_from_main_menu(self):
"""
Called when users decide calculate DOPE of a structure loaded in PyMod.
"""
# Checks if the DOPE profiles can be computed.
selection = self.get_selected_sequences()
if not self.modeller.can_be_launched():
self.show_error_message("MODELLER Error", "MODELLER is missing. In order to compute DOPE scores of a structure, MODELLER has to be installed.")
return False
if len(selection) == 0:
self.show_error_message("Selection Error", "Please select at least one structure to assess.")
return False
if not self.all_sequences_have_structure():
self.show_error_message("Selection Error", "Please select only elements that have a 3D structure currently loaded in PyMOL.")
return False
if len(set([seq.mother_index for seq in selection])) != 1:
self.show_error_message("Selection Error", "You can assess multiple structures DOPE only if they are aligned in the same cluster.")
return False
# Ask users if they would like to color the sequences according to their DOPE values.
title = "Color Option"
message = "Would you like to color the selected sequences by their DOPE values, once they have been calculated?"
color_by_dope_choice = tkMessageBox.askyesno(message=message, title=title, parent=pymod.main_window)
# Initializes MODELLER.
if self.modeller.run_internally():
env = modeller.environ()
env.io.atom_files_directory = []
env.io.atom_files_directory.append(".")
env.io.hetatm = True
env.io.water = True
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')
else:
env = None
# Actually computes the DOPE scores of the polypeptide chains in the user selection.
for element in selection:
self.compute_dope(element,env=env)
# Assigns to each residue of the selected chains a correspoding color according to its DOPE.
self.assign_dope_items(selection)
# Color the elements.
if color_by_dope_choice:
for element in selection:
element.color_element_by_dope()
self.gridder()
# Shows the DOPE profiles plot.
dope_graph_mode = None
if len(selection) == 1:
dope_graph_mode = "single"
elif len(selection) >= 2:
dope_graph_mode = "multiple"
# Prepares the data to show in the plot.
dope_plot_data = self.prepare_dope_plot_data(selection, mode = dope_graph_mode)
# Shows the plot.
self.show_dope_plot(dope_plot_data)
评论列表
文章目录