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