Bio::EnsEMBL::DensityPlot
BinValueSet
Toolbar
Summary
Bio::EnsEMBL::DensityPlot::BinValueSet
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
Description
Methods
Methods description
Title : _store_biggest Usage : $self->_store_biggest($newval) Function: internal method for storing the largest BinValue->value in this set. Returns : biggest value seen so far Args : value |
Title : _store_smallest Usage : $self->_store_smallest($newval) Function: internal method for storing the smallest BinValue->value in this set. Returns : smallest value seen so far Args : value |
Title : add_binValue Usage : Function: Example : Returns : Args : |
Title : color Usage : $obj->color($newval) Function: Returns : value of color Args : newvalue (optional) |
Title : get_binvalues Usage : my @binvalue_objects = $BVSet->get_binvalues Function: scales all the binvalues by the scale_factor and returns them. Example : Returns : array of BinValue objects Args : none |
Title : label Usage : $obj->label($newval) Function: Returns : value of label Args : newvalue (optional) |
Title : label2 Usage : $obj->label2($newval) Function: Returns : value of label2 Args : newvalue (optional) |
Title : position Usage : $obj->position($newval) Function: Returns : value of position Args : newvalue (optional) |
Title : scale_to_fit Usage : $obj->scale_to_fit($newval) Function: gets/sets the number that the BinValues are to be scaled against - i.e. the greatest BinValue->value will be scaled to this number, and the rest scaled in proportion. Returns : scale_to_fit value Args : newvalue (optional) |
Title : shape Usage : $obj->shape($newval) Function: Returns : value of shape Args : newvalue (optional) |
Title : stretch Usage : $obj->stretch($newval) Function: gets/sets a boolean for whether we should stretch the data over the range (i.e. from min to max rather than absolute numbers). Returns : value of _stretch Args : newvalue (optional) |
Methods code
sub _store_biggest
{ my ($self,$val) = @_;
if (!defined $self->{'_biggest_value'} ||
$val > $self->{'_biggest_value'}){
$self->{'_biggest_value'}=$val;
}
return $self->{'_biggest_value'}; } |
sub _store_smallest
{ my ($self,$val) = @_;
if (!defined($self->{'_smallest_value'})){
$self->{'_smallest_value'}=$val;
}
if (!defined($self->{'_smallest_value'}) ||
$val < $self->{'_smallest_value'}){
$self->{'_smallest_value'}=$val;
}
return $self->{'_smallest_value'};
}
1; } |
sub add_binvalue
{ my ($self,$value) = @_;
defined ($value->chromosomestart) || $self->throw( "Bin Value object does not contain a ChromosomeStart method" );
defined ($value->chromosomeend) || $self->throw( "Bin Value object does not contain a ChromosomeEnd method" );
defined ($value->value) || $self->throw( "Bin Value object does not contain a Value method" );
$self->_store_biggest($value->value);
$self->_store_smallest($value->value);
push(@{$self->{'_bin_array'}},$value); } |
sub color
{ my $self = shift;
if( @_ ) {
my $value = shift;
$self->{'color'} = $value;
}
return $self->{'color'}; } |
sub get_binvalues
{ my $self = shift;
my $biggest_value = $self->{'_biggest_value'} || 0;
my $smallest_value = $self->{'_smallest_value'} || 0;
if (!defined ($biggest_value)||!defined($smallest_value)){
$self->throw("Cannot scale - no values to scale against");
}
my $width = $self->scale_to_fit();
if ($self->stretch && ($biggest_value-$smallest_value) ){
foreach my $bv (@{ $self->{'_bin_array'}}){
my $scaledval = (($bv->value - $smallest_value) / ($biggest_value-$smallest_value) )* $width; $bv->scaledvalue($scaledval);
}
} elsif($biggest_value) {
foreach my $bv (@{ $self->{'_bin_array'}}){
my $scaledval = ($bv->value / $biggest_value) * $width; $bv->scaledvalue($scaledval);
}
} else {
foreach my $bv (@{ $self->{'_bin_array'}}){
$bv->scaledvalue(0);
}
}
return ( @{ $self->{'_bin_array'}} ); } |
sub label
{ my $self = shift;
if( @_ ) {
my $value = shift;
$self->{'label'} = $value;
}
return $self->{'label'}; } |
sub label2
{ my $self = shift;
if( @_ ) {
my $value = shift;
$self->{'label2'} = $value;
}
return $self->{'label2'}; } |
sub new
{ my ($class,@args) = @_;
my $self = {};
bless $self,$class;
$self->{'_bin_array'} = [];
return $self; } |
sub position
{ my $self = shift;
if( @_ ) {
my $value = shift;
$self->{'position'} = $value;
}
return $self->{'position'}; } |
sub scale_to_fit
{ my $self = shift;
if( @_ ) {
my $value = shift;
$self->{'_scale_to_fit'} = $value;
}
return $self->{'_scale_to_fit'}; } |
sub shape
{ my $self = shift;
if( @_ ) {
my $value = shift;
$self->{'shape'} = $value;
}
return $self->{'shape'}; } |
sub size
{ my $self = shift;
return scalar @{$self->{'_bin_array'}}; } |
sub stretch
{ my ($self,$value) = @_;
if( defined $value ) {
$self->{'_stretch'} = $value;
}
return $self->{'_stretch'}; } |
General documentation
Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license.
For license details, please see
/info/about/code_licence.html