comparison variant_effect_predictor/Bio/EnsEMBL/Variation/ReadCoverageCollection.pm @ 0:21066c0abaf5 draft

Uploaded
author willmclaren
date Fri, 03 Aug 2012 10:04:48 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:21066c0abaf5
1 =head1 LICENSE
2
3 Copyright (c) 1999-2012 The European Bioinformatics Institute and
4 Genome Research Limited. All rights reserved.
5
6 This software is distributed under a modified Apache license.
7 For license details, please see
8
9 http://www.ensembl.org/info/about/code_licence.html
10
11 =head1 CONTACT
12
13 Please email comments or questions to the public Ensembl
14 developers list at <dev@ensembl.org>.
15
16 Questions may also be sent to the Ensembl help desk at
17 <helpdesk@ensembl.org>.
18
19 =cut
20
21 # Ensembl module for Bio::EnsEMBL::Variation::ReadCoverage
22 #
23 # Copyright (c) 2008 Ensembl
24 #
25
26
27 =head1 NAME
28
29 Bio::EnsEMBL::Variation::ReadCoverageCollection - A collection of coverage reagion for a read.
30
31 =head1 SYNOPSIS
32
33 # Read coverage collection feature representing a genomic region covered by a read
34
35 $rcc = Bio::EnsEMBL::Variation::ReadCoverageCollection->new
36 (-start => 100,
37 -end => 200,
38 -strand => 1,
39 -slice => $slice,
40 -window_start => 1,
41 -window_end => 1000,
42 -window_size => 50,
43 -read_coverage_avg => 100,
44 -read_coverage_min => 0,
45 -read_coverage_max => 200,
46 -sample => $individual);
47
48
49 print $rcc->start(), "-", $rcc->end(), "\n";
50
51
52 =head1 DESCRIPTION
53
54 This is a class representing the read coverage collection information
55 from the ensembl-variation database. A ReadCoverageCollection behaves as any other Ensembl feature collection.
56 Object for storing read_coverage scores. The scores are averaged (also the minimum and maximum scores) over different window sizes to speed up drawing over large regions. The scores are packed as integer and stored in a string
57 See B<Bio::EnsEMBL::Feature>.
58
59 =head1 METHODS
60
61 =cut
62
63 use strict;
64 use warnings;
65
66 package Bio::EnsEMBL::Variation::ReadCoverageCollection;
67
68 use Bio::EnsEMBL::Feature;
69 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
70 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
71
72 our @ISA = ('Bio::EnsEMBL::Feature');
73
74
75 =head2 new
76
77 Arg [-ADAPTOR] :
78 see superclass constructor
79 Arg [-START] :
80 start relative to the slice,see superclass constructor
81 Arg [-END] :
82 end relative to the slice,see superclass constructor
83 Arg [-STRAND] :
84 1 or -1, same as strand for the slice,see superclass constructor
85 Arg [-SLICE] :
86 see superclass constructor
87 Arg [-SEQ_REGION_START] :
88 start relative to chromosome,see superclass constructor
89 Arg [-SEQ_REGION_END] :
90 end relative to chromosome,see superclass constructor
91 Arg [-SEQ_REGION_STRAND] :
92 always 1, see superclass constructor
93 int Arg [-SCORE_MIN] :
94 average read_coverage for a window
95 Arg [-SCORE_AVG] :
96 minimum read_coverage for a window
97 Arg [-SCORE_MAX] :
98 maximum read_coverage for a window
99 Arg [-SAMPLE_ID] :
100 int - the individual in which the read_covarage is recorded
101
102 Example :
103 $rc = Bio::EnsEMBL::Variation::ReadCoverage->new
104 (-start => 100,
105 -end => 100,
106 -slice => $slice,
107 -window_size => 50,
108 -sample_id => 1);
109
110 Description: Constructor. Instantiates a new ReadCoverageCollection object.
111 Returntype : Bio::EnsEMBL::Variation::ReadCoverageCollection
112 Exceptions : none
113 Caller : general
114 Status : At Risk
115
116 =cut
117
118 sub new {
119 my $caller = shift;
120 my $class = ref($caller) || $caller;
121
122 my $self = $class->SUPER::new(@_);
123 my ($window_size,$window_start,$window_end,$sample_id,$read_coverage_avg,$read_coverage_min,$read_coverage_max,$y_axis_min,$y_axis_max) =
124 rearrange([qw(WINDOW_SIZE WINDOW_START WINDOW_END SAMPLE_ID READ_COVERAGE_AVG READ_COVERAGE_MIN READ_COVERAGE_MAX Y_AXIS_MIN Y_AXIS_MAX)], @_);
125
126 $self->{'window_size'} = $window_size;
127 $self->{'window_start'} = $window_start;
128 $self->{'window_end'} = $window_end;
129 $self->{'sample_id'} = $sample_id;
130 $self->{'read_coverage_avg'} = $read_coverage_avg;
131 $self->{'read_coverage_min'} = $read_coverage_min;
132 $self->{'read_coverage_max'} = $read_coverage_max;
133 $self->{'y_axis_min'} = $y_axis_min;
134 $self->{'y_axis_max'} = $y_axis_max;
135 return $self;
136 }
137
138 =head new_fast
139
140 Arg [1] : hash reference $hashref
141 Example : none
142 Description: This is an ultra fast constructor which requires knowledge of
143 the objects internals to be used.
144 Returntype :
145 Exceptions : none
146 Caller :
147
148 sub new_fast {
149
150 my ($class, $hashref) = @_;
151
152 return bless $hashref, $class;
153
154 }
155
156 =head2 window_size
157
158 Arg[1] : int $newval (optional)
159 The new value to set the window_size attribute to
160 Example : $window_size = $obj->window_size();
161 Description : Getter/Setter for the window_size attribute.
162 the window size this feature has been seen in the genome
163 ReturnType : int
164 Exceptions : none
165 Caller : general
166 Status : At Risk
167
168 =cut
169
170 sub window_size{
171 my $self = shift;
172 return $self->{'window_size'} = shift if (@_);
173 return $self->{'window_size'};
174 }
175
176 =head2 window_start
177
178 Arg[1] : int $newval (optional)
179 The new value to set the window_start attribute to
180 Example : $window_start = $obj->window_start();
181 Description : Getter/Setter for the window_start attribute.
182 the window start this feature has been seen in the genome
183 ReturnType : int
184 Exceptions : none
185 Caller : general
186 Status : At Risk
187
188 =cut
189
190 sub window_start{
191 my $self = shift;
192 return $self->{'window_start'} = shift if (@_);
193 return $self->{'window_start'};
194 }
195
196 =head2 window_end
197
198 Arg[1] : int $newval (optional)
199 The new value to set the window_end attribute to
200 Example : $depth = $obj->window_end();
201 Description : Getter/Setter for the window_end attribute.
202 the window end this feature has been seen in the genome
203 ReturnType : int
204 Exceptions : none
205 Caller : general
206 Status : At Risk
207
208 =cut
209
210 sub window_end{
211 my $self = shift;
212 return $self->{'window_end'} = shift if (@_);
213 return $self->{'window_end'};
214 }
215
216 =head2 read_coverage_avg
217
218 Arg[1] : int $newval (optional)
219 The new value to set the read_coverage_avg attribute to
220 Example : $avg = $obj->read_coverage_avg();
221 Description : Getter/Setter for the score_avg attribute.
222 the average read_coverage this feature has
223 ReturnType : int
224 Exceptions : none
225 Caller : general
226 Status : At Risk
227
228 =cut
229
230 sub read_coverage_avg{
231 my $self = shift;
232 return $self->{'read_coverage_avg'} = shift if (@_);
233 return $self->{'read_coverage_avg'};
234 }
235
236 =head2 read_coverage_min
237
238 Arg[1] : int $newval (optional)
239 The new value to set the read_coverage_min attribute to
240 Example : $min = $obj->read_coverage_min();
241 Description : Getter/Setter for the score_min attribute.
242 the minimum read_coverage this feature has
243 ReturnType : int
244 Exceptions : none
245 Caller : general
246 Status : At Risk
247
248 =cut
249
250 sub read_coverage_min{
251 my $self = shift;
252 return $self->{'read_coverage_min'} = shift if (@_);
253 return $self->{'read_coverage_min'};
254 }
255
256 =head2 read_coverage_max
257
258 Arg[1] : int $newval (optional)
259 The new value to set the read_coverage_max attribute to
260 Example : $max = $obj->read_coverage_max();
261 Description : Getter/Setter for the read_coverage_max attribute.
262 the maximum read_coverage this feature has
263 ReturnType : int
264 Exceptions : none
265 Caller : general
266 Status : At Risk
267
268 =cut
269
270 sub read_coverage_max{
271 my $self = shift;
272 return $self->{'read_coverage_max'} = shift if (@_);
273 return $self->{'read_coverage_max'};
274 }
275
276
277 =head2 sample_id
278
279 Arg[1] : int $newval (optional)
280 The new value to set the sample_id attribute to
281 Example : $sample_id = $obj->sample_id();
282 Description : Getter/Setter for the individual dbId attribute.
283 the individual dbId this feature has been seen in the genome
284 ReturnType : int
285 Exceptions : none
286 Caller : general
287 Status : At Risk
288
289 =cut
290
291 sub sample_id{
292 my $self = shift;
293 return $self->{'sample_id'} = shift if (@_);
294 return $self->{'sample_id'};
295 }
296
297 =head2 y_axis_min
298
299 Arg[1] : int $newval (optional)
300 The new value to set the y_axiss_min attribute to
301 Example : $y_axis_min = $obj->y_axis_min();
302 Description : Getter/Setter for the minimum of read_coverage for the collection of feature.
303
304 ReturnType : int
305 Exceptions : none
306 Caller : general
307 Status : At Risk
308
309 =cut
310
311 sub y_axis_min{
312 my $self = shift;
313 return $self->{'y_axis_min'} = shift if (@_);
314 return $self->{'y_axis_min'};
315 }
316
317 =head2 y_axis_max
318
319 Arg[1] : int $newval (optional)
320 The new value to set the y_axiss_max attribute to
321 Example : $y_axis_max = $obj->y_axis_max();
322 Description : Getter/Setter for the maximum of read_coverage for the collection of feature.
323
324 ReturnType : int
325 Exceptions : none
326 Caller : general
327 Status : At Risk
328
329 =cut
330
331 sub y_axis_max{
332 my $self = shift;
333 return $self->{'y_axis_max'} = shift if (@_);
334 return $self->{'y_axis_max'};
335 }
336
337
338 1;