3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
34 precentage coverage etc. in a given region.
41 -seq_region => $region,
45 -density_value => 98.5
50 A density feature represents a count, density, or percentage coverage,
51 etc.
for a given region.
53 This module is part of the Ensembl project http:
63 package Bio::EnsEMBL::DensityFeature;
77 Arg [SEQ_REGION] : the sequence over which the density was calculated.
79 Arg [START] : start point on the seq at which density was calulated.
81 Arg [END] : end point on the seq at which density was calulated.
83 Arg [DENSITY_TYPE] : the type of density calculated.
85 Arg [DENSITY_VALUE] : the density.
87 Arg [...] : Named arguments passed to superclass
89 (-seq_region => $region,
93 -density_value => 98.5)
95 Description: Creates a
new density feature.
97 Exceptions :
throw if invalid density value type is provided
106 #allow constructor to be called as class or object method
107 my $class = ref($caller) || $caller;
109 my $self = $class->SUPER::new(@_);
111 my($seq_region, $start, $end, $dt, $dv) =
112 rearrange([
'SEQ_REGION',
'START',
'END',
'DENSITY_TYPE',
'DENSITY_VALUE'],
115 throw(
"Density value must be >= 0.")
if($dv < 0);
118 throw(
"Density Type is NOT optional.");
121 $self->{
'density_type'} = $dt;
122 $self->{
'density_value'} = $dv;
124 $self->{
'slice'} = $seq_region;
125 $self->{
'start'} = $start;
126 $self->{
'end'} = $end;
137 Example : $strand = $df->strand();
138 Description: Getter fot the strand attribute. Density features always have
139 strand 0 and
this attribute is not settable.
140 Returntype : int (always 0)
141 Exceptions : warning
if an attempt is made to set the strand
149 warning(
"DensityFeature strand is not settable") if(@_);
157 Arg [1] : (optional)
float $density_value
158 Example : $dv = $density_feature->density_value();
159 Description: Getter/Setter for the density value of this DensityFeature.
160 The density value may be a count, a percentage, or a coverage
161 of a feature type in the area defined by this feature.
163 Exceptions : throw if a negative density value is provided
173 my $density_value = shift;
174 throw(
"Density value must be >= 0.")
if($density_value < 0);
175 $self->{
'density_value'} = $density_value;
178 return $self->{
'density_value'};
186 New value
for the analysis of the attached DensityType
187 Example : print $df->analysis()->logic_name();
188 Description: Overridden superclass analysis method, to chain to analysis
189 method on attached DensityType.
200 my $dt = $self->density_type();
202 return undef
if(!$dt);
204 return $dt->analysis(@_);
211 Arg [1] :
string $newval (optional)
212 The
new value to set the density_value_type attribute to
213 Example : $density_value_type = $obj->density_value_type()
214 Description: Getter/Setter
for the density_value_type attribute
216 Exceptions :
if object passed is not of type DensityType
226 if( !ref $type || !$type->isa(
"Bio::EnsEMBL::DensityType")){
227 throw(
"object passed must be an ensembl DensityType ".
228 "not a [".ref($type).
"]");
231 $self->{
'density_type'}=$type;
234 return $self->{
'density_type'};
243 Usage : $obj->scaledvalue($newval)
245 Returns : scalar -
object's scaled value
246 Args : newvalue (optional)
254 my $scaledvalue = shift;
255 $obj->{'scaledvalue
'} = $scaledvalue;
257 return $obj->{'scaledvalue
'};
265 Usage : $obj->url($newval)
267 Returns : String containing this object's url
268 Args : newvalue (optional)
278 $obj->{
'url'} = $url;
280 return $obj->{
'url'};