1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import sys
24
25 import help
26
27
30
31 self.__relax_help__ = \
32 """Class for unselecting residues."""
33
34
35 self.__relax_help__ = self.__relax_help__ + "\n" + help.relax_class_help
36
37
38 self.__relax__ = relax
39
40
41 - def all(self, run=None):
42 """Function for unselecting all residues.
43
44 Keyword Arguments
45 ~~~~~~~~~~~~~~~~~
46
47 run: The name of the run(s). By supplying a single string, array of strings, or None, a
48 single run, multiple runs, or all runs will be selected respectively.
49
50
51 Examples
52 ~~~~~~~~
53
54 To unselect all residues type:
55
56 relax> unselect.all()
57
58
59 To unselect all residues for the run 'srls_m1', type:
60
61 relax> select.all('srls_m1')
62 relax> select.all(run='srls_m1')
63 """
64
65
66 if self.__relax__.interpreter.intro:
67 text = sys.ps3 + "unselect.all("
68 text = text + "run=" + `run` + ")"
69 print text
70
71
72 if run != None and type(run) != str and type(run) != list:
73 raise RelaxNoneStrListError, ('run', run)
74 if type(run) == list:
75 for i in xrange(len(run)):
76 if type(run[i]) != str:
77 raise RelaxListStrError, ('run', run)
78
79
80 self.__relax__.generic.selection.unsel_all(run=run)
81
82
83 - def read(self, run=None, file=None, dir=None, change_all=0, column=0):
84 """Function for unselecting the residues contained in a file.
85
86 Keyword Arguments
87 ~~~~~~~~~~~~~~~~~
88
89 run: The name of the run(s). By supplying a single string, array of strings, or None, a
90 single run, multiple runs, or all runs will be selected respectively.
91
92 file: The name of the file containing the list of residues to unselect.
93
94 dir: The directory where the file is located.
95
96 change_all: A flag specifying if all other residues should be changed.
97
98 column: The column containing the residue numbers (defaulting to 0, the first column).
99
100
101 Description
102 ~~~~~~~~~~~
103
104 Empty lines and lines beginning with a hash are ignored.
105
106 The 'change_all' flag argument default is zero meaning that all residues currently either
107 selected or unselected will remain that way. Setting the argument to 1 will cause all
108 residues not specified in the file to be selected.
109
110
111 Examples
112 ~~~~~~~~
113
114 To unselect all overlapped residues in the file 'unresolved', type:
115
116 relax> unselect.read('noe', 'unresolved')
117 relax> unselect.read(run='noe', file='unresolved')
118
119 To unselect the residues in the second column of the relaxation data file 'r1.600' while
120 selecting all other residues, type one of:
121
122 relax> unselect.read('test', 'r1.600', change_all=1, column=1)
123 relax> unselect.read(run='test', file='r1.600', change_all=1, column=1)
124 """
125
126
127 if self.__relax__.interpreter.intro:
128 text = sys.ps3 + "unselect.read("
129 text = text + "run=" + `run`
130 text = text + ", file=" + `file`
131 text = text + ", dir=" + `dir`
132 text = text + ", change_all=" + `change_all`
133 text = text + ", column=" + `column` + ")"
134 print text
135
136
137 if run != None and type(run) != str and type(run) != list:
138 raise RelaxNoneStrListError, ('run', run)
139 if type(run) == list:
140 for i in xrange(len(run)):
141 if type(run[i]) != str:
142 raise RelaxListStrError, ('run', run)
143
144
145 if type(file) != str:
146 raise RelaxStrError, ('file name', file)
147
148
149 if dir != None and type(dir) != str:
150 raise RelaxNoneStrError, ('directory name', dir)
151
152
153 if type(change_all) != int or (change_all != 0 and change_all != 1):
154 raise RelaxBinError, ('change_all', change_all)
155
156
157 if type(column) != int:
158 raise RelaxIntError, ('residue number column', column)
159
160
161 self.__relax__.generic.selection.unsel_read(run=run, file=file, dir=dir, change_all=change_all, column=column)
162
163
164 - def res(self, run=None, num=None, name=None, change_all=0):
165 """Function for unselecting specific residues.
166
167 Keyword Arguments
168 ~~~~~~~~~~~~~~~~~
169
170 run: The name of the run(s). By supplying a single string, array of strings, or None, a
171 single run, multiple runs, or all runs will be selected respectively.
172
173 num: The residue number.
174
175 name: The residue name.
176
177 change_all: A flag specifying if all other residues should be changed.
178
179
180 Description
181 ~~~~~~~~~~~
182
183 The residue number can be either an integer for unselecting a single residue or a python
184 regular expression, in string form, for unselecting multiple residues. For details about
185 using regular expression, see the python documentation for the module 're'.
186
187 The residue name argument must be a string. Regular expression is also allowed.
188
189 The 'change_all' flag argument default is zero meaning that all residues currently either
190 selected or unselected will remain that way. Setting the argument to 1 will cause all
191 residues not specified by 'num' or 'name' to become selected.
192
193
194 Examples
195 ~~~~~~~~
196
197 To unselect all glycines for the run 'm5', type:
198
199 relax> unselect.res(run='m5', name='GLY|ALA')
200 relax> unselect.res(run='m5', name='[GA]L[YA]')
201
202 To unselect residue 12 MET type:
203
204 relax> unselect.res('m5', 12)
205 relax> unselect.res('m5', 12, 'MET')
206 relax> unselect.res('m5', '12')
207 relax> unselect.res('m5', '12', 'MET')
208 relax> unselect.res(run='m5', num='12', name='MET')
209 """
210
211
212 if self.__relax__.interpreter.intro:
213 text = sys.ps3 + "unselect.res("
214 text = text + "run=" + `run`
215 text = text + ", num=" + `num`
216 text = text + ", name=" + `name`
217 text = text + ", change_all=" + `change_all` + ")"
218 print text
219
220
221 if run != None and type(run) != str and type(run) != list:
222 raise RelaxNoneStrListError, ('run', run)
223 if type(run) == list:
224 for i in xrange(len(run)):
225 if type(run[i]) != str:
226 raise RelaxListStrError, ('run', run)
227
228
229 if num != None and type(num) != int and type(num) != str:
230 raise RelaxNoneIntStrError, ('residue number', num)
231
232
233 if name != None and type(name) != str:
234 raise RelaxNoneStrError, ('residue name', name)
235
236
237 if num == None and name == None:
238 raise RelaxError, "At least one of the number or name arguments is required."
239
240
241 if type(change_all) != int or (change_all != 0 and change_all != 1):
242 raise RelaxBinError, ('change_all', change_all)
243
244
245 self.__relax__.generic.selection.unsel_res(run=run, num=num, name=name, change_all=change_all)
246
247
249 """Function for the reversal of the residue selection.
250
251 Keyword Arguments
252 ~~~~~~~~~~~~~~~~~
253
254 run: The name of the run(s). By supplying a single string, array of strings, or None, a
255 single run, multiple runs, or all runs will be selected respectively.
256
257
258 Examples
259 ~~~~~~~~
260
261 To unselect all currently selected residues and select those which are unselected type:
262
263 relax> unselect.reverse()
264 """
265
266
267 if self.__relax__.interpreter.intro:
268 text = sys.ps3 + "unselect.reverse("
269 text = text + "run=" + `run` + ")"
270 print text
271
272
273 if run != None and type(run) != str and type(run) != list:
274 raise RelaxNoneStrListError, ('run', run)
275 if type(run) == list:
276 for i in xrange(len(run)):
277 if type(run[i]) != str:
278 raise RelaxListStrError, ('run', run)
279
280
281 self.__relax__.generic.selection.reverse(run=run)
282