Sync README and README.md
[bioperl-live.git] / Bio / Structure / Chain.pm
blob8aad7207b1443a9c374b066709408406272b4b01
2 # bioperl module for Bio::Structure::Chain
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Kris Boulez <kris.boulez@algonomics.com>
8 # Copyright Kris Boulez
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Structure::Chain - Bioperl structure Object, describes a chain
18 =head1 SYNOPSIS
20 #add synopsis here
22 =head1 DESCRIPTION
24 This object stores a Bio::Structure::Chain
26 =head1 FEEDBACK
28 =head2 Mailing Lists
30 User feedback is an integral part of the evolution of this and other
31 Bioperl modules. Send your comments and suggestions preferably to one
32 of the Bioperl mailing lists. Your participation is much appreciated.
34 bioperl-l@bioperl.org - General discussion
35 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
37 =head2 Support
39 Please direct usage questions or support issues to the mailing list:
41 I<bioperl-l@bioperl.org>
43 rather than to the module maintainer directly. Many experienced and
44 reponsive experts will be able look at the problem and quickly
45 address it. Please include a thorough description of the problem
46 with code and data examples if at all possible.
48 =head2 Reporting Bugs
50 Report bugs to the Bioperl bug tracking system to help us keep track
51 the bugs and their resolution. Bug reports can be submitted via the web:
53 https://github.com/bioperl/bioperl-live/issues
55 =head1 AUTHOR - Kris Boulez
57 Email kris.boulez@algonomics.com
59 =head1 APPENDIX
61 The rest of the documentation details each of the object methods.
62 Internal methods are usually preceded with a _
64 =cut
67 # Let the code begin...
69 package Bio::Structure::Chain;
70 use strict;
72 use Bio::Structure::Entry;
73 use Bio::Structure::Model;
74 use base qw(Bio::Root::Root);
77 =head2 new()
79 Title : new()
80 Usage : $struc = Bio::Structure::Chain->new(
81 -id => 'human_id',
82 -accession_number => 'AL000012',
85 Function: Returns a new Bio::Structure::Chain object from basic
86 constructors. Usually called from Bio::Structure::IO.
87 Returns : a new Bio::Structure::Chain object
89 =cut
91 sub new {
92 my ($class, @args) = @_;
93 my $self = $class->SUPER::new(@args);
95 my($id, $residue ) =
96 $self->_rearrange([qw(
98 RESIDUE
99 )],
100 @args);
102 $id && $self->id($id);
103 $self->{'residue'} = [];
104 # the 'smallest' item that can be added to a chain is a residue.
105 $residue && $self->throw("use a method based on an Entry object for now");
106 return $self;
111 =head2 residue()
113 Title : residue
114 Usage :
115 Function: nothing useful until I get symbolic references to do what I want
116 Returns :
117 Args :
119 =cut
121 sub residue {
122 my ($self,$value) = @_;
124 $self->throw("use a method on an Entry object to do what you want");
128 =head2 add_residue()
130 Title : add_residue
131 Usage :
132 Function: nothing useful until I get symbolic references to do what I want
133 Returns :
134 Args :
136 =cut
138 sub add_residue {
139 my($self,$value) = @_;
141 $self->throw("you want entry->add_residue(chain, residue)\n");
144 =head2 model()
146 Title : model
147 Usage :
148 Function: nothing useful until I get symbolic references to do what I want
149 Returns :
150 Args :
152 =cut
154 sub model {
155 my($self, $value) = @_;
157 $self->throw("go via a Entry object please\n");
161 =head2 id()
163 Title : id
164 Usage : $chain->id("chain B")
165 Function: Gets/sets the ID for this chain
166 Returns : the ID
167 Args : the ID
169 =cut
171 sub id {
172 my ($self, $value) = @_;;
173 if (defined $value) {
174 $self->{'id'} = $value;
176 return $self->{'id'};
180 sub DESTROY {
181 my $self = shift;
183 # no specific destruction for now
188 # from here on only private methods
191 =head2 _remove_residues()
193 Title : _remove_residues
194 Usage :
195 Function:
196 Returns :
197 Args :
199 =cut
201 sub _remove_residues {
202 my ($self) = shift;
204 $self->throw("nothing usefull in here, go see Entry\n");
208 =head2 _remove_model()
210 Title : _remove_model
211 Usage :
212 Function: Removes the Model this Chain is atttached to.
213 Returns :
214 Args :
216 =cut
218 sub _remove_model {
219 my ($self) = shift;
221 $self->throw("go see an Entry object, nothing here\n");
225 =head2 _grandparent()
227 Title : _grandparent
228 Usage :
229 Function: get/set a symbolic reference to our grandparent
230 Returns :
231 Args :
233 =cut
235 sub _grandparent {
236 my($self,$symref) = @_;
238 if (ref($symref)) {
239 $self->throw("Thou shall only pass strings in here, no references $symref\n");
241 if (defined $symref) {
242 $self->{'grandparent'} = $symref;
244 return $self->{'grandparent'};