1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """Module containing the 'molecule' user function class."""
25 __docformat__ = 'plaintext'
26
27
28 from base_class import User_fn_class, _build_doc
29 import arg_check
30 from generic_fns.mol_res_spin import ALLOWED_MOL_TYPES, copy_molecule, create_molecule, delete_molecule, display_molecule, id_string_doc, name_molecule, type_molecule
31
32
34 """Class for manipulating the molecule data."""
35
36 - def copy(self, pipe_from=None, mol_from=None, pipe_to=None, mol_to=None):
37
38 if self._exec_info.intro:
39 text = self._exec_info.ps3 + "molecule.copy("
40 text = text + "pipe_from=" + repr(pipe_from)
41 text = text + ", mol_from=" + repr(mol_from)
42 text = text + ", pipe_to=" + repr(pipe_to)
43 text = text + ", mol_to=" + repr(mol_to) + ")"
44 print(text)
45
46
47 arg_check.is_str(pipe_from, 'pipe from', can_be_none=True)
48 arg_check.is_str(mol_from, 'molecule from')
49 arg_check.is_str(pipe_to, 'pipe to', can_be_none=True)
50 arg_check.is_str(mol_to, 'molecule to', can_be_none=True)
51
52
53 copy_molecule(pipe_from=pipe_from, mol_from=mol_from, pipe_to=pipe_to, mol_to=mol_to)
54
55
56 copy._doc_title = "Copy all data associated with a molecule."
57 copy._doc_title_short = "Molecule copying."
58 copy._doc_args = [
59 ["pipe_from", "The data pipe containing the molecule from which the data will be copied. This defaults to the current data pipe."],
60 ["mol_from", "The name of the molecule from which to copy data from."],
61 ["pipe_to", "The data pipe to copy the data to. This defaults to the current data pipe."],
62 ["mol_to", "The name of the new molecule. If left blank, the new molecule will have the same name as the old."]]
63 copy._doc_desc = """
64 This will copy all the data associated with a molecule to a second molecule. This includes all residue and spin system information. The new molecule name must be unique in the destination data pipe.
65 """
66 copy._doc_examples = """
67 To copy the molecule data from the molecule 'GST' to the new molecule 'wt-GST', type:
68
69 relax> molecule.copy('#GST', '#wt-GST')
70 relax> molecule.copy(mol_from='#GST', mol_to='#wt-GST')
71
72
73 To copy the molecule data of the molecule 'Ap4Aase' from the data pipe 'm1' to 'm2', assuming the current
74 data pipe is 'm1', type:
75
76 relax> molecule.copy(mol_from='#ApAase', pipe_to='m2')
77 relax> molecule.copy(pipe_from='m1', mol_from='#ApAase', pipe_to='m2', mol_to='#ApAase')
78 """
79 _build_doc(copy)
80
81
82 - def create(self, mol_name=None, mol_type=None):
83
84 if self._exec_info.intro:
85 text = self._exec_info.ps3 + "molecule.create("
86 text = text + "mol_name=" + repr(mol_name)
87 text = text + ", mol_type=" + repr(mol_type) + ")"
88 print(text)
89
90
91 arg_check.is_str(mol_name, 'molecule name')
92 arg_check.is_str(mol_type, 'molecule type', can_be_none=True)
93
94
95 create_molecule(mol_name=mol_name, mol_type=mol_type)
96
97
98 create._doc_title = "Create a new molecule."
99 create._doc_title_short = "Molecule creation."
100 create._doc_args = [
101 ["mol_name", "The name of the new molecule."],
102 ["mol_type", "The type of molecule."]]
103 create._doc_desc = """
104 This adds a new molecule data container to the relax data storage object. The same molecule name cannot be used more than once. The molecule type need not be specified. However, if given, it should be one of"""
105 for _i in range(len(ALLOWED_MOL_TYPES)):
106 create._doc_desc = "%s '%s'," % (create._doc_desc, ALLOWED_MOL_TYPES[_i])
107 create._doc_desc = "%s or '%s'." % (create._doc_desc, ALLOWED_MOL_TYPES[-1])
108 create._doc_examples = """
109 To create the molecules 'Ap4Aase', 'ATP', and 'MgF4', type:
110
111 relax> molecule.create('Ap4Aase')
112 relax> molecule.create('ATP')
113 relax> molecule.create('MgF4')
114 """
115 _build_doc(create)
116
117
118 - def delete(self, mol_id=None):
119
120 if self._exec_info.intro:
121 text = self._exec_info.ps3 + "molecule.delete("
122 text = text + "mol_id=" + repr(mol_id) + ")"
123 print(text)
124
125
126 arg_check.is_str(mol_id, 'molecule ID string')
127
128
129 delete_molecule(mol_id=mol_id)
130
131
132 delete._doc_title = "Deleting molecules from the relax data store."
133 delete._doc_title_short = "Molecule deletion."
134 delete._doc_args = [
135 ["mol_id", "The molecule ID string."]]
136 delete._doc_desc = """
137 This can be used to delete a single or sets of molecules from the relax data store. The molecule will be deleted from the current data pipe.
138 """
139 delete._doc_additional = [id_string_doc]
140 _build_doc(delete)
141
142
144
145 if self._exec_info.intro:
146 text = self._exec_info.ps3 + "molecule.display("
147 text = text + "mol_id=" + repr(mol_id) + ")"
148 print(text)
149
150
151 arg_check.is_str(mol_id, 'molecule ID string', can_be_none=True)
152
153
154 display_molecule(mol_id=mol_id)
155
156
157 display._doc_title = "Display the molecule information."
158 display._doc_title_short = "Molecule information."
159 display._doc_args = [
160 ["mol_id", "The molecule ID string."]]
161 display._doc_additional = [id_string_doc]
162 _build_doc(display)
163
164
165 - def name(self, mol_id=None, name=None, force=False):
181
182
183 name._doc_title = "Name a molecule."
184 name._doc_args = [
185 ["mol_id", "The molecule ID string corresponding to one or more molecules."],
186 ["name", "The new molecule name."],
187 ["force", "A flag which if True will cause the molecule to be renamed."]]
188 name._doc_desc = """
189 This simply allows molecules to be named (or renamed).
190 """
191 name._doc_examples = """
192 To rename the molecule 'Ap4Aase' to 'Inhib Ap4Aase', type one of:
193
194 relax> molecule.name('#Ap4Aase', 'Inhib Ap4Aase', True)
195 relax> molecule.name(mol_id='#Ap4Aase', name='Inhib Ap4Aase', force=True)
196
197 This assumes the molecule 'Ap4Aase' already exists.
198 """
199 name._doc_additional = [id_string_doc]
200 _build_doc(name)
201
202
203 - def type(self, mol_id=None, type=None, force=False):
219
220
221 type._doc_title = "Set the molecule type."
222 type._doc_title_short = "Setting molecule type."
223 type._doc_args = [
224 ["mol_id", "The molecule ID string corresponding to one or more molecules."],
225 ["type", "The molecule type."],
226 ["force", "A flag which if True will cause the molecule to type to be overwritten."]]
227 type._doc_desc = """
228 This allows the type of the molecule to be specified. It can be one of:
229
230 """
231 for _i in range(len(ALLOWED_MOL_TYPES)):
232 type._doc_desc = "%s '%s',\n" % (type._doc_desc, ALLOWED_MOL_TYPES[_i])
233 type._doc_desc = "%s '%s'.\n" % (type._doc_desc, ALLOWED_MOL_TYPES[-1])
234 type._doc_examples = """
235 To set the molecule 'Ap4Aase' to the 'protein' type, type one of:
236
237 relax> molecule.type('#Ap4Aase', 'protein', True)
238 relax> molecule.type(mol_id='#Ap4Aase', type='protein', force=True)
239 """
240 type._doc_additional = [id_string_doc]
241 _build_doc(type)
242