0
|
1 # $Id: Chain.pm,v 1.6 2002/10/22 07:38:44 lapp Exp $
|
|
2 #
|
|
3 # bioperl module for Bio::Structure::Chain
|
|
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::Chain - Bioperl structure Object, describes a chain
|
|
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::Chain;
|
|
59 use vars qw(@ISA);
|
|
60 use strict;
|
|
61
|
|
62 use Bio::Root::Root;
|
|
63 use Bio::Structure::Entry;
|
|
64 use Bio::Structure::Model;
|
|
65 @ISA = qw(Bio::Root::Root);
|
|
66
|
|
67
|
|
68 =head2 new()
|
|
69
|
|
70 Title : new()
|
|
71 Usage : $struc = Bio::Structure::Chain->new(
|
|
72 -id => 'human_id',
|
|
73 -accession_number => 'AL000012',
|
|
74 );
|
|
75
|
|
76 Function: Returns a new Bio::Structure::Chain object from basic
|
|
77 constructors. Probably most called from Bio::Structure::IO.
|
|
78 Returns : a new Bio::Structure::Chain object
|
|
79
|
|
80 =cut
|
|
81
|
|
82
|
|
83
|
|
84 sub new {
|
|
85 my ($class, @args) = @_;
|
|
86 my $self = $class->SUPER::new(@args);
|
|
87
|
|
88 my($id, $residue ) =
|
|
89 $self->_rearrange([qw(
|
|
90 ID
|
|
91 RESIDUE
|
|
92 )],
|
|
93 @args);
|
|
94
|
|
95 $id && $self->id($id);
|
|
96
|
|
97 $self->{'residue'} = [];
|
|
98
|
|
99 # the 'smallest' item that can be added to a chain is a residue.
|
|
100
|
|
101 $residue && $self->throw("use a method based on an Entry object for now");
|
|
102
|
|
103 return $self;
|
|
104 }
|
|
105
|
|
106
|
|
107
|
|
108 =head2 residue()
|
|
109
|
|
110 Title : residue
|
|
111 Usage :
|
|
112 Function: nothing usefull untill I get symbolic references to do what I want
|
|
113 Returns :
|
|
114 Args :
|
|
115
|
|
116 =cut
|
|
117
|
|
118 sub residue {
|
|
119 my ($self,$value) = @_;
|
|
120
|
|
121 $self->throw("use a method on an Entry object to do what you want");
|
|
122 }
|
|
123
|
|
124
|
|
125 =head2 add_residue()
|
|
126
|
|
127 Title : add_residue
|
|
128 Usage :
|
|
129 Function: nothing usefull untill I get symbolic references to do what I want
|
|
130 Returns :
|
|
131 Args :
|
|
132
|
|
133 =cut
|
|
134
|
|
135 sub add_residue {
|
|
136 my($self,$value) = @_;
|
|
137
|
|
138 $self->throw("you want entry->add_residue(chain, residue)\n");
|
|
139 }
|
|
140
|
|
141 =head2 model()
|
|
142
|
|
143 Title : model
|
|
144 Usage :
|
|
145 Function: nothing usefull untill I get symbolic references to do what I want
|
|
146 Returns :
|
|
147 Args :
|
|
148
|
|
149 =cut
|
|
150
|
|
151 sub model {
|
|
152 my($self, $value) = @_;
|
|
153
|
|
154 $self->throw("go via a Entry object please\n");
|
|
155 }
|
|
156
|
|
157
|
|
158 =head2 id()
|
|
159
|
|
160 Title : id
|
|
161 Usage : $chain->id("chain B")
|
|
162 Function: Gets/sets the ID for this chain
|
|
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 sub DESTROY {
|
|
178 my $self = shift;
|
|
179
|
|
180 # no specific destruction for now
|
|
181 }
|
|
182
|
|
183
|
|
184 #
|
|
185 # from here on only private methods
|
|
186 #
|
|
187
|
|
188 =head2 _remove_residues()
|
|
189
|
|
190 Title : _remove_residues
|
|
191 Usage :
|
|
192 Function:
|
|
193 Returns :
|
|
194 Args :
|
|
195
|
|
196 =cut
|
|
197
|
|
198 sub _remove_residues {
|
|
199 my ($self) = shift;
|
|
200
|
|
201 $self->throw("nothing usefull in here, go see Entry\n");
|
|
202 }
|
|
203
|
|
204
|
|
205 =head2 _remove_model()
|
|
206
|
|
207 Title : _remove_model
|
|
208 Usage :
|
|
209 Function: Removes the Model this Chain is atttached to.
|
|
210 Returns :
|
|
211 Args :
|
|
212
|
|
213 =cut
|
|
214
|
|
215 sub _remove_model {
|
|
216 my ($self) = shift;
|
|
217
|
|
218 $self->throw("go see an Entry object, nothing here\n");
|
|
219 }
|
|
220
|
|
221
|
|
222 =head2 _grandparent()
|
|
223
|
|
224 Title : _grandparent
|
|
225 Usage :
|
|
226 Function: get/set a symbolic reference to our grandparent
|
|
227 Returns :
|
|
228 Args :
|
|
229
|
|
230 =cut
|
|
231
|
|
232 sub _grandparent {
|
|
233 my($self,$symref) = @_;
|
|
234
|
|
235 if (ref($symref)) {
|
|
236 $self->throw("Thou shall only pass strings in here, no references $symref\n");
|
|
237 }
|
|
238 if (defined $symref) {
|
|
239 $self->{'grandparent'} = $symref;
|
|
240 }
|
|
241 return $self->{'grandparent'};
|
|
242 }
|
|
243
|
|
244
|
|
245 1;
|