0
|
1 # $Id: Residue.pm,v 1.7 2002/10/22 07:38:44 lapp Exp $
|
|
2 #
|
|
3 # bioperl module for Bio::Structure::Residue
|
|
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::Residue - Bioperl structure Object, describes a Residue
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 #add synopsis here
|
|
20
|
|
21 =head1 DESCRIPTION
|
|
22
|
|
23 This object stores a Bio::Structure::Residue
|
|
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
|
|
59 package Bio::Structure::Residue;
|
|
60 use vars qw(@ISA);
|
|
61 use strict;
|
|
62
|
|
63 use Bio::Root::Root;
|
|
64 use Bio::Structure::Chain;
|
|
65 use Bio::Structure::Atom;
|
|
66 @ISA = qw(Bio::Root::Root);
|
|
67
|
|
68
|
|
69 =head2 new()
|
|
70
|
|
71 Title : new()
|
|
72 Usage : $residue = Bio::Structure::Residue->new(
|
|
73 -id => 'human_id',
|
|
74 );
|
|
75
|
|
76 Function: Returns a new Bio::Structure::Residue object from basic
|
|
77 constructors. Probably most called from Bio::Structure::IO.
|
|
78 Returns : a new Bio::Structure::Residue object
|
|
79
|
|
80 =cut
|
|
81
|
|
82
|
|
83 sub new {
|
|
84 my ($class, @args) = @_;
|
|
85 my $self = $class->SUPER::new(@args);
|
|
86
|
|
87 my($id, $atom ) =
|
|
88 $self->_rearrange([qw(
|
|
89 ID
|
|
90 ATOM
|
|
91 )],
|
|
92 @args);
|
|
93
|
|
94 $id && $self->id($id);
|
|
95
|
|
96 $self->{'atom'} = [];
|
|
97
|
|
98 # the 'smallest' (and only) item that can be added to a residue is an atom
|
|
99
|
|
100 $atom && $self->throw("add atoms via an Entry object entry->add_atom(residue,atom)\n");
|
|
101
|
|
102 return $self;
|
|
103 }
|
|
104
|
|
105
|
|
106
|
|
107 =head2 atom()
|
|
108
|
|
109 Title : atom
|
|
110 Usage :
|
|
111 Function: nothing usefull untill I get symbolic references to do what I want
|
|
112 Returns :
|
|
113 Args :
|
|
114
|
|
115 =cut
|
|
116
|
|
117 sub atom {
|
|
118 my ($self,$value) = @_;
|
|
119
|
|
120 $self->throw("no code down here, go see an Entry object nearby\n");
|
|
121 }
|
|
122
|
|
123
|
|
124 =head2 add_atom()
|
|
125
|
|
126 Title : add_atom
|
|
127 Usage :
|
|
128 Function: nothing usefull untill I get symbolic references to do what I want
|
|
129 Returns :
|
|
130 Args :
|
|
131
|
|
132 =cut
|
|
133
|
|
134 sub add_atom {
|
|
135 my($self,$value) = @_;
|
|
136
|
|
137 $self->throw("nothing here, use a method on an Entry object\n");
|
|
138 }
|
|
139
|
|
140
|
|
141 =head2 chain()
|
|
142
|
|
143 Title : chain
|
|
144 Usage : $chain = $residue->chain($chain)
|
|
145 Function: Sets the Chain this Residue belongs to
|
|
146 Returns : Returns the Chain this Residue belongs to
|
|
147 Args : reference to a Chain
|
|
148
|
|
149 =cut
|
|
150
|
|
151 sub chain {
|
|
152 my($self, $value) = @_;
|
|
153
|
|
154 $self->throw("use an Entry based method please\n");
|
|
155 }
|
|
156
|
|
157
|
|
158 =head2 id()
|
|
159
|
|
160 Title : id
|
|
161 Usage : $residue->id("TRP-35")
|
|
162 Function: Gets/sets the ID for this residue
|
|
163 Returns : the ID
|
|
164 Args : the ID
|
|
165
|
|
166 =cut
|
|
167
|
|
168 sub id {
|
|
169 my ($self, $value) = @_;;
|
|
170 if (defined $value) {
|
|
171 $self->{'id'} = $value;
|
|
172 }
|
|
173 return $self->{'id'};
|
|
174 }
|
|
175
|
|
176
|
|
177 =head2 DESTROY()
|
|
178
|
|
179 Title : DESTROY
|
|
180 Usage :
|
|
181 Function: destructor ( get rid of circular references )
|
|
182 Returns :
|
|
183 Args :
|
|
184
|
|
185 =cut
|
|
186
|
|
187 sub DESTROY {
|
|
188 my $self = shift;
|
|
189
|
|
190 # no specific destruction for now
|
|
191 }
|
|
192
|
|
193
|
|
194 #
|
|
195 # from here on only private methods
|
|
196 #
|
|
197
|
|
198 =head2 _remove_atoms()
|
|
199
|
|
200 Title : _remove_atoms
|
|
201 Usage :
|
|
202 Function: Removes the atoms attached to a Residue. Tells the atoms they
|
|
203 don't belong to this Residue any more
|
|
204 Returns :
|
|
205 Args :
|
|
206
|
|
207 =cut
|
|
208
|
|
209 sub _remove_atoms {
|
|
210 my ($self) = shift;
|
|
211
|
|
212 $self->throw("no code here\n");
|
|
213 }
|
|
214
|
|
215
|
|
216 =head2 _remove_chain()
|
|
217
|
|
218 Title : _remove_chain
|
|
219 Usage :
|
|
220 Function: Removes the Chain this Residue is atttached to.
|
|
221 Returns :
|
|
222 Args :
|
|
223
|
|
224 =cut
|
|
225
|
|
226 sub _remove_chain {
|
|
227 my ($self) = shift;
|
|
228
|
|
229 $self->{'chain'} = undef;
|
|
230 }
|
|
231
|
|
232
|
|
233 =head2 _grandparent()
|
|
234
|
|
235 Title : _grandparent
|
|
236 Usage :
|
|
237 Function: get/set a symbolic reference to our grandparent
|
|
238 Returns :
|
|
239 Args :
|
|
240
|
|
241 =cut
|
|
242
|
|
243 sub _grandparent {
|
|
244 my($self,$symref) = @_;
|
|
245
|
|
246 if (ref($symref)) {
|
|
247 $self->throw("Thou shall only pass strings in here, no references $symref\n");
|
|
248 }
|
|
249 if (defined $symref) {
|
|
250 $self->{'grandparent'} = $symref;
|
|
251 }
|
|
252 return $self->{'grandparent'};
|
|
253 }
|
|
254
|
|
255 1;
|