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 Michael Bieri                                            # 
 4  # Copyright (C) 2010-2012 Edward d'Auvergne                                   # 
 5  #                                                                             # 
 6  # This file is part of the program relax.                                     # 
 7  #                                                                             # 
 8  # relax 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 2 of the License, or           # 
11  # (at your option) any later version.                                         # 
12  #                                                                             # 
13  # relax 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 relax; if not, write to the Free Software                        # 
20  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
21  #                                                                             # 
22  ############################################################################### 
23   
24  # Python module imports. 
25  from os import sep 
26   
27  # relax module imports. 
28  from generic_fns.mol_res_spin import spin_loop 
29  from status import Status; status = Status() 
30   
31   
32 -def color_code_noe(target_dir, pdb_file):
33 """Create PyMol Macro for NOE colouring.""" 34 35 # Open the macro file. 36 file = open(target_dir + sep + 'noe.pml', 'w') 37 38 # PDB loading. 39 if pdb_file: 40 file.write("load " + pdb_file + '\n') 41 42 # PyMOL set up commands. 43 file.write("bg_color white\n") 44 file.write("color gray90\n") 45 file.write("hide all\n") 46 file.write("show ribbon\n") 47 48 # Loop over the spins. 49 for spin, mol_name, res_num, res_name in spin_loop(full_info=True): 50 # Skip deselected spins. 51 if not spin.select: 52 continue 53 54 # Skip spins with no data. 55 if not hasattr(spin, 'noe') or spin.noe == None: 56 continue 57 58 # Ribbon colour. 59 width = ((1.0 - spin.noe) * 2.0) 60 colour = 1.0 - ((spin.noe)**3) 61 colour = colour ** 3 62 colour = 1.0 - colour 63 64 # Write out the PyMOL commands. 65 file.write("set_color resicolor%s, [0, %s, 1]\n" % (res_num, colour)) 66 file.write("color resicolor%s, resi %s\n" % (res_num, res_num)) 67 file.write("set_bond stick_radius, %s, resi %s\n" % (width, res_num)) 68 69 # Final PyMOL commands. 70 file.write("hide all\n") 71 file.write("show sticks, name C+N+CA\n") 72 file.write("set stick_quality, 10\n") 73 file.write("ray\n") 74 75 # Close the macro. 76 file.close()
77