Package gui :: Package analyses :: Module results_analysis
[hide private]
[frames] | no frames]

Source Code for Module gui.analyses.results_analysis

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2009-2010 Michael Bieri                                       # 
 4  # Copyright (C) 2009-2010 Edward d'Auvergne                                   # 
 5  #                                                                             # 
 6  # This file is part of the program relax (http://www.nmr-relax.com).          # 
 7  #                                                                             # 
 8  # This program is free software: you can redistribute it and/or modify        # 
 9  # it under the terms of the GNU General Public License as published by        # 
10  # the Free Software Foundation, either version 3 of the License, or           # 
11  # (at your option) any later version.                                         # 
12  #                                                                             # 
13  # This program is distributed in the hope that it will be useful,             # 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
16  # GNU General Public License for more details.                                # 
17  #                                                                             # 
18  # You should have received a copy of the GNU General Public License           # 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Python module imports. 
24  from os import sep 
25   
26  # relax module imports. 
27  from pipe_control.mol_res_spin import spin_loop 
28  from status import Status; status = Status() 
29   
30   
31 -def color_code_noe(target_dir, pdb_file):
32 """Create PyMol Macro for NOE colouring.""" 33 34 # Open the macro file. 35 file = open(target_dir + sep + 'noe.pml', 'w') 36 37 # PDB loading. 38 if pdb_file: 39 file.write("load " + pdb_file + '\n') 40 41 # PyMOL set up commands. 42 file.write("bg_color white\n") 43 file.write("color gray90\n") 44 file.write("hide all\n") 45 file.write("show ribbon\n") 46 47 # Loop over the spins. 48 for spin, mol_name, res_num, res_name in spin_loop(full_info=True): 49 # Skip deselected spins. 50 if not spin.select: 51 continue 52 53 # Skip spins with no data. 54 if not hasattr(spin, 'noe') or spin.noe == None: 55 continue 56 57 # Ribbon colour. 58 width = ((1.0 - spin.noe) * 2.0) 59 colour = 1.0 - ((spin.noe)**3) 60 colour = colour ** 3 61 colour = 1.0 - colour 62 63 # Write out the PyMOL commands. 64 file.write("set_color resicolor%s, [0, %s, 1]\n" % (res_num, colour)) 65 file.write("color resicolor%s, resi %s\n" % (res_num, res_num)) 66 file.write("set_bond stick_radius, %s, resi %s\n" % (width, res_num)) 67 68 # Final PyMOL commands. 69 file.write("hide all\n") 70 file.write("show sticks, name C+N+CA\n") 71 file.write("set stick_quality, 10\n") 72 file.write("ray\n") 73 74 # Close the macro. 75 file.close()
76