0
|
1 # $Id: Model.pm,v 1.6 2002/10/22 07:38:44 lapp Exp $
|
|
2 #
|
|
3 # bioperl module for Bio::Structure::Model
|
|
4 #
|
|
5 # Cared for by Kris Boulez <kris.boulez@algonomics.com>
|
|
6 #
|
|
7 # Copyright Kris Boulez
|
|
8 #
|
|
9 # You may distribute this module under the same terms as perl itself
|
|
10
|
|
11 # POD documentation - main docs before the code
|
|
12
|
|
13 =head1 NAME
|
|
14
|
|
15 Bio::Structure::Model - Bioperl structure Object, describes a Model
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 #add synopsis here
|
|
20
|
|
21 =head1 DESCRIPTION
|
|
22
|
|
23 This object stores a Bio::Structure::Chain
|
|
24
|
|
25 =head1 FEEDBACK
|
|
26
|
|
27 =head2 Mailing Lists
|
|
28
|
|
29 User feedback is an integral part of the evolution of this and other
|
|
30 Bioperl modules. Send your comments and suggestions preferably to one
|
|
31 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
32
|
|
33 bioperl-l@bioperl.org - General discussion
|
|
34 http://bio.perl.org/MailList.html - About the mailing lists
|
|
35
|
|
36 =head2 Reporting Bugs
|
|
37
|
|
38 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
39 the bugs and their resolution. Bug reports can be submitted via email
|
|
40 or the web:
|
|
41
|
|
42 bioperl-bugs@bio.perl.org
|
|
43 http://bugzilla.bioperl.org/
|
|
44
|
|
45 =head1 AUTHOR - Kris Boulez
|
|
46
|
|
47 Email kris.boulez@algonomics.com
|
|
48
|
|
49 =head1 APPENDIX
|
|
50
|
|
51 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
|
|
52
|
|
53 =cut
|
|
54
|
|
55
|
|
56 # Let the code begin...
|
|
57
|
|
58 package Bio::Structure::Model;
|
|
59 use vars qw(@ISA);
|
|
60 use strict;
|
|
61
|
|
62 use Bio::Root::Root;
|
|
63 use Bio::Structure::Entry;
|
|
64 use Bio::Structure::Chain;
|
|
65 @ISA = qw(Bio::Root::Root);
|
|
66
|
|
67
|
|
68 =head2 new()
|
|
69
|
|
70 Title : new()
|
|
71 Usage : $struc = Bio::Structure::Model->new(
|
|
72 -id => 'human_id',
|
|
73 );
|
|
74
|
|
75 Function: Returns a new Bio::Structure::Model object from basic
|
|
76 constructors. Probably most called from Bio::Structure::IO.
|
|
77 Returns : a new Bio::Structure::Model object
|
|
78
|
|
79 =cut
|
|
80
|
|
81
|
|
82
|
|
83 sub new {
|
|
84 my ($class, @args) = @_;
|
|
85 my $self = $class->SUPER::new(@args);
|
|
86
|
|
87 my($id, $chain, $residue ) =
|
|
88 $self->_rearrange([qw(
|
|
89 ID
|
|
90 CHAIN
|
|
91 RESIDUE
|
|
92 )],
|
|
93 @args);
|
|
94
|
|
95 $id && $self->id($id);
|
|
96
|
|
97 $chain && $self->throw("you have to add chain via an Entry object\n");
|
|
98
|
|
99 $residue && $self->throw("you have to add residues via an Entry object\n");
|
|
100
|
|
101 return $self;
|
|
102 }
|
|
103
|
|
104
|
|
105
|
|
106 =head2 chain()
|
|
107
|
|
108 Title : chain
|
|
109 Usage :
|
|
110 Function: will eventually allow parent/child navigation not via an Entry object
|
|
111 Returns :
|
|
112 Args :
|
|
113
|
|
114 =cut
|
|
115
|
|
116 sub chain {
|
|
117 my ($self,$value) = @_;
|
|
118
|
|
119 $self->throw("go via an Entry object\n");
|
|
120 }
|
|
121
|
|
122
|
|
123 =head2 add_chain()
|
|
124
|
|
125 Title : add_chain
|
|
126 Usage :
|
|
127 Function: will eventually allow parent/child navigation not via an Entry object
|
|
128 Returns :
|
|
129 Args :
|
|
130
|
|
131 =cut
|
|
132
|
|
133 sub add_chain {
|
|
134 my ($self,$value) = @_;
|
|
135
|
|
136 $self->throw("go via an Entry object for now\n");
|
|
137 }
|
|
138
|
|
139 =head2 entry()
|
|
140
|
|
141 Title : entry
|
|
142 Usage :
|
|
143 Function: will eventually allow parent/child navigation not via an Entry object
|
|
144 Returns :
|
|
145 Args :
|
|
146
|
|
147 =cut
|
|
148
|
|
149 sub entry {
|
|
150 my($self) = @_;
|
|
151
|
|
152 $self->throw("Model::entry go via an Entry object please\n");
|
|
153 }
|
|
154
|
|
155
|
|
156 =head2 id()
|
|
157
|
|
158 Title : id
|
|
159 Usage : $model->id("model 5")
|
|
160 Function: Gets/sets the ID for this model
|
|
161 Returns : the ID
|
|
162 Args : the ID
|
|
163
|
|
164 =cut
|
|
165
|
|
166 sub id {
|
|
167 my ($self, $value) = @_;;
|
|
168 if (defined $value) {
|
|
169 $self->{'id'} = $value;
|
|
170 }
|
|
171 return $self->{'id'};
|
|
172 }
|
|
173
|
|
174 =head2 residue()
|
|
175
|
|
176 Title : residue
|
|
177 Usage :
|
|
178 Function: will eventually allow parent/child navigation not via an Entry object
|
|
179 Returns :
|
|
180 Args :
|
|
181
|
|
182 =cut
|
|
183
|
|
184 sub residue {
|
|
185 my ($self, @args) = @_;
|
|
186
|
|
187 $self->throw("need to go via Entry object or learn symbolic refs\n");
|
|
188 }
|
|
189
|
|
190
|
|
191 =head2 add_residue()
|
|
192
|
|
193 Title : add_residue
|
|
194 Usage :
|
|
195 Function: will eventually allow parent/child navigation not via an Entry object
|
|
196 Returns :
|
|
197 Args :
|
|
198
|
|
199 =cut
|
|
200
|
|
201 sub add_residue {
|
|
202 my ($self, @args) = @_;
|
|
203
|
|
204 $self->throw("go via entry->add_residue(chain, residue)\n");
|
|
205 }
|
|
206
|
|
207
|
|
208
|
|
209 sub DESTROY {
|
|
210 my $self = shift;
|
|
211
|
|
212 # no specific DESTROY for now
|
|
213 }
|
|
214
|
|
215 #
|
|
216 # from here on only private methods
|
|
217 #
|
|
218
|
|
219 =head2 _remove_chains()
|
|
220
|
|
221 Title : _remove_chains
|
|
222 Usage :
|
|
223 Function: Removes the chains attached to a Model. Tells the chains they
|
|
224 don't belong to this Model any more
|
|
225 Returns :
|
|
226 Args :
|
|
227
|
|
228 =cut
|
|
229
|
|
230 sub _remove_chains {
|
|
231 my ($self) = shift;
|
|
232
|
|
233 $self->throw("use Entry methods pleae\n");
|
|
234 }
|
|
235
|
|
236
|
|
237 =head2 _remove_entry()
|
|
238
|
|
239 Title : _remove_entry
|
|
240 Usage :
|
|
241 Function: Removes the Entry this Model is atttached to.
|
|
242 Returns :
|
|
243 Args :
|
|
244
|
|
245 =cut
|
|
246
|
|
247 sub _remove_entry {
|
|
248 my ($self) = shift;
|
|
249
|
|
250 $self->throw("use a method based on an Entry object\n");
|
|
251 }
|
|
252
|
|
253
|
|
254 =head2 _create_default_chain()
|
|
255
|
|
256 Title : _create_default_chain
|
|
257 Usage :
|
|
258 Function: Creates a default Chain for this Model. Typical situation
|
|
259 in an X-ray structure where there is only one chain
|
|
260 Returns :
|
|
261 Args :
|
|
262
|
|
263 =cut
|
|
264
|
|
265 sub _create_default_chain {
|
|
266 my ($self) = shift;
|
|
267
|
|
268 my $chain = Bio::Structure::Chain->new(-id => "default");
|
|
269 }
|
|
270
|
|
271
|
|
272 =head2 _grandparent()
|
|
273
|
|
274 Title : _grandparent
|
|
275 Usage :
|
|
276 Function: get/set a symbolic reference to our grandparent
|
|
277 Returns :
|
|
278 Args :
|
|
279
|
|
280 =cut
|
|
281
|
|
282 sub _grandparent {
|
|
283 my($self,$symref) = @_;
|
|
284
|
|
285 if (ref($symref)) {
|
|
286 $self->throw("Thou shall only pass strings in here, no references $symref\n");
|
|
287 }
|
|
288 if (defined $symref) {
|
|
289 $self->{'grandparent'} = $symref;
|
|
290 }
|
|
291 return $self->{'grandparent'};
|
|
292 }
|
|
293
|
|
294 1;
|