0
|
1 # $Id: FeatureGroup.pm,v 1.1.2.2 2003/09/17 09:19:21 allenday Exp $
|
|
2 # BioPerl module for Bio::Expression::FeatureGroup
|
|
3 #
|
|
4 # Copyright Allen Day <allenday@ucla.edu>, Stanley Nelson <snelson@ucla.edu>
|
|
5 # Human Genetics, UCLA Medical School, University of California, Los Angeles
|
|
6
|
|
7 # POD documentation - main docs before the code
|
|
8
|
|
9 =head1 NAME
|
|
10
|
|
11 Bio::Expression::FeatureGroup - a set of DNA/RNA features. ISA
|
|
12 Bio::Expression::FeatureI
|
|
13
|
|
14 =head1 SYNOPSIS
|
|
15
|
|
16 #
|
|
17
|
|
18 =head1 DESCRIPTION
|
|
19
|
|
20 A set of DNA/RNA features.
|
|
21
|
|
22 =head1 FEEDBACK
|
|
23
|
|
24 =head2 Mailing Lists
|
|
25
|
|
26 User feedback is an integral part of the evolution of this and other
|
|
27 Bioperl modules. Send your comments and suggestions preferably to one
|
|
28 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
29
|
|
30 bioperl-l@bioperl.org - General discussion
|
|
31 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
32
|
|
33 =head2 Reporting Bugs
|
|
34
|
|
35 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
36 the bugs and their resolution.
|
|
37 Bug reports can be submitted via email or the web:
|
|
38
|
|
39 bioperl-bugs@bio.perl.org
|
|
40 http://bugzilla.bioperl.org/
|
|
41
|
|
42 =head1 AUTHOR
|
|
43
|
|
44 Allen Day E<lt>allenday@ucla.eduE<gt>
|
|
45
|
|
46 =head1 APPENDIX
|
|
47
|
|
48 The rest of the documentation details each of the object
|
|
49 methods. Internal methods are usually preceded with a _
|
|
50
|
|
51 =cut
|
|
52
|
|
53 # Let the code begin...
|
|
54 package Bio::Expression::FeatureGroup;
|
|
55
|
|
56 use strict;
|
|
57
|
|
58 use base qw(Bio::Root::Root Bio::Expression::FeatureI);
|
|
59 use vars qw($DEBUG);
|
|
60
|
|
61 =head2 new
|
|
62
|
|
63 Title : new
|
|
64 Usage : $featuregroup = Bio::Expression::FeatureGroup->new(%args);
|
|
65 Function: create a new featuregroup object
|
|
66 Returns : a Bio::Expression::FeatureGroup object
|
|
67 Args : an optional hash of parameters to be used in initialization:
|
|
68 -id -- the featuregroup ID
|
|
69 -type -- the featuregroup type
|
|
70
|
|
71 =cut
|
|
72
|
|
73 sub new {
|
|
74 my($class,@args) = @_;
|
|
75 my $self = bless {}, $class;
|
|
76 $self->_initialize(@args);
|
|
77 return $self;
|
|
78 }
|
|
79
|
|
80 =head2 _initialize
|
|
81
|
|
82 Title : _initialize
|
|
83 Usage : $featuregroup->_initialize(@args);
|
|
84 Function: initialize the featuregroup object
|
|
85 Returns : nothing
|
|
86 Args : @args
|
|
87
|
|
88 =cut
|
|
89
|
|
90 sub _initialize{
|
|
91 my ($self,@args) = @_;
|
|
92 my %param = @args;
|
|
93
|
|
94 $self->type($param{-type});
|
|
95 $self->id($param{-id} );
|
|
96
|
|
97 $self->SUPER::_initialize(@args);
|
|
98 $DEBUG = 1 if( ! defined $DEBUG && $self->verbose > 0);
|
|
99 }
|
|
100
|
|
101 =head2 type
|
|
102
|
|
103 Title : type
|
|
104 Usage : $featuregroup->type($optional_arg);
|
|
105 Function: get/set the type of the featuregroup
|
|
106 Comments: this is probably going to be a string like
|
|
107 "quality control", "mismatch blah blah", etc.
|
|
108 Returns : the featuregroup type
|
|
109 Args : a new value for the featuregroup type
|
|
110
|
|
111 =cut
|
|
112
|
|
113 sub type {
|
|
114 my $self = shift;
|
|
115 $self->{type} = shift if @_;
|
|
116 return $self->{type};
|
|
117 }
|
|
118
|
|
119 =head2 id
|
|
120
|
|
121 Title : id
|
|
122 Usage : $featuregroup->id($optional_arg);
|
|
123 Function: get/set the id of the featuregroup
|
|
124 Returns : the featuregroup id
|
|
125 Args : a new value for the featuregroup id
|
|
126
|
|
127 =cut
|
|
128
|
|
129 sub id {
|
|
130 my $self = shift;
|
|
131 $self->{id} = shift if @_;
|
|
132 return $self->{id};
|
|
133 }
|
|
134
|
|
135
|
|
136 =head2 standard_deviation
|
|
137
|
|
138 Title : standard_deviation
|
|
139 Usage : $featuregroup->standard_deviation($optional_arg);
|
|
140 Function: get/set the standard deviation of the featuregroup value
|
|
141 Returns : the featuregroup standard deviation
|
|
142 Args : a new value for the featuregroup standard deviation
|
|
143 Notes : this method does no calculation, it merely holds a value
|
|
144
|
|
145 =cut
|
|
146
|
|
147 sub standard_deviation {
|
|
148 my $self = shift;
|
|
149 $self->{standard_deviation} = shift if @_;
|
|
150 return $self->{standard_deviation};
|
|
151 }
|
|
152
|
|
153 =head2 quantitation
|
|
154
|
|
155 Title : quantitation
|
|
156 Usage : $featuregroup->quantitation($optional_arg);
|
|
157 Function: get/set the quantitation of the featuregroup
|
|
158 Returns : the featuregroup's quantitated value
|
|
159 Args : a new value for the featuregroup's quantitated value
|
|
160 Notes : this method does no calculation, it merely holds a value
|
|
161
|
|
162 =cut
|
|
163
|
|
164 sub quantitation {
|
|
165 my $self = shift;
|
|
166 $self->{quantitation} = shift if @_;
|
|
167 return $self->{quantitation};
|
|
168 }
|
|
169
|
|
170 =head2 quantitation_units
|
|
171
|
|
172 Title : quantitation_units
|
|
173 Usage : $featuregroup->quantitation_units($optional_arg);
|
|
174 Function: get/set the quantitation units of the featuregroup
|
|
175 Returns : the featuregroup's quantitated value units
|
|
176 Args : a new value for the featuregroup's quantitated value units
|
|
177
|
|
178 =cut
|
|
179
|
|
180 sub quantitation_units {
|
|
181 my $self = shift;
|
|
182 $self->{quantitation_units} = shift if @_;
|
|
183 return $self->{quantitation_units};
|
|
184 }
|
|
185
|
|
186 =head2 presence
|
|
187
|
|
188 Title : presence
|
|
189 Usage : $featuregroup->presence($optional_arg);
|
|
190 Function: get/set the presence call of the featuregroup
|
|
191 Returns : the featuregroup's presence call
|
|
192 Args : a new value for the featuregroup's presence call
|
|
193
|
|
194 =cut
|
|
195
|
|
196 sub presence {
|
|
197 my $self = shift;
|
|
198 $self->{presence} = shift if @_;
|
|
199 return $self->{presence};
|
|
200 }
|
|
201
|
|
202 =head2 add_feature
|
|
203
|
|
204 Title : add_feature
|
|
205 Usage : $feature_copy = $featuregroup->add_feature($feature);
|
|
206 Function: add a feature to the featuregroup
|
|
207 Returns : see this_feature()
|
|
208 Args : a Bio::Expression::FeatureI compliant object
|
|
209
|
|
210 =cut
|
|
211
|
|
212 sub add_feature {
|
|
213 my($self,@args) = @_;
|
|
214 foreach my $feature (@args){
|
|
215 $self->throw('Features must be Bio::Expression::FeatureI compliant') unless $feature->isa('Bio::Expression::FeatureI');
|
|
216 push @{$self->{features}}, $feature;
|
|
217 }
|
|
218
|
|
219 return $self->{features} ? $self->{features}->[-1] : undef;
|
|
220 }
|
|
221
|
|
222 =head2 this_feature
|
|
223
|
|
224 Title : this_feature
|
|
225 Usage : $feature = $featuregroup->this_feature
|
|
226 Function: access the last feature added to the featuregroup
|
|
227 Returns : the last feature added to the featuregroup
|
|
228 Args : none
|
|
229
|
|
230 =cut
|
|
231
|
|
232 sub this_feature {
|
|
233 my $self = shift;
|
|
234 return $self->{features} ? $self->{features}->[-1] : undef;
|
|
235 }
|
|
236
|
|
237 =head2 each_feature
|
|
238
|
|
239 Title : each_feature
|
|
240 Usage : @features = $featuregroup->each_feature
|
|
241 Function: returns a list of Bio::Expression::FeatureI compliant
|
|
242 objects
|
|
243 Returns : a list of objects
|
|
244 Args : none
|
|
245
|
|
246 =cut
|
|
247
|
|
248 sub each_feature {
|
|
249 my $self = shift;
|
|
250 return @{$self->{features}} if defined($self->{features});
|
|
251 return ();
|
|
252 }
|
|
253
|
|
254 =head2 each_feature_quantitation
|
|
255
|
|
256 Title : each_feature_quantitation
|
|
257 Usage : @featurequantitions = $featuregroup->each_feature_quantitation;
|
|
258 Function: returns an list of quantitations of the features in the featuregroup
|
|
259 Returns : a list of numeric values
|
|
260 Args : none
|
|
261
|
|
262 =cut
|
|
263
|
|
264 sub each_feature_quantitation {
|
|
265 my $self = shift;
|
|
266 my @values = ();
|
|
267 push @values, $_->value foreach $self->each_feature;
|
|
268 return @values;
|
|
269 }
|
|
270
|
|
271 =head2 is_qc
|
|
272
|
|
273 Title : is_qc
|
|
274 Usage : $is_quality_control = $featuregroup->is_qc
|
|
275 Function: get/set whether or not the featuregroup is used for quality control purposes
|
|
276 Returns : a boolean (equivalent)
|
|
277 Args : a new value
|
|
278
|
|
279 =cut
|
|
280
|
|
281 sub is_qc {
|
|
282 my $self = shift;
|
|
283 $self->{is_qc} = shift if defined @_;
|
|
284 return $self->{is_qc};
|
|
285 }
|
|
286
|
|
287 1;
|