1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The automatic relaxation curve fitting protocol."""
25
26
27 from os import sep
28
29
30 from generic_fns.pipes import cdp_name, has_pipe, switch
31 import generic_fns.structure.main
32 from prompt.interpreter import Interpreter
33 from status import Status; status = Status()
34
35
36
38 - def __init__(self, pipe_name=None, pipe_bundle=None, file_root='noe', results_dir=None, save_state=True):
39 """Perform relaxation curve fitting.
40
41 To use this auto-analysis, a data pipe with all the required data needs to be set up. This data pipe should contain the following:
42
43 - All the spins loaded.
44 - Unresolved spins deselected.
45 - The NOE peak intensities from the saturated and reference spectra.
46 - Either the baseplane noise RMDS values should be set or replicated spectra loaded.
47
48 @keyword pipe_name: The name of the data pipe containing all of the data for the analysis.
49 @type pipe_name: str
50 @keyword pipe_bundle: The data pipe bundle to associate all spawned data pipes with.
51 @type pipe_bundle: str
52 @keyword file_root: File root of the output filea.
53 @type file_root: str
54 @keyword results_dir: The directory where results files are saved.
55 @type results_dir: str
56 @keyword save_state: A flag which if True will cause a relax save state to be created at the end of the analysis.
57 @type save_state: bool
58 """
59
60
61 status.exec_lock.acquire(pipe_bundle, mode='auto-analysis')
62
63
64 status.init_auto_analysis(pipe_bundle, type='noe')
65 status.current_analysis = pipe_bundle
66
67
68 self.save_state = save_state
69 self.pipe_name = pipe_name
70 self.pipe_bundle = pipe_bundle
71 self.file_root = file_root
72 self.results_dir = results_dir
73 if self.results_dir:
74 self.grace_dir = results_dir + sep + 'grace'
75 else:
76 self.grace_dir = 'grace'
77
78
79 self.check_vars()
80
81
82 if self.pipe_name != cdp_name():
83 switch(self.pipe_name)
84
85
86 self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True)
87 self.interpreter.populate_self()
88 self.interpreter.on(verbose=False)
89
90
91 self.run()
92
93
94 status.auto_analysis[self.pipe_bundle].fin = True
95 status.current_analysis = None
96 status.exec_lock.release()
97
98
100 """Set up and run the NOE analysis."""
101
102
103 self.interpreter.spectrum.error_analysis()
104
105
106 self.interpreter.calc()
107
108
109 self.interpreter.value.write(param='noe', file=self.file_root+'.out', dir=self.results_dir, force=True)
110
111
112 self.interpreter.results.write(file='results', dir=self.results_dir, force=True)
113
114
115 self.interpreter.grace.write(y_data_type='ref', file='ref.agr', dir=self.grace_dir, force=True)
116 self.interpreter.grace.write(y_data_type='sat', file='sat.agr', dir=self.grace_dir, force=True)
117 self.interpreter.grace.write(y_data_type='noe', file='noe.agr', dir=self.grace_dir, force=True)
118
119
120 if self.save_state:
121 self.interpreter.state.save(state=self.file_root+'.save', dir=self.results_dir, force=True)
122
123
125 """Check that the user has set the variables correctly."""
126
127
128 if not has_pipe(self.pipe_name):
129 raise RelaxNoPipeError(self.pipe_name)
130