Author: bugman Date: Fri Aug 26 12:09:13 2011 New Revision: 14477 URL: http://svn.gna.org/viewcvs/relax?rev=14477&view=rev Log: Renamed the PyMOL macro related user functions in the prompt/script front end. The pymol.macro_exec() function is now called pymol.macro_apply(), and pymol.write() is now called pymol.macro_write() to make it clearer. Modified: 1.3/prompt/pymol_control.py Modified: 1.3/prompt/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/pymol_control.py?rev=14477&r1=14476&r2=14477&view=diff ============================================================================== --- 1.3/prompt/pymol_control.py (original) +++ 1.3/prompt/pymol_control.py Fri Aug 26 12:09:13 2011 @@ -157,10 +157,10 @@ _build_doc(cone_pdb) - def macro_exec(self, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): - # Function intro text. - if self._exec_info.intro: - text = self._exec_info.ps3 + "pymol.macro_exec(" + def macro_apply(self, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): + # Function intro text. + if self._exec_info.intro: + text = self._exec_info.ps3 + "pymol.macro_apply(" text = text + "data_type=" + repr(data_type) text = text + ", style=" + repr(style) text = text + ", colour_start=" + repr(colour_start) @@ -176,132 +176,37 @@ arg_check.is_str(colour_list, 'colour list', can_be_none=True) # Execute the functional code. - pymol_control.macro_exec(data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list) - - # The function doc info. - macro_exec._doc_title = "Execute PyMOL macros." - macro_exec._doc_title_short = "PyMOL macro execution." - macro_exec._doc_args = [ + pymol_control.macro_apply(data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list) + + # The function doc info. + macro_apply._doc_title = "Execute PyMOL macros." + macro_apply._doc_title_short = "PyMOL macro execution." + macro_apply._doc_args = [ ["data_type", "The data type to map to the structure."], ["style", "The style of the macro."], ["colour_start", "The starting colour, either an array or string, of the linear colour gradient."], ["colour_end", "The ending colour, either an array or string, of the linear colour gradient."], ["colour_list", "The list of colours to match the start and end strings."] ] - macro_exec._doc_desc = """ + macro_apply._doc_desc = """ This allows spin specific values to be mapped to a structure through PyMOL macros. Currently only the 'classic' style, which is described below, is available. """ - macro_exec._doc_examples = """ + macro_apply._doc_examples = """ To map the order parameter values, S2, onto the structure using the classic style, type: - relax> pymol.macro_exec('S2') - relax> pymol.macro_exec(data_type='S2') - relax> pymol.macro_exec(data_type='S2', style="classic") - """ - macro_exec._doc_additional = [ + relax> pymol.macro_apply('S2') + relax> pymol.macro_apply(data_type='S2') + relax> pymol.macro_apply(data_type='S2', style="classic") + """ + macro_apply._doc_additional = [ colour._linear_gradient_doc, colour.__molmol_colours_prompt_doc__, colour.__x11_colours_prompt_doc__ ] - _build_doc(macro_exec) - - - def tensor_pdb(self, file=None): - # Function intro text. - if self._exec_info.intro: - text = self._exec_info.ps3 + "pymol.tensor_pdb(" - text = text + "file=" + repr(file) + ")" - print(text) - - # The argument checks. - arg_check.is_str_or_inst(file, 'file name') - - # Execute the functional code. - pymol_control.tensor_pdb(file=file) - - # The function doc info. - tensor_pdb._doc_title = "Display the diffusion tensor PDB geometric object over the loaded PDB." - tensor_pdb._doc_title_short = "Diffusion tensor and structure display." - tensor_pdb._doc_args = [ - ["file", "The name of the PDB file containing the tensor geometric object."] - ] - tensor_pdb._doc_desc = """ - In executing this user function, a PDB file must have previously been loaded into this data pipe a geometric object or polygon representing the Brownian rotational diffusion tensor will be overlain with the loaded PDB file and displayed within PyMOL. The PDB file containing the geometric object must be created using the complementary structure.create_diff_tensor_pdb user function. - - The tensor PDB file is read in using the command: - - load file - - The centre of mass residue 'COM' is displayed using the commands: - - select resn COM - show dots, 'sele' - color blue, 'sele' - - The axes of the diffusion tensor, the residue 'AXS', is displayed using the commands: - - select resn AXS - hide ('sele') - show sticks, 'sele' - color cyan, 'sele' - label 'sele', name - - The simulation axes, the residues 'SIM', are displayed using the commands: - - select resn SIM - colour cyan, 'sele' - """ - _build_doc(tensor_pdb) - - - def vector_dist(self, file='XH_dist.pdb'): - # Function intro text. - if self._exec_info.intro: - text = self._exec_info.ps3 + "pymol.vector_dist(" - text = text + "file=" + repr(file) + ")" - print(text) - - # The argument checks. - arg_check.is_str(file, 'file name') - - # Execute the functional code. - pymol_control.vector_dist(file=file) - - # The function doc info. - vector_dist._doc_title = "Display the PDB file representation of the XH vector distribution." - vector_dist._doc_title_short = "XH vector distribution display." - vector_dist._doc_args = [ - ["file", "The name of the PDB file containing the vector distribution."] - ] - vector_dist._doc_desc = """ - A PDB file of the macromolecule must have previously been loaded as the vector distribution will be overlain with the macromolecule within PyMOL. The PDB file containing the vector distribution must be created using the complementary structure.create_vector_dist user function. - - The vector distribution PDB file is read in using the command: - - load file - """ - _build_doc(vector_dist) - - - def view(self): - # Function intro text. - if self._exec_info.intro: - text = self._exec_info.ps3 + "pymol.view()" - print(text) - - # Execute the functional code. - pymol_control.view() - - # The function doc info. - view._doc_title = "View the collection of molecules from the loaded PDB file." - view._doc_title_short = "Molecule viewing." - view._doc_examples = """ - relax> pymol.view() - """ - _build_doc(view) - - - def write(self, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir='pymol', force=False): + _build_doc(macro_apply) + + + def macro_write(self, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir='pymol', force=False): # Function intro text. if self._exec_info.intro: text = self._exec_info.ps3 + "pymol.write(" @@ -358,3 +263,98 @@ colour.__x11_colours_prompt_doc__ ] _build_doc(write) + + + def tensor_pdb(self, file=None): + # Function intro text. + if self._exec_info.intro: + text = self._exec_info.ps3 + "pymol.tensor_pdb(" + text = text + "file=" + repr(file) + ")" + print(text) + + # The argument checks. + arg_check.is_str_or_inst(file, 'file name') + + # Execute the functional code. + pymol_control.tensor_pdb(file=file) + + # The function doc info. + tensor_pdb._doc_title = "Display the diffusion tensor PDB geometric object over the loaded PDB." + tensor_pdb._doc_title_short = "Diffusion tensor and structure display." + tensor_pdb._doc_args = [ + ["file", "The name of the PDB file containing the tensor geometric object."] + ] + tensor_pdb._doc_desc = """ + In executing this user function, a PDB file must have previously been loaded into this data pipe a geometric object or polygon representing the Brownian rotational diffusion tensor will be overlain with the loaded PDB file and displayed within PyMOL. The PDB file containing the geometric object must be created using the complementary structure.create_diff_tensor_pdb user function. + + The tensor PDB file is read in using the command: + + load file + + The centre of mass residue 'COM' is displayed using the commands: + + select resn COM + show dots, 'sele' + color blue, 'sele' + + The axes of the diffusion tensor, the residue 'AXS', is displayed using the commands: + + select resn AXS + hide ('sele') + show sticks, 'sele' + color cyan, 'sele' + label 'sele', name + + The simulation axes, the residues 'SIM', are displayed using the commands: + + select resn SIM + colour cyan, 'sele' + """ + _build_doc(tensor_pdb) + + + def vector_dist(self, file='XH_dist.pdb'): + # Function intro text. + if self._exec_info.intro: + text = self._exec_info.ps3 + "pymol.vector_dist(" + text = text + "file=" + repr(file) + ")" + print(text) + + # The argument checks. + arg_check.is_str(file, 'file name') + + # Execute the functional code. + pymol_control.vector_dist(file=file) + + # The function doc info. + vector_dist._doc_title = "Display the PDB file representation of the XH vector distribution." + vector_dist._doc_title_short = "XH vector distribution display." + vector_dist._doc_args = [ + ["file", "The name of the PDB file containing the vector distribution."] + ] + vector_dist._doc_desc = """ + A PDB file of the macromolecule must have previously been loaded as the vector distribution will be overlain with the macromolecule within PyMOL. The PDB file containing the vector distribution must be created using the complementary structure.create_vector_dist user function. + + The vector distribution PDB file is read in using the command: + + load file + """ + _build_doc(vector_dist) + + + def view(self): + # Function intro text. + if self._exec_info.intro: + text = self._exec_info.ps3 + "pymol.view()" + print(text) + + # Execute the functional code. + pymol_control.view() + + # The function doc info. + view._doc_title = "View the collection of molecules from the loaded PDB file." + view._doc_title_short = "Molecule viewing." + view._doc_examples = """ + relax> pymol.view() + """ + _build_doc(view)