1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module for the reading of Bruker Dynamics Centre (DC) files."""
24
25
26 from lib.errors import RelaxNoSequenceError
27 from lib.physical_constants import element_from_isotope
28 from lib.software.bruker_dc import parse_file
29 from pipe_control import pipes
30 from pipe_control.exp_info import software_select
31 from pipe_control.mol_res_spin import exists_mol_res_spin_data, name_spin
32 from pipe_control.relax_data import pack_data, peak_intensity_type
33
34
35 -def read(ri_id=None, file=None, dir=None):
36 """Read the DC data file and place all the data into the relax data store.
37
38 @keyword ri_id: The relaxation data ID string.
39 @type ri_id: str
40 @keyword file: The name of the file to open.
41 @type file: str
42 @keyword dir: The directory containing the file (defaults to the current directory if None).
43 @type dir: str or None
44 """
45
46
47 pipes.test()
48
49
50 if not exists_mol_res_spin_data():
51 raise RelaxNoSequenceError
52
53
54 values, errors, res_nums, int_type, frq, ri_type, spin_name, isotope, version = parse_file(file=file, dir=dir)
55
56
57 name_spin(name=spin_name, force=False)
58
59
60 if isotope:
61 atom_name = element_from_isotope(isotope)
62 for i in range(len(res_nums)):
63 res_nums[i] += '@' + atom_name
64
65
66 pack_data(ri_id, ri_type, frq, values, errors, spin_ids=res_nums)
67
68
69 peak_intensity_type(ri_id=ri_id, type=int_type)
70
71
72 software_select('Bruker DC', version=version)
73