3 # bioperl module for Bio::Structure::Model
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Kris Boulez <kris.boulez@algonomics.com>
9 # Copyright Kris Boulez
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
17 Bio::Structure::Model - Bioperl structure Object, describes a Model
25 This object stores a Bio::Structure::Chain
31 User feedback is an integral part of the evolution of this and other
32 Bioperl modules. Send your comments and suggestions preferably to one
33 of the Bioperl mailing lists. Your participation is much appreciated.
35 bioperl-l@bioperl.org - General discussion
36 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
40 Please direct usage questions or support issues to the mailing list:
42 L<bioperl-l@bioperl.org>
44 rather than to the module maintainer directly. Many experienced and
45 reponsive experts will be able look at the problem and quickly
46 address it. Please include a thorough description of the problem
47 with code and data examples if at all possible.
51 Report bugs to the Bioperl bug tracking system to help us keep track
52 the bugs and their resolution. Bug reports can be submitted via the web:
54 http://bugzilla.open-bio.org/
56 =head1 AUTHOR - Kris Boulez
58 Email kris.boulez@algonomics.com
62 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
67 # Let the code begin...
69 package Bio
::Structure
::Model
;
72 use Bio
::Structure
::Entry
;
73 use Bio
::Structure
::Chain
;
74 use base
qw(Bio::Root::Root);
80 Usage : $struc = Bio::Structure::Model->new(
84 Function: Returns a new Bio::Structure::Model object from basic
85 constructors. Probably most called from Bio::Structure::IO.
86 Returns : a new Bio::Structure::Model object
93 my ($class, @args) = @_;
94 my $self = $class->SUPER::new
(@args);
96 my($id, $chain, $residue ) =
97 $self->_rearrange([qw(
104 $id && $self->id($id);
106 $chain && $self->throw("you have to add chain via an Entry object\n");
108 $residue && $self->throw("you have to add residues via an Entry object\n");
119 Function: will eventually allow parent/child navigation not via an Entry object
126 my ($self,$value) = @_;
128 $self->throw("go via an Entry object\n");
136 Function: will eventually allow parent/child navigation not via an Entry object
143 my ($self,$value) = @_;
145 $self->throw("go via an Entry object for now\n");
152 Function: will eventually allow parent/child navigation not via an Entry object
161 $self->throw("Model::entry go via an Entry object please\n");
168 Usage : $model->id("model 5")
169 Function: Gets/sets the ID for this model
176 my ($self, $value) = @_;;
177 if (defined $value) {
178 $self->{'id'} = $value;
180 return $self->{'id'};
187 Function: will eventually allow parent/child navigation not via an Entry object
194 my ($self, @args) = @_;
196 $self->throw("need to go via Entry object or learn symbolic refs\n");
204 Function: will eventually allow parent/child navigation not via an Entry object
211 my ($self, @args) = @_;
213 $self->throw("go via entry->add_residue(chain, residue)\n");
221 # no specific DESTROY for now
225 # from here on only private methods
228 =head2 _remove_chains()
230 Title : _remove_chains
232 Function: Removes the chains attached to a Model. Tells the chains they
233 don't belong to this Model any more
242 $self->throw("use Entry methods pleae\n");
246 =head2 _remove_entry()
248 Title : _remove_entry
250 Function: Removes the Entry this Model is atttached to.
259 $self->throw("use a method based on an Entry object\n");
263 =head2 _create_default_chain()
265 Title : _create_default_chain
267 Function: Creates a default Chain for this Model. Typical situation
268 in an X-ray structure where there is only one chain
274 sub _create_default_chain
{
277 my $chain = Bio
::Structure
::Chain
->new(-id
=> "default");
281 =head2 _grandparent()
285 Function: get/set a symbolic reference to our grandparent
292 my($self,$symref) = @_;
295 $self->throw("Thou shall only pass strings in here, no references $symref\n");
297 if (defined $symref) {
298 $self->{'grandparent'} = $symref;
300 return $self->{'grandparent'};