Author: bugman Date: Wed Jun 4 10:56:18 2014 New Revision: 23632 URL: http://svn.gna.org/viewcvs/relax?rev=23632&view=rev Log: Expanded the capabilities of the pymol.frame_order user function. The isotropic and pseudo-elliptic cones are now represented as they used to be under the pymol.cone_pdb user function. To avoid code duplication, the new represent_cone_axis(), represent_cone_object() and represent_rotor_object() functions have been created to send the commands into PyMOL. Modified: branches/frame_order_cleanup/pipe_control/pymol_control.py Modified: branches/frame_order_cleanup/pipe_control/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/pymol_control.py?rev=23632&r1=23631&r2=23632&view=diff ============================================================================== --- branches/frame_order_cleanup/pipe_control/pymol_control.py (original) +++ branches/frame_order_cleanup/pipe_control/pymol_control.py Wed Jun 4 10:56:18 2014 @@ -281,56 +281,11 @@ # Read in the cone PDB file. pymol_obj.exec_cmd("load " + file) - # The cone axes. - ################ - - # Select the AVE, AXE, and SIM residues. - pymol_obj.exec_cmd("select (resn AVE,AXE,SIM)") - - # Show the vector as a stick. - pymol_obj.exec_cmd("show stick, 'sele'") - - # Colour it blue. - pymol_obj.exec_cmd("color cyan, 'sele'") - - # Select the atom used for labelling. - pymol_obj.exec_cmd("select (resn AVE,AXE,SIM and symbol N)") - - # Hide the atom. - pymol_obj.exec_cmd("hide ('sele')") - - # Label using the atom name. - pymol_obj.exec_cmd("cmd.label(\"sele\",\"name\")") - + represent_cone_axis() # The cone object. - ################## - - # Select the CON residue. - pymol_obj.exec_cmd("select (resn CON,EDG)") - - # Hide everything. - pymol_obj.exec_cmd("hide ('sele')") - - # Show as 'sticks'. - pymol_obj.exec_cmd("show sticks, 'sele'") - - # Colour it white. - pymol_obj.exec_cmd("color white, 'sele'") - - # Shorten the stick width from 0.25 to 0.15. - pymol_obj.exec_cmd("set stick_radius,0.15000") - - # Set a bit of transparency. - pymol_obj.exec_cmd("set stick_transparency, 0.3") - - - # Clean up. - ########### - - # Remove the selection. - pymol_obj.exec_cmd("cmd.delete('sele')") + represent_cone_object() def create_macro(data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): @@ -410,7 +365,6 @@ pymol_obj.exec_cmd("load " + file) - def frame_order_geometric(file=None): """Display the frame order geometric object. @@ -424,30 +378,14 @@ # The object ID. id = file_root(file) - - # Rotor objects. - ################ - - # 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("set stick_radius, 0.15, 'sele'") - pymol_obj.exec_cmd("cmd.delete('sele')") - - + # Set up the rotor objects. + represent_rotor_object() + + # Set up the cone axis. + represent_cone_axis() + + # Set up the cone object. + represent_cone_object() 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): @@ -611,6 +549,79 @@ add_result_file(type='pymol', label='PyMOL', file=file_path) +def represent_cone_axis(): + """Set up the PyMOL cone axis representation.""" + + # Select the AVE, AXE, and SIM residues. + pymol_obj.exec_cmd("select (resn AVE,AXE,SIM)") + + # Show the vector as a stick. + pymol_obj.exec_cmd("show stick, 'sele'") + + # Colour it blue. + pymol_obj.exec_cmd("color cyan, 'sele'") + + # Select the atom used for labelling. + pymol_obj.exec_cmd("select (resn AVE,AXE,SIM and symbol N)") + + # Hide the atom. + pymol_obj.exec_cmd("hide ('sele')") + + # Label using the atom name. + pymol_obj.exec_cmd("cmd.label(\"sele\",\"name\")") + + # Remove the selection. + pymol_obj.exec_cmd("cmd.delete('sele')") + + +def represent_cone_object(): + """Set up the PyMOL cone object representation.""" + + # Select the CON and EDG residues. + pymol_obj.exec_cmd("select (resn CON,EDG)") + + # Hide everything. + pymol_obj.exec_cmd("hide ('sele')") + + # Show as 'sticks'. + pymol_obj.exec_cmd("show sticks, 'sele'") + + # Colour it white. + pymol_obj.exec_cmd("color white, 'sele'") + + # Shorten the stick width from 0.25 to 0.15. + pymol_obj.exec_cmd("set stick_radius, 0.15, 'sele'") + + # Set a bit of transparency. + pymol_obj.exec_cmd("set stick_transparency, 0.3, 'sele'") + + # Remove the selection. + pymol_obj.exec_cmd("cmd.delete('sele')") + + +def represent_rotor_object(): + """Set up the PyMOL rotor object representation.""" + + # Rotor objects: 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')") + + # Rotor objects: 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')") + + # Rotor objects: Set up the propellers. + pymol_obj.exec_cmd("select (resn PRB)") + pymol_obj.exec_cmd("show stick, 'sele'") + pymol_obj.exec_cmd("set stick_radius, 0.15, 'sele'") + pymol_obj.exec_cmd("cmd.delete('sele')") + + def tensor_pdb(file=None): """Display the diffusion tensor geometric structure.