Author: bugman Date: Wed May 14 18:48:46 2014 New Revision: 23173 URL: http://svn.gna.org/viewcvs/relax?rev=23173&view=rev Log: Created the new pymol.frame_order user function. This user function pairs with the frame_order.pdb_model user function, taking the three PDB files created and displaying them nicely. Neither user function is complete, however the rotor representation of certain frame order models is handled correctly. Modified: trunk/pipe_control/pymol_control.py trunk/user_functions/pymol_control.py Modified: trunk/pipe_control/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/pymol_control.py?rev=23173&r1=23172&r2=23173&view=diff ============================================================================== --- trunk/pipe_control/pymol_control.py (original) +++ trunk/pipe_control/pymol_control.py Wed May 14 18:48:46 2014 @@ -358,6 +358,97 @@ return commands +def frame_order(ave_pos_file="ave_pos.pdb", rep_file="frame_order.pdb", dist_file="domain_distribution.pdb", dir=None): + """Display the frame order results (the geometric object, average position and distribution). + + @keyword ave_pos_file: The name of the file for the average molecule structure. + @type ave_pos_file: str + @keyword rep_file: The name of the file of the PDB representation of the frame order dynamics to create. + @type rep_file: str + @keyword dist_file: The name of the file which will contain multiple models spanning the full dynamics distribution of the frame order model. + @type dist_file: str + @keyword dir: The name of the directory to place the PDB file into. + @type dir: str + """ + + # The path. + path = '' + if dir != None: + path = dir + sep + + # Set up the respective objects. + frame_order_ave_pos(file=path+ave_pos_file) + frame_order_geometric(file=path+rep_file) + frame_order_distribution(file=path+dist_file) + + +def frame_order_ave_pos(file=None): + """Display the PDB structure for the frame order average domain position. + + @keyword file: The name of the PDB file containing the frame order average structure. + @type file: str + """ + + # Read in the PDB file. + pymol_obj.exec_cmd("load " + file) + + # The object ID. + id = file_root(file) + + +def frame_order_distribution(file=None): + """Display the PDB structure for the frame order distribution of domain positions. + + @keyword file: The name of the PDB file containing the frame order distribution of domain positions. + @type file: str + """ + + # Read in the PDB file. + pymol_obj.exec_cmd("load " + file) + + + +def frame_order_geometric(file=None): + """Display the frame order geometric object. + + @keyword file: The name of the PDB file containing the frame order geometric object. + @type file: str + """ + + # Read in the PDB file. + pymol_obj.exec_cmd("load " + file) + + # The object ID. + id = file_root(file) + + + # Rotor objects. + ################ + + # Shorten the stick width from 0.25 to 0.15. + pymol_obj.exec_cmd("set stick_radius,0.15000") + + # Set up the rotor axis (the residues AX and PRC). + pymol_obj.exec_cmd("select (resn AX,PRC)") + pymol_obj.exec_cmd("show stick, 'sele'") + pymol_obj.exec_cmd("color red, 'sele'") + pymol_obj.exec_cmd("cmd.delete('sele')") + + # Display the central point. + pymol_obj.exec_cmd("select (name CTR)") + pymol_obj.exec_cmd("show spheres, 'sele'") + pymol_obj.exec_cmd("color red, 'sele'") + pymol_obj.exec_cmd("set sphere_scale, 0.3, 'sele'") + pymol_obj.exec_cmd("cmd.delete('sele')") + + # Set up the propellers. + pymol_obj.exec_cmd("select (resn PRB)") + pymol_obj.exec_cmd("show stick, 'sele'") + pymol_obj.exec_cmd("cmd.delete('sele')") + + + + def macro_apply(data_type=None, style="classic", colour_start_name=None, colour_start_rgb=None, colour_end_name=None, colour_end_rgb=None, colour_list=None): """Execute a PyMOL macro. Modified: trunk/user_functions/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/pymol_control.py?rev=23173&r1=23172&r2=23173&view=diff ============================================================================== --- trunk/user_functions/pymol_control.py (original) +++ trunk/user_functions/pymol_control.py Wed May 14 18:48:46 2014 @@ -123,7 +123,7 @@ ) # Description. uf.desc.append(Desc_container()) -uf.desc[-1].add_paragraph("The PDB file containing the geometric object must be created using the complementary frame_order.cone_pdb or n_state_model.cone_pdb user functions.") +uf.desc[-1].add_paragraph("The PDB file containing the geometric object must be created using the complementary n_state_model.cone_pdb user function.") uf.desc[-1].add_paragraph("The cone PDB file is read in using the command:") uf.desc[-1].add_list_element("load file") uf.desc[-1].add_paragraph("The average CoM-pivot point vector, the residue 'AVE' is displayed using the commands:") @@ -139,6 +139,59 @@ uf.menu_text = "cone_&pdb" uf.wizard_height_desc = 500 uf.wizard_size = (900, 700) +uf.wizard_apply_button = False +uf.wizard_image = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png' + + +# The pymol.frame_order user function. +uf = uf_info.add_uf('pymol.frame_order') +uf.title = "Display the frame order results from the frame_order.pdb_model user function." +uf.title_short = "Frame order results display." +uf.add_keyarg( + name = "ave_pos_file", + default = "ave_pos.pdb", + py_type = "str", + arg_type = "file sel", + desc_short = "average structure file name", + desc = "The name of the 3D structure PDB file for the molecular structure with the moving domains shifted to the average position.", + wiz_filesel_wildcard = "PDB files (*.pdb)|*.pdb;*.PDB", + wiz_filesel_style = FD_OPEN +) +uf.add_keyarg( + name = "rep_file", + default = "frame_order.pdb", + py_type = "str", + arg_type = "file sel", + desc_short = "PDB representation file name", + desc = "The name of the PDB file for the geometric object representation of the frame order dynamics.", + wiz_filesel_wildcard = "PDB files (*.pdb)|*.pdb;*.PDB", + wiz_filesel_style = FD_OPEN +) +uf.add_keyarg( + name = "dist_file", + default = "domain_distribution.pdb", + py_type = "str", + arg_type = "file sel", + desc_short = "distribution file name", + desc = "The name of the file which will contain multiple models spanning the full dynamics distribution of the frame order model.", + wiz_filesel_wildcard = "PDB files (*.pdb)|*.pdb;*.PDB", + wiz_filesel_style = FD_OPEN +) +uf.add_keyarg( + name = "dir", + py_type = "str", + arg_type = "dir", + desc_short = "directory name", + desc = "The directory where the file is to be located.", + can_be_none = True +) +# Description. +uf.desc.append(Desc_container()) +uf.desc[-1].add_paragraph("This user function is designed to be combined with the frame_order.pdb_model user function. It will take the three PDB files created by frame_order.pdb_model - the molecular structure with the averaged domain positions, the frame order dynamics representation file, and the moving domain distribution file - and display them in PyMOL. Rather than loading the three files into PyMOL manually, this user function will change the representation to significantly improve the visualisation.") +uf.backend = pymol_control.frame_order +uf.menu_text = "&frame_order" +uf.gui_icon = "relax.frame_order" +uf.wizard_size = (900, 600) uf.wizard_apply_button = False uf.wizard_image = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'