Author: bugman Date: Tue Oct 31 09:02:16 2006 New Revision: 2711 URL: http://svn.gna.org/viewcvs/relax?rev=2711&view=rev Log: Changed all references from Molmol to PyMOL in the PyMOL code. The macro fns raise RelaxErrors. The 'self.macro_exec()' and 'self.write()' functions raise RelaxErrors saying that the functions have not been implemented yet. The 'pymol.cartoon()' user function has been shifted to the top of the function list in the 'prompt/pymol.py' file. Modified: branches/tensor_pdb/generic_fns/pymol.py branches/tensor_pdb/prompt/pymol.py Modified: branches/tensor_pdb/generic_fns/pymol.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/pymol.py?rev=2711&r1=2710&r2=2711&view=diff ============================================================================== --- branches/tensor_pdb/generic_fns/pymol.py (original) +++ branches/tensor_pdb/generic_fns/pymol.py Tue Oct 31 09:02:16 2006 @@ -26,11 +26,11 @@ class Pymol: def __init__(self, relax): - """Class containing the functions for viewing molecules.""" + """Class containing the functions for viewing molecules using PyMOL.""" self.relax = relax - # Initialise the command history (for reopening Molmol pipes). + # Initialise the command history (for reopening PyMOL pipes). self.clear_history() @@ -58,40 +58,40 @@ def clear_history(self): - """Function for clearing the Molmol command history.""" + """Function for clearing the PyMOL command history.""" self.command_history = "" def command(self, run, command): - """Function for sending Molmol commands to the program pipe.""" - - # Arguments. - self.run = run - - # Test if the run exists. - if not self.run in self.relax.data.run_names: - raise RelaxNoRunError, self.run - - # Pass the command to Molmol. + """Function for sending PyMOL commands to the program pipe.""" + + # Arguments. + self.run = run + + # Test if the run exists. + if not self.run in self.relax.data.run_names: + raise RelaxNoRunError, self.run + + # Pass the command to PyMOL. self.pipe_write(command) def create_macro(self): - """Function for creating an array of Molmol commands.""" + """Function for creating an array of PyMOL commands.""" # Function type. self.function_type = self.relax.data.run_types[self.relax.data.run_names.index(self.run)] - # Specific Molmol macro creation function. - molmol_macro = self.relax.specific_setup.setup('molmol_macro', self.function_type) + # Specific PyMOL macro creation function. + pymol_macro = self.relax.specific_setup.setup('pymol_macro', self.function_type) # Get the macro. - self.commands = molmol_macro(self.run, self.data_type, self.style, self.colour_start, self.colour_end, self.colour_list) + self.commands = pymol_macro(self.run, self.data_type, self.style, self.colour_start, self.colour_end, self.colour_list) def macro_exec(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): - """Function for executing a Molmol macro.""" + """Function for executing a PyMOL macro.""" # Arguments. self.run = run @@ -101,6 +101,9 @@ self.colour_end = colour_end self.colour_list = colour_list + # No coded yet. + raise RelaxError, "This function has not yet been implemented." + # Test if the run exists. if not self.run in self.relax.data.run_names: raise RelaxNoRunError, self.run @@ -172,9 +175,9 @@ def pipe_write(self, command=None, store_command=1): - """Function for writing to the Molmol pipe. - - This function is also used to execute a user supplied Molmol command. + """Function for writing to the PyMOL pipe. + + This function is also used to execute a user supplied PyMOL command. """ # Reopen the pipe if needed. @@ -204,7 +207,7 @@ def view(self, run=None): - """Function for running Molmol.""" + """Function for running PyMOL.""" # Arguments. self.run = run @@ -217,7 +220,7 @@ def write(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir=None, force=0): - """Function for creating a Molmol macro.""" + """Function for creating a PyMOL macro.""" # Arguments. self.run = run @@ -227,6 +230,9 @@ self.colour_end = colour_end self.colour_list = colour_list + # No coded yet. + raise RelaxError, "This function has not yet been implemented." + # Test if the run exists. if not self.run in self.relax.data.run_names: raise RelaxNoRunError, self.run Modified: branches/tensor_pdb/prompt/pymol.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/pymol.py?rev=2711&r1=2710&r2=2711&view=diff ============================================================================== --- branches/tensor_pdb/prompt/pymol.py (original) +++ branches/tensor_pdb/prompt/pymol.py Tue Oct 31 09:02:16 2006 @@ -30,7 +30,7 @@ def __init__(self, relax): # Help. self.__relax_help__ = \ - """Class for interfacing with Molmol.""" + """Class for interfacing with PyMOL.""" # Add the generic help string. self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help @@ -39,42 +39,87 @@ self.__relax__ = relax - def clear_history(self): - """Function for clearing the Molmol command history.""" - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "pymol.clear_history()" - print text - - # Execute the functional code. - self.__relax__.generic.pymol.clear_history() - - - def command(self, run=None, command=None): - """Function for executing a user supplied Molmol command. + def cartoon(self, run=None): + """Apply the PyMOL cartoon style and colour by secondary structure. Keyword Arguments ~~~~~~~~~~~~~~~~~ run: The name of the run. - - command: The Molmol command to execute. Description ~~~~~~~~~~~ - This user function allows you to pass Molmol commands to the program. This can be useful - for automation or scripting. + This function applies the PyMOL cartoon style which is equivalent to hiding everything and + clicking on show cartoon. It also colours the cartoon with red helices, yellow strands, and + green loops. The following commands are executed: + + cmd.hide('everything', file) + cmd.show('cartoon', file) + util.cbss(file, 'red', 'yellow', 'green') + + where file is the file name without the '.pdb' extension. Example ~~~~~~~ - To reinitialise the Molmol instance for the run 'aic', type: - - relax> pymol.command("aic", "InitAll yes") + To apply this user function to the run 'final', type: + + relax> pymol.cartoon("final") + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.cartoon(" + text = text + "run=" + `run` + ")" + print text + + # The run name. + if type(run) != str: + raise RelaxStrError, ('run', run) + + # Execute the functional code. + self.__relax__.generic.pymol.cartoon(run=run) + + + def clear_history(self): + """Function for clearing the PyMOL command history.""" + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.clear_history()" + print text + + # Execute the functional code. + self.__relax__.generic.pymol.clear_history() + + + def command(self, run=None, command=None): + """Function for executing a user supplied PyMOL command. + + Keyword Arguments + ~~~~~~~~~~~~~~~~~ + + run: The name of the run. + + command: The PyMOL command to execute. + + + Description + ~~~~~~~~~~~ + + This user function allows you to pass PyMOL commands to the program. This can be useful + for automation or scripting. + + + Example + ~~~~~~~ + + To reinitialise the PyMOL instance for the run 'aic', type: + + relax> pymol.command("aic", "reinitialise") """ # Function intro text. @@ -97,7 +142,7 @@ def macro_exec(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): - """Function for executing Molmol macros. + """Function for executing PyMOL macros. Keyword Arguments ~~~~~~~~~~~~~~~~~ @@ -119,7 +164,7 @@ Description ~~~~~~~~~~~ - This function allows residues specific values to be mapped to a structure through Molmol + This function allows residues specific values to be mapped to a structure through PyMOL macros. Currently only the 'classic' style, which is described below, is availible. @@ -134,7 +179,7 @@ will select the default colour gradient which for each type of analysis is described below. When supplying the colours as strings, two lists of colours can be selected from which to - match the strings. These are the default Molmol colour list and the X11 colour list, both + match the strings. These are the default PyMOL colour list and the X11 colour list, both of which are described in the tables below. The default behaviour is to first search the Molmol list and then the X11 colour list, raising an error if neither contain the string. To explicitly select these lists, set the 'colour_list' argument to either 'molmol' or @@ -195,68 +240,23 @@ self.__relax__.generic.pymol.macro_exec(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list) - def cartoon(self, run=None): - """Apply the PyMOL cartoon style and colour by secondary structure. + def tensor_pdb(self, run=None, file=None): + """Function displaying the diffusion tensor PDB geometric object over the loaded PDB. Keyword Arguments ~~~~~~~~~~~~~~~~~ run: The name of the run. + + file: The name of the PDB file containing the tensor geometric object. Description ~~~~~~~~~~~ - This function applies the PyMOL cartoon style which is equivalent to hiding everything and - clicking on show cartoon. It also colours the cartoon with red helices, yellow strands, and - green loops. The following commands are executed: - - cmd.hide('everything', file) - cmd.show('cartoon', file) - util.cbss(file, 'red', 'yellow', 'green') - - where file is the file name without the '.pdb' extension. - - - Example - ~~~~~~~ - - To apply this user function to the run 'final', type: - - relax> pymol.cartoon("final") - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "pymol.cartoon(" - text = text + "run=" + `run` + ")" - print text - - # The run name. - if type(run) != str: - raise RelaxStrError, ('run', run) - - # Execute the functional code. - self.__relax__.generic.pymol.cartoon(run=run) - - - def tensor_pdb(self, run=None, file=None): - """Function displaying the diffusion tensor PDB geometric object over the loaded PDB. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - run: The name of the run. - - file: The name of the PDB file containing the tensor geometric object. - - - Description - ~~~~~~~~~~~ - In executing this user function, a PDB file must have previously been loaded into this run, a geometric object or polygon representing the Brownian rotational diffusion tensor will be - overlain with the loaded PDB file and displayed within Molmol. The PDB file containing the + overlain with the loaded PDB file and displayed within PyMOL. The PDB file containing the geometric object must be created using the complementary 'pdb.create_tensor_pdb()' user function. @@ -314,7 +314,7 @@ self.__relax__.generic.pymol.view(run=run) - def write(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir='molmol', force=0): + def write(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None, file=None, dir='pymol', force=0): """Function for creating PyMOL macros. Keyword Arguments @@ -344,7 +344,7 @@ ~~~~~~~~~~~ This function allows residues specific values to be mapped to a structure through the - creation of a Molmol '*.mac' macro which can be executed in Molmol by clicking on 'File, + creation of a PyMOL macro which can be executed in PyMOL by clicking on 'File, Macro, Execute User...'. Currently only the 'classic' style, which is described below, is availible. @@ -360,9 +360,9 @@ will select the default colour gradient which for each type of analysis is described below. When supplying the colours as strings, two lists of colours can be selected from which to - match the strings. These are the default Molmol colour list and the X11 colour list, both + match the strings. These are the default PyMOL colour list and the X11 colour list, both of which are described in the tables below. The default behaviour is to first search the - Molmol list and then the X11 colour list, raising an error if neither contain the string. + PyMOL list and then the X11 colour list, raising an error if neither contain the string. To explicitly select these lists, set the 'colour_list' argument to either 'molmol' or 'x11'. @@ -370,12 +370,12 @@ Examples ~~~~~~~~ - To create a Molmol macro mapping the order parameter values, S2, of the run 'final' onto the + To create a PyMOL macro mapping the order parameter values, S2, of the run 'final' onto the structure using the classic style, type: relax> pymol.write('final', 'S2') relax> pymol.write('final', data_type='S2') - relax> pymol.write('final', data_type='S2', style="classic", file='s2.mac', dir='molmol') + relax> pymol.write('final', data_type='S2', style="classic", file='s2.mac', dir='pymol') """ # Function intro text. @@ -441,7 +441,7 @@ ######################### # Write function. - #write.__doc__ = write.__doc__ + "\n\n" + Molmol.classic.__doc__ + "\n\n" + #write.__doc__ = write.__doc__ + "\n\n" + Pymol.classic.__doc__ + "\n\n" # Molmol RGB colour list. write.__doc__ = write.__doc__ + "\n\n" + Colour.molmol_colours.__doc__ + "\n\n"