Package specific_analyses :: Package model_free :: Module pymol
[hide private]
[frames] | no frames]

Source Code for Module specific_analyses.model_free.pymol

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003-2013 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 6  #                                                                             # 
 7  # This program 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 3 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.       # 
19  #                                                                             # 
20  ############################################################################### 
21   
22  # Module docstring. 
23  """The Pymol macro methods of the specific API for model-free analysis.""" 
24   
25  # relax module imports. 
26  from specific_analyses.model_free.macro_base import Macro 
27   
28   
29 -class Pymol(Macro):
30 """Class containing the Pymol specific functions for model-free analysis.""" 31
32 - def classic_colour(self, res_num=None, width=None, rgb_array=None):
33 """Colour the given peptide bond.""" 34 35 # Blank line (to make the macro file easier to read for the user). 36 self.commands.append("") 37 38 # Define the colour. 39 colour_name = 'pept_colour_%i' % res_num 40 self.commands.append("set_color %s, [%s, %s, %s]" % (colour_name, rgb_array[0], rgb_array[1], rgb_array[2])) 41 42 # The peptide bond. 43 self.commands.append("select pept_bond, (name ca,n and resi %i) or (name ca,c and resi %i)" % (res_num, res_num-1)) 44 self.commands.append("as sticks, pept_bond") 45 self.commands.append("set_bond stick_radius, %s, pept_bond" % width) 46 self.commands.append("set_bond stick_color, %s, pept_bond" % colour_name) 47 48 # Delete the selection. 49 self.commands.append("delete pept_bond")
50 51
52 - def classic_header(self):
53 """Create the header for the pymol macro.""" 54 55 # Hide all bonds. 56 self.commands.append("hide") 57 58 # Show the backbone bonds as lines. 59 self.commands.append("select bb, (name ca,n,c)") 60 self.commands.append("show lines, bb") 61 62 # Colour the backbone black. 63 self.commands.append("color black, bb") 64 65 # Delete the selection. 66 self.commands.append("delete bb") 67 68 # Set the background colour to white. 69 self.commands.append("bg_color white")
70 71
72 - def pymol_macro(self, data_type, style=None, colour_start=None, colour_end=None, colour_list=None, spin_id=None):
73 """Wrapper method for the create_macro method. 74 75 @param data_type: The parameter name or data type. 76 @type data_type: str 77 @keyword style: The Molmol style. 78 @type style: None or str 79 @keyword colour_start: The starting colour (must be a MOLMOL or X11 name). 80 @type colour_start: str 81 @keyword colour_end: The ending colour (must be a MOLMOL or X11 name). 82 @type colour_end: str 83 @keyword colour_list: The colour list used, either 'molmol' or 'x11'. 84 @type colour_list: str 85 @keyword spin_id: The spin identification string. 86 @type spin_id: str 87 """ 88 89 self.create_macro(data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list, spin_id=spin_id)
90