Author: bugman Date: Sun Oct 29 09:17:10 2006 New Revision: 2702 URL: http://svn.gna.org/viewcvs/relax?rev=2702&view=rev Log: Initial support for PyMOL. The 'prompt' and 'generic_fns' Molmol files have been copied to new PyMOL files. The classes have been renamed and setup within the prompt interface or the main generic functions class. A number of instances where 'molmol' was written have been replaced with 'pymol'. Much work is still left. For example PyMOL will not execute in script mode as it terminates saying: PyMOL: normal program termination. once the pipe is closed (after finishing the script and relax terminating). Added: branches/tensor_pdb/generic_fns/pymol.py - copied, changed from r2700, branches/tensor_pdb/generic_fns/molmol.py branches/tensor_pdb/prompt/pymol.py - copied, changed from r2700, branches/tensor_pdb/prompt/molmol.py Modified: branches/tensor_pdb/generic_fns/main.py branches/tensor_pdb/prompt/__init__.py branches/tensor_pdb/prompt/interpreter.py Modified: branches/tensor_pdb/generic_fns/main.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/main.py?rev=2702&r1=2701&r2=2702&view=diff ============================================================================== --- branches/tensor_pdb/generic_fns/main.py (original) +++ branches/tensor_pdb/generic_fns/main.py Sun Oct 29 09:17:10 2006 @@ -35,6 +35,7 @@ from nuclei import Nuclei from palmer import Palmer from pdb import PDB +from pymol import Pymol from results import Results from runs import Runs from selection import Selection @@ -67,6 +68,7 @@ self.opendx = OpenDX(self.relax) self.palmer = Palmer(self.relax) self.pdb = PDB(self.relax) + self.pymol = Pymol(self.relax) self.results = Results(self.relax) self.runs = Runs(self.relax) self.selection = Selection(self.relax) Copied: branches/tensor_pdb/generic_fns/pymol.py (from r2700, branches/tensor_pdb/generic_fns/molmol.py) URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/pymol.py?p2=branches/tensor_pdb/generic_fns/pymol.py&p1=branches/tensor_pdb/generic_fns/molmol.py&r1=2700&r2=2702&rev=2702&view=diff ============================================================================== --- branches/tensor_pdb/generic_fns/molmol.py (original) +++ branches/tensor_pdb/generic_fns/pymol.py Sun Oct 29 09:17:10 2006 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004, 2006 Edward d'Auvergne # +# Copyright (C) 2006 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -24,7 +24,7 @@ from string import split -class Molmol: +class Pymol: def __init__(self, relax): """Class containing the functions for viewing molecules.""" @@ -113,13 +113,13 @@ def pipe_open(self): - """Function for opening a Molmol pipe.""" - - # Test that the Molmol binary exists. - self.relax.IO.test_binary('molmol') - - # Open the Molmol pipe. - self.relax.data.molmol = popen("molmol -f -", 'w', 0) + """Function for opening a PyMOL pipe.""" + + # Test that the PyMOL binary exists. + self.relax.IO.test_binary('pymol') + + # Open the PyMOL pipe. + self.relax.data.molmol = popen("pymol -qp", 'w', 0) # Execute the command history. if len(self.command_history) > 0: @@ -130,16 +130,12 @@ if hasattr(self.relax.data, 'pdb') and self.relax.data.pdb.has_key(self.run): self.open_pdb() - # Run InitAll to remove everything from molmol. - else: - self.pipe_write("InitAll yes") - def pipe_open_test(self): - """Function for testing if the Molmol pipe is open.""" + """Function for testing if the PyMOL pipe is open.""" # Test if a pipe has been opened. - if not hasattr(self.relax.data, 'molmol'): + if not hasattr(self.relax.data, 'pymol'): return 0 # Test if the pipe has been broken. @@ -235,9 +231,9 @@ # Arguments. self.run = run - # Open a Molmol pipe. + # Open a PyMOL pipe. if self.pipe_open_test(): - raise RelaxError, "The Molmol pipe already exists." + raise RelaxError, "The PyMOL pipe already exists." else: self.pipe_open() Modified: branches/tensor_pdb/prompt/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/__init__.py?rev=2702&r1=2701&r2=2702&view=diff ============================================================================== --- branches/tensor_pdb/prompt/__init__.py (original) +++ branches/tensor_pdb/prompt/__init__.py Sun Oct 29 09:17:10 2006 @@ -43,6 +43,7 @@ 'nuclei', 'palmer', 'pdb', + 'pymol', 'relax_data', 'relax_fit', 'run', Modified: branches/tensor_pdb/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/interpreter.py?rev=2702&r1=2701&r2=2702&view=diff ============================================================================== --- branches/tensor_pdb/prompt/interpreter.py (original) +++ branches/tensor_pdb/prompt/interpreter.py Sun Oct 29 09:17:10 2006 @@ -59,6 +59,7 @@ from noe import Noe from palmer import Palmer from pdb import PDB +from pymol import Pymol from relax_data import Relax_data from relax_fit import Relax_fit from results import Results @@ -116,6 +117,7 @@ self._Noe = Noe(relax) self._Palmer = Palmer(relax) self._PDB = PDB(relax) + self._Pymol = Pymol(relax) self._Relax_data = Relax_data(relax) self._Relax_fit = Relax_fit(relax) self._Results = Results(relax) @@ -173,6 +175,7 @@ noe = self._Noe palmer = self._Palmer pdb = self._PDB + pymol = self._Pymol relax_data = self._Relax_data relax_fit = self._Relax_fit results = self._Results Copied: branches/tensor_pdb/prompt/pymol.py (from r2700, branches/tensor_pdb/prompt/molmol.py) URL: http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/pymol.py?p2=branches/tensor_pdb/prompt/pymol.py&p1=branches/tensor_pdb/prompt/molmol.py&r1=2700&r2=2702&rev=2702&view=diff ============================================================================== --- branches/tensor_pdb/prompt/molmol.py (original) +++ branches/tensor_pdb/prompt/pymol.py Sun Oct 29 09:17:10 2006 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2004, 2006 Edward d'Auvergne # +# Copyright (C) 2006 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -23,15 +23,10 @@ import sys from colour import Colour -from doc_string import regexp_doc import help -from generic_fns.minimise import Minimise -from specific_fns.model_free import Molmol -from specific_fns.jw_mapping import Jw_mapping -from specific_fns.noe import Noe - - -class Molmol: + + +class Pymol: def __init__(self, relax): # Help. self.__relax_help__ = \ @@ -49,11 +44,11 @@ # Function intro text. if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.clear_history()" - print text - - # Execute the functional code. - self.__relax__.generic.molmol.clear_history() + 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): @@ -79,12 +74,12 @@ To reinitialise the Molmol instance for the run 'aic', type: - relax> molmol.command("aic", "InitAll yes") - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.command(" + relax> pymol.command("aic", "InitAll yes") + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.command(" text = text + "run=" + `run` text = text + ", command=" + `command` + ")" print text @@ -98,7 +93,7 @@ raise RelaxStrError, ('command', command) # Execute the functional code. - self.__relax__.generic.molmol.command(run=run, command=command) + self.__relax__.generic.pymol.command(run=run, command=command) def macro_exec(self, run=None, data_type=None, style="classic", colour_start=None, colour_end=None, colour_list=None): @@ -152,14 +147,14 @@ To map the order parameter values, S2, of the run 'final' onto the structure using the classic style, type: - relax> molmol.macro_exec('final', 'S2') - relax> molmol.macro_exec('final', data_type='S2') - relax> molmol.macro_exec('final', data_type='S2', style="classic") - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.macro_exec(" + relax> pymol.macro_exec('final', 'S2') + relax> pymol.macro_exec('final', data_type='S2') + relax> pymol.macro_exec('final', data_type='S2', style="classic") + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.macro_exec(" text = text + "run=" + `run` text = text + ", data_type=" + `data_type` text = text + ", style=" + `style` @@ -197,11 +192,11 @@ raise RelaxListNumError, ('ending colour of the linear gradient', colour_end) # Execute the functional code. - self.__relax__.generic.molmol.macro_exec(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list) - - - def ribbon(self, run=None): - """Apply the Molmol ribbon style. + 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. Keyword Arguments ~~~~~~~~~~~~~~~~~ @@ -226,12 +221,12 @@ To apply the ribbon style to the PDB file loaded for the run 'final', type: - relax> molmol.ribbon("final") - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.ribbon(" + relax> pymol.ribbon("final") + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.ribbon(" text = text + "run=" + `run` + ")" print text @@ -240,7 +235,7 @@ raise RelaxStrError, ('run', run) # Execute the functional code. - self.__relax__.generic.molmol.ribbon(run=run) + self.__relax__.generic.pymol.ribbon(run=run) def tensor_pdb(self, run=None, file=None): @@ -300,7 +295,7 @@ # Function intro text. if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.tensor_pdb(" + text = sys.ps3 + "pymol.tensor_pdb(" text = text + "run=" + `run` text = text + ", file=" + `file` + ")" print text @@ -314,7 +309,7 @@ raise RelaxStrError, ('file name', file) # Execute the functional code. - self.__relax__.generic.molmol.tensor_pdb(run=run, file=file) + self.__relax__.generic.pymol.tensor_pdb(run=run, file=file) def view(self, run=None): @@ -329,13 +324,13 @@ Example ~~~~~~~ - relax> molmol.view('m1') - relax> molmol.view(run='pdb') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.view(" + relax> pymol.view('m1') + relax> pymol.view(run='pdb') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.view(" text = text + "run=" + `run` + ")" print text @@ -344,11 +339,11 @@ raise RelaxStrError, ('run', run) # Execute the functional code. - self.__relax__.generic.molmol.view(run=run) + 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): - """Function for creating Molmol macros. + """Function for creating PyMOL macros. Keyword Arguments ~~~~~~~~~~~~~~~~~ @@ -406,14 +401,14 @@ To create a Molmol macro mapping the order parameter values, S2, of the run 'final' onto the structure using the classic style, type: - relax> molmol.write('final', 'S2') - relax> molmol.write('final', data_type='S2') - relax> molmol.write('final', data_type='S2', style="classic", file='s2.mac', dir='molmol') - """ - - # Function intro text. - if self.__relax__.interpreter.intro: - text = sys.ps3 + "molmol.write(" + 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') + """ + + # Function intro text. + if self.__relax__.interpreter.intro: + text = sys.ps3 + "pymol.write(" text = text + "run=" + `run` text = text + ", data_type=" + `data_type` text = text + ", style=" + `style` @@ -466,7 +461,7 @@ raise RelaxBinError, ('force flag', force) # Execute the functional code. - self.__relax__.generic.molmol.write(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list, file=file, dir=dir, force=force) + self.__relax__.generic.pymol.write(run=run, data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list, file=file, dir=dir, force=force) @@ -474,7 +469,7 @@ ######################### # Write function. - write.__doc__ = write.__doc__ + "\n\n" + Molmol.classic.__doc__ + "\n\n" + #write.__doc__ = write.__doc__ + "\n\n" + Molmol.classic.__doc__ + "\n\n" # Molmol RGB colour list. write.__doc__ = write.__doc__ + "\n\n" + Colour.molmol_colours.__doc__ + "\n\n"