Author: bugman Date: Fri Aug 26 10:44:12 2011 New Revision: 14468 URL: http://svn.gna.org/viewcvs/relax?rev=14468&view=rev Log: Created the model-free PyMOL macro functions by copying the Molmol ones. This will need to be modified as Molmol commands are still being issued. Added: 1.3/specific_fns/model_free/pymol.py - copied, changed from r14454, 1.3/specific_fns/model_free/molmol.py Modified: 1.3/specific_fns/model_free/__init__.py Modified: 1.3/specific_fns/model_free/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/__init__.py?rev=14468&r1=14467&r2=14468&view=diff ============================================================================== --- 1.3/specific_fns/model_free/__init__.py (original) +++ 1.3/specific_fns/model_free/__init__.py Fri Aug 26 10:44:12 2011 @@ -30,6 +30,7 @@ 'mf_minimise', 'molmol', 'multi_processor_commands', + 'pymol', 'results' ] @@ -38,12 +39,13 @@ from main import Model_free_main from mf_minimise import Mf_minimise from molmol import Molmol +from pymol import Pymol from results import Results from specific_fns.api_base import API_base from specific_fns.api_common import API_common -class Model_free(Model_free_main, Mf_minimise, Molmol, Results, Bmrb, API_base, API_common): +class Model_free(Model_free_main, Mf_minimise, Molmol, Pymol, Results, Bmrb, API_base, API_common): """Parent class containing all the model-free specific functions.""" def __init__(self): Copied: 1.3/specific_fns/model_free/pymol.py (from r14454, 1.3/specific_fns/model_free/molmol.py) URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/pymol.py?p2=1.3/specific_fns/model_free/pymol.py&p1=1.3/specific_fns/model_free/molmol.py&r1=14454&r2=14468&rev=14468&view=diff ============================================================================== --- 1.3/specific_fns/model_free/molmol.py (original) +++ 1.3/specific_fns/model_free/pymol.py Fri Aug 26 10:44:12 2011 @@ -31,15 +31,15 @@ -class Molmol: - """Class containing the Molmol specific functions for model-free analysis.""" - - _molmol_classic_style_doc = ["Model-free classic style", """ +class Pymol: + """Class containing the Pymol specific functions for model-free analysis.""" + + _pymol_classic_style_doc = ["Model-free classic style", """ Creator: Edward d'Auvergne Argument string: "classic" - Description: The classic style draws the backbone of a protein in the Molmol 'neon' style. Rather than colouring the amino acids to which the NH bond belongs, the three covalent bonds of the peptide bond from Ca to Ca in which the NH bond is located are coloured. Deselected residues are shown as black lines. + Description: The classic style draws the backbone of a protein in the Pymol 'stick' style. Rather than colouring the amino acids to which the NH bond belongs, the three covalent bonds of the peptide bond from Ca to Ca in which the NH bond is located are coloured. Deselected residues are shown as black lines. Supported data types: ____________________________________________________________________________________________ @@ -108,7 +108,7 @@ |________________|_____________|___________________________________________________________| """] - def _molmol_classic_style(self, data_type=None, colour_start=None, colour_end=None, colour_list=None, spin_id=None): + def _pymol_classic_style(self, data_type=None, colour_start=None, colour_end=None, colour_list=None, spin_id=None): """The MOLMOL classic style. @keyword data_type: The parameter name or data type. @@ -134,7 +134,7 @@ for spin, mol_name, res_num, res_name in spin_loop(spin_id, full_info=True): # More than one spin. if prev_res_num == res_num: - raise RelaxError("Only a single spin per residue is allowed for the classic Molmol macro style.") + raise RelaxError("Only a single spin per residue is allowed for the classic Pymol macro style.") # Update the previous residue number. prev_res_num = res_num @@ -143,7 +143,7 @@ # Generate the macro header. ############################ - self._molmol_classic_header() + self._pymol_classic_header() # S2. @@ -161,7 +161,7 @@ continue # S2 width and colour. - self._molmol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) # S2f. @@ -176,11 +176,11 @@ # Colour residues which don't have an S2f value white. if not hasattr(spin, 's2f') or spin.s2f == None: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # S2f width and colour. else: - self._molmol_classic_order_param(res_num, spin.s2f, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2f, colour_start, colour_end, colour_list) # S2s. @@ -195,11 +195,11 @@ # Colour residues which don't have an S2s value white. if not hasattr(spin, 's2s') or spin.s2s == None: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # S2s width and colour. else: - self._molmol_classic_order_param(res_num, spin.s2s, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2s, colour_start, colour_end, colour_list) # Amplitude of fast motions. @@ -220,19 +220,19 @@ # S2f width and colour (for models m5 to m8). if hasattr(spin, 's2f') and spin.s2f != None: - self._molmol_classic_order_param(res_num, spin.s2f, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2f, colour_start, colour_end, colour_list) # S2 width and colour (for models m1 and m3). elif model == 'm1' or model == 'm3': - self._molmol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) # S2 width and colour (for models m2 and m4 when te <= 200 ps). elif (model == 'm2' or model == 'm4') and spin.te <= 200e-12: - self._molmol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) # White bonds (for models m2 and m4 when te > 200 ps). elif (model == 'm2' or model == 'm4') and spin.te > 200e-12: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # Catch errors. else: @@ -257,15 +257,15 @@ # S2 width and colour (for models m5 to m8). if hasattr(spin, 'ts') and spin.ts != None: - self._molmol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) # S2 width and colour (for models m2 and m4 when te > 200 ps). elif (model == 'm2' or model == 'm4') and spin.te > 200 * 1e-12: - self._molmol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) + self._pymol_classic_order_param(res_num, spin.s2, colour_start, colour_end, colour_list) # White bonds for fast motions. else: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # te. ##### @@ -282,7 +282,7 @@ continue # te width and colour. - self._molmol_classic_correlation_time(res_num, spin.te, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.te, colour_start, colour_end, colour_list) # tf. @@ -300,7 +300,7 @@ continue # tf width and colour. - self._molmol_classic_correlation_time(res_num, spin.tf, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.tf, colour_start, colour_end, colour_list) # ts. @@ -324,7 +324,7 @@ colour_end = 'black' # ts width and colour. - self._molmol_classic_correlation_time(res_num, spin.ts / 10.0, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.ts / 10.0, colour_start, colour_end, colour_list) # Timescale of fast motions. @@ -345,16 +345,16 @@ # tf width and colour (for models m5 to m8). if hasattr(spin, 'tf') and spin.tf != None: - self._molmol_classic_correlation_time(res_num, spin.tf, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.tf, colour_start, colour_end, colour_list) # te width and colour (for models m2 and m4 when te <= 200 ps). elif (model == 'm2' or model == 'm4') and spin.te <= 200e-12: - self._molmol_classic_correlation_time(res_num, spin.te, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.te, colour_start, colour_end, colour_list) # All other residues are assumed to have a fast correlation time of zero (statistically zero, not real zero!). # Colour these bonds white. else: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # Timescale of slow motions. @@ -381,15 +381,15 @@ # ts width and colour (for models m5 to m8). if hasattr(spin, 'ts') and spin.ts != None: - self._molmol_classic_correlation_time(res_num, spin.ts / 10.0, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.ts / 10.0, colour_start, colour_end, colour_list) # te width and colour (for models m2 and m4 when te > 200 ps). elif (model == 'm2' or model == 'm4') and spin.te > 200e-12: - self._molmol_classic_correlation_time(res_num, spin.te / 10.0, colour_start, colour_end, colour_list) + self._pymol_classic_correlation_time(res_num, spin.te / 10.0, colour_start, colour_end, colour_list) # White bonds for the rest. else: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # Rex. @@ -404,11 +404,11 @@ # Residues which chemical exchange. if hasattr(spin, 'rex') and spin.rex != None: - self._molmol_classic_rex(res_num, spin.rex, colour_start, colour_end, colour_list) + self._pymol_classic_rex(res_num, spin.rex, colour_start, colour_end, colour_list) # White bonds for the rest. else: - self._molmol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) + self._pymol_classic_colour(res_num=res_num, width=0.3, rgb_array=[1, 1, 1]) # Unknown data type. @@ -418,7 +418,7 @@ raise RelaxUnknownDataTypeError(data_type) - def _molmol_classic_colour(self, res_num=None, width=None, rgb_array=None): + def _pymol_classic_colour(self, res_num=None, width=None, rgb_array=None): """Colour the given peptide bond.""" # Ca to C bond. @@ -443,7 +443,7 @@ self.commands.append("") - def _molmol_classic_correlation_time(self, res_num, te, colour_start, colour_end, colour_list): + def _pymol_classic_correlation_time(self, res_num, te, colour_start, colour_end, colour_list): """Function for generating the bond width and colours for correlation times.""" # The te value in picoseconds. @@ -475,11 +475,11 @@ rgb_array = linear_gradient(colour_value, colour_end, colour_start, colour_list) # Colour the peptide bond. - self._molmol_classic_colour(res_num, width, rgb_array) - - - def _molmol_classic_header(self): - """Create the header for the molmol macro.""" + self._pymol_classic_colour(res_num, width, rgb_array) + + + def _pymol_classic_header(self): + """Create the header for the pymol macro.""" # Hide all bonds. self.commands.append("SelectBond ''") @@ -493,7 +493,7 @@ self.commands.append("ColorBond 0 0 0") - def _molmol_classic_order_param(self, res_num, s2, colour_start, colour_end, colour_list): + def _pymol_classic_order_param(self, res_num, s2, colour_start, colour_end, colour_list): """Function for generating the bond width and colours for order parameters.""" # The bond width (aiming for a width range of 2 to 0 for S2 values of 0.0 to 1.0). @@ -525,10 +525,10 @@ rgb_array = linear_gradient(colour_value, colour_start, colour_end, colour_list) # Colour the peptide bond. - self._molmol_classic_colour(res_num, width, rgb_array) - - - def _molmol_classic_rex(self, res_num, rex, colour_start, colour_end, colour_list): + self._pymol_classic_colour(res_num, width, rgb_array) + + + def _pymol_classic_rex(self, res_num, rex, colour_start, colour_end, colour_list): """Function for generating the bond width and colours for correlation times.""" # The Rex value at the first field strength. @@ -560,15 +560,15 @@ rgb_array = linear_gradient(colour_value, colour_end, colour_start, colour_list) # Colour the peptide bond. - self._molmol_classic_colour(res_num, width, rgb_array) - - - def molmol_macro(self, data_type, style=None, colour_start=None, colour_end=None, colour_list=None, spin_id=None): - """Create and return an array of Molmol macros of the model-free parameters. + self._pymol_classic_colour(res_num, width, rgb_array) + + + def pymol_macro(self, data_type, style=None, colour_start=None, colour_end=None, colour_list=None, spin_id=None): + """Create and return an array of Pymol macros of the model-free parameters. @param data_type: The parameter name or data type. @type data_type: str - @keyword style: The Molmol style. + @keyword style: The Pymol style. @type style: None or str @keyword colour_start: The starting colour (must be a MOLMOL or X11 name). @type colour_start: str @@ -585,7 +585,7 @@ # The classic style. if style == 'classic': - self._molmol_classic_style(data_type, colour_start, colour_end, colour_list, spin_id) + self._pymol_classic_style(data_type, colour_start, colour_end, colour_list, spin_id) # Unknown style. else: