File Coverage

Bio/Structure/Chain.pm
Criterion Covered Total %
statement 24 40 60.0
branch 5 10 50.0
condition n/a
subroutine 7 13 53.8
pod 5 5 100.0
total 41 68 60.2


line stmt bran cond sub pod time code
1             #
2             # bioperl module for Bio::Structure::Chain
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Kris Boulez
7             #
8             # Copyright Kris Boulez
9             #
10             # You may distribute this module under the same terms as perl itself
11              
12             # POD documentation - main docs before the code
13              
14             =head1 NAME
15              
16             Bio::Structure::Chain - Bioperl structure Object, describes a chain
17              
18             =head1 SYNOPSIS
19              
20             #add synopsis here
21              
22             =head1 DESCRIPTION
23              
24             This object stores a Bio::Structure::Chain
25              
26             =head1 FEEDBACK
27              
28             =head2 Mailing Lists
29              
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.
33              
34             bioperl-l@bioperl.org - General discussion
35             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36              
37             =head2 Support
38              
39             Please direct usage questions or support issues to the mailing list:
40              
41             I
42              
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.
47              
48             =head2 Reporting Bugs
49              
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:
52              
53             https://github.com/bioperl/bioperl-live/issues
54              
55             =head1 AUTHOR - Kris Boulez
56              
57             Email kris.boulez@algonomics.com
58              
59             =head1 APPENDIX
60              
61             The rest of the documentation details each of the object methods.
62             Internal methods are usually preceded with a _
63              
64             =cut
65              
66              
67             # Let the code begin...
68              
69             package Bio::Structure::Chain;
70 2     2   6 use strict;
  2         2  
  2         45  
71              
72 2     2   6 use Bio::Structure::Entry;
  2         3  
  2         23  
73 2     2   5 use Bio::Structure::Model;
  2         13  
  2         37  
74 2     2   7 use base qw(Bio::Root::Root);
  2         2  
  2         835  
75              
76              
77             =head2 new()
78              
79             Title : new()
80             Usage : $struc = Bio::Structure::Chain->new(
81             -id => 'human_id',
82             -accession_number => 'AL000012',
83             );
84              
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
88              
89             =cut
90              
91             sub new {
92 9     9 1 334 my ($class, @args) = @_;
93 9         38 my $self = $class->SUPER::new(@args);
94              
95 9         48 my($id, $residue ) =
96             $self->_rearrange([qw(
97             ID
98             RESIDUE
99             )],
100             @args);
101              
102 9 100       24 $id && $self->id($id);
103 9         31 $self->{'residue'} = [];
104             # the 'smallest' item that can be added to a chain is a residue.
105 9 50       17 $residue && $self->throw("use a method based on an Entry object for now");
106 9         24 return $self;
107             }
108              
109              
110              
111             =head2 residue()
112              
113             Title : residue
114             Usage :
115             Function: nothing useful until I get symbolic references to do what I want
116             Returns :
117             Args :
118              
119             =cut
120              
121             sub residue {
122 0     0 1 0 my ($self,$value) = @_;
123              
124 0         0 $self->throw("use a method on an Entry object to do what you want");
125             }
126              
127              
128             =head2 add_residue()
129              
130             Title : add_residue
131             Usage :
132             Function: nothing useful until I get symbolic references to do what I want
133             Returns :
134             Args :
135              
136             =cut
137              
138             sub add_residue {
139 0     0 1 0 my($self,$value) = @_;
140              
141 0         0 $self->throw("you want entry->add_residue(chain, residue)\n");
142             }
143              
144             =head2 model()
145              
146             Title : model
147             Usage :
148             Function: nothing useful until I get symbolic references to do what I want
149             Returns :
150             Args :
151              
152             =cut
153              
154             sub model {
155 0     0 1 0 my($self, $value) = @_;
156              
157 0         0 $self->throw("go via a Entry object please\n");
158             }
159              
160              
161             =head2 id()
162              
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
168              
169             =cut
170              
171             sub id {
172 18     18 1 31 my ($self, $value) = @_;;
173 18 100       40 if (defined $value) {
174 6         17 $self->{'id'} = $value;
175             }
176 18         53 return $self->{'id'};
177             }
178              
179              
180             sub DESTROY {
181 9     9   23 my $self = shift;
182            
183             # no specific destruction for now
184             }
185              
186              
187             #
188             # from here on only private methods
189             #
190              
191             =head2 _remove_residues()
192              
193             Title : _remove_residues
194             Usage :
195             Function:
196             Returns :
197             Args :
198              
199             =cut
200              
201             sub _remove_residues {
202 0     0     my ($self) = shift;
203              
204 0           $self->throw("nothing usefull in here, go see Entry\n");
205             }
206              
207              
208             =head2 _remove_model()
209              
210             Title : _remove_model
211             Usage :
212             Function: Removes the Model this Chain is atttached to.
213             Returns :
214             Args :
215              
216             =cut
217              
218             sub _remove_model {
219 0     0     my ($self) = shift;
220              
221 0           $self->throw("go see an Entry object, nothing here\n");
222             }
223              
224              
225             =head2 _grandparent()
226              
227             Title : _grandparent
228             Usage :
229             Function: get/set a symbolic reference to our grandparent
230             Returns :
231             Args :
232              
233             =cut
234              
235             sub _grandparent {
236 0     0     my($self,$symref) = @_;
237              
238 0 0         if (ref($symref)) {
239 0           $self->throw("Thou shall only pass strings in here, no references $symref\n");
240             }
241 0 0         if (defined $symref) {
242 0           $self->{'grandparent'} = $symref;
243             }
244 0           return $self->{'grandparent'};
245             }
246              
247             1;