Package specific_fns :: Package model_free :: Module molmol
[hide private]
[frames] | no frames]

Source Code for Module specific_fns.model_free.molmol

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003-2011 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """The model-free Molmol macro module.""" 
25   
26  # relax module imports. 
27  from specific_fns.model_free.macro_base import Macro 
28   
29   
30 -class Molmol(Macro):
31 """Class containing the Molmol specific functions for model-free analysis.""" 32
33 - def classic_colour(self, res_num=None, width=None, rgb_array=None):
34 """Colour the given peptide bond.""" 35 36 # Ca to C bond. 37 self.commands.append("SelectBond 'atom1.name = \"CA\" & atom2.name = \"C\" & res.num = " + repr(res_num-1) + "'") 38 self.commands.append("StyleBond neon") 39 self.commands.append("RadiusBond " + repr(width)) 40 self.commands.append("ColorBond " + repr(rgb_array[0]) + " " + repr(rgb_array[1]) + " " + repr(rgb_array[2])) 41 42 # C to N bond. 43 self.commands.append("SelectBond 'atom1.name = \"C\" & atom2.name = \"N\" & res.num = " + repr(res_num-1) + "'") 44 self.commands.append("StyleBond neon") 45 self.commands.append("RadiusBond " + repr(width)) 46 self.commands.append("ColorBond " + repr(rgb_array[0]) + " " + repr(rgb_array[1]) + " " + repr(rgb_array[2])) 47 48 # N to Ca bond. 49 self.commands.append("SelectBond 'atom1.name = \"N\" & atom2.name = \"CA\" & res.num = " + repr(res_num) + "'") 50 self.commands.append("StyleBond neon") 51 self.commands.append("RadiusBond " + repr(width)) 52 self.commands.append("ColorBond " + repr(rgb_array[0]) + " " + repr(rgb_array[1]) + " " + repr(rgb_array[2])) 53 54 # Blank line. 55 self.commands.append("")
56 57
58 - def classic_header(self):
59 """Create the header for the molmol macro.""" 60 61 # Hide all bonds. 62 self.commands.append("SelectBond ''") 63 self.commands.append("StyleBond invisible") 64 65 # Show the backbone bonds as lines. 66 self.commands.append("SelectBond 'bb'") 67 self.commands.append("StyleBond line") 68 69 # Colour the backbone black. 70 self.commands.append("ColorBond 0 0 0")
71 72
73 - def molmol_macro(self, data_type, style=None, colour_start=None, colour_end=None, colour_list=None, spin_id=None):
74 """Wrapper method for the create_macro method. 75 76 @param data_type: The parameter name or data type. 77 @type data_type: str 78 @keyword style: The Molmol style. 79 @type style: None or str 80 @keyword colour_start: The starting colour (must be a MOLMOL or X11 name). 81 @type colour_start: str 82 @keyword colour_end: The ending colour (must be a MOLMOL or X11 name). 83 @type colour_end: str 84 @keyword colour_list: The colour list used, either 'molmol' or 'x11'. 85 @type colour_list: str 86 @keyword spin_id: The spin identification string. 87 @type spin_id: str 88 """ 89 90 self.create_macro(data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list, spin_id=spin_id)
91