Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2003-2015 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 """Module for interfacing with Grace (also known as Xmgrace, Xmgr, and ace).""" 24 25 # Python module imports. 26 from os import system 27 28 # relax module imports. 29 from lib.errors import RelaxError, RelaxNoSequenceError, RelaxNoSimError 30 from lib.io import get_file_path, open_write_file, test_binary 31 from pipe_control.mol_res_spin import count_molecules, count_residues, count_spins, exists_mol_res_spin_data 32 from pipe_control import pipes 33 from pipe_control.plotting import assemble_data 34 from specific_analyses.api import return_api 35 from status import Status; status = Status() 36 3739 """Determine the spin sequence data type. 40 41 The purpose is to identify systems whereby only spins or only residues exist. 42 43 @keyword spin_id: The spin identification string. 44 @type spin_id: str 45 @return: The spin sequence data type. This can be one of 'spin', 'res,' or 'mixed'. 46 @rtype: str 47 """ 48 49 # Count the molecules, residues, and spins. 50 num_mol = count_molecules(spin_id) 51 num_res = count_residues(spin_id) 52 num_spin = count_spins(spin_id) 53 54 # Only residues. 55 if num_mol == 1 and num_spin == 1: 56 return 'res' 57 58 # Only spins. 59 if num_mol == 1 and num_res == 1: 60 return 'spin' 61 62 # Mixed. 63 return 'mixed'64 6567 """Get all of the data types to plot for the current data pipe. 68 69 @return: A list of lists of all the allowable data type descriptions and their values. 70 @rtype: list of list of str 71 """ 72 73 # The specific analysis API object. 74 api = return_api() 75 76 # Return an empty list if the required functions are absent. 77 if not hasattr(api, 'data_names') or not hasattr(api, 'return_data_desc'): 78 return [] 79 80 # The data names, if they exist. 81 names = api.data_names(set='params') 82 83 # Initialise the list and then add the sequence data. 84 data = [] 85 data.append(["Spin sequence", 'spin']) 86 87 # Loop over the parameters. 88 for name in (api.data_names(set='params') + api.data_names(set='generic') + api.data_names(set='min')): 89 # Get the description. 90 try: 91 desc = api.return_data_desc(name) 92 except: 93 return [] 94 95 # No description. 96 if not desc: 97 text = name 98 99 # The text. 100 else: 101 text = "'%s': %s" % (name, desc) 102 103 # Append the description. 104 data.append([text, name]) 105 106 # Return the data. 107 return data108 109111 """Execute Grace. 112 113 @keyword file: The name of the file to open in Grace. 114 @type file: str 115 @keyword dir: The optional directory containing the file. 116 @type dir: str 117 @keyword grace_exe: The name of the Grace executable file. This should be located within the 118 system path. 119 @type grace_exe: str 120 """ 121 122 # Test the binary file string corresponds to a valid executable. 123 test_binary(grace_exe) 124 125 # File path. 126 file_path = get_file_path(file, dir) 127 128 # Run Grace. 129 system(grace_exe + " \"" + file_path + "\" &")130
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Sep 30 14:41:31 2015 | http://epydoc.sourceforge.net |