Bio::EnsEMBL::DensityPlot BinValueSet
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::DensityPlot::BinValueSet
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::DensityPlot::BinValue
Bio::EnsEMBL::Root
Inherit
Bio::EnsEMBL::Root Exporter
Synopsis
Description
Methods
_store_biggestDescriptionCode
_store_smallestDescriptionCode
add_binvalueDescriptionCode
colorDescriptionCode
get_binvaluesDescriptionCode
labelDescriptionCode
label2DescriptionCode
new
No description
Code
positionDescriptionCode
scale_to_fitDescriptionCode
shapeDescriptionCode
size
No description
Code
stretchDescriptionCode
Methods description
_store_biggestcode    nextTop
 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
_store_smallestcodeprevnextTop
 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
add_binvaluecodeprevnextTop
 Title   : add_binValue
Usage :
Function:
Example :
Returns :
Args :
colorcodeprevnextTop
 Title   : color
Usage : $obj->color($newval)
Function:
Returns : value of color
Args : newvalue (optional)
get_binvaluescodeprevnextTop
 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
labelcodeprevnextTop
 Title   : label
Usage : $obj->label($newval)
Function:
Returns : value of label
Args : newvalue (optional)
label2codeprevnextTop
 Title   : label2
Usage : $obj->label2($newval)
Function:
Returns : value of label2
Args : newvalue (optional)
positioncodeprevnextTop
 Title   : position
Usage : $obj->position($newval)
Function:
Returns : value of position
Args : newvalue (optional)
scale_to_fitcodeprevnextTop
 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)
shapecodeprevnextTop
 Title   : shape
Usage : $obj->shape($newval)
Function:
Returns : value of shape
Args : newvalue (optional)
stretchcodeprevnextTop
 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
_store_biggestdescriptionprevnextTop
sub _store_biggest {
    my ($self,$val) = @_;
    
    if (!defined $self->{'_biggest_value'} ||
	$val > $self->{'_biggest_value'}){
	$self->{'_biggest_value'}=$val;
    }

    return $self->{'_biggest_value'};
}
_store_smallestdescriptionprevnextTop
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;
}
add_binvaluedescriptionprevnextTop
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);
}
colordescriptionprevnextTop
sub color {
   my $self = shift;


   if( @_ ) {
      my $value = shift;
      $self->{'color'} = $value;
    }
    return $self->{'color'};
}
get_binvaluesdescriptionprevnextTop
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'}} );
}
labeldescriptionprevnextTop
sub label {
   my $self = shift;
   if( @_ ) {
      my $value = shift;
      $self->{'label'} = $value;
    }
    return $self->{'label'};
}
label2descriptionprevnextTop
sub label2 {
   my $self = shift;
   if( @_ ) {
      my $value = shift;
      $self->{'label2'} = $value;
    }
    return $self->{'label2'};
}
newdescriptionprevnextTop
sub new {
  my ($class,@args) = @_;
    
    my $self = {};
    bless $self,$class;
    $self->{'_bin_array'} = [];
    return $self;
}
positiondescriptionprevnextTop
sub position {
   my $self = shift;
   if( @_ ) {
      my $value = shift;
      $self->{'position'} = $value;
    }
    return $self->{'position'};
}
scale_to_fitdescriptionprevnextTop
sub scale_to_fit {
   my $self = shift;
   if( @_ ) {
      my $value = shift;
      $self->{'_scale_to_fit'} = $value;
    }
    return $self->{'_scale_to_fit'};
}
shapedescriptionprevnextTop
sub shape {
   my $self = shift;
   if( @_ ) {
      my $value = shift;
      $self->{'shape'} = $value;
    }
    return $self->{'shape'};
}
sizedescriptionprevnextTop
sub size {
    my $self = shift;
    return scalar @{$self->{'_bin_array'}};
}
stretchdescriptionprevnextTop
sub stretch {
   my ($self,$value) = @_;
   if( defined $value ) {
      $self->{'_stretch'} = $value;
    }
    return $self->{'_stretch'};
}
General documentation
LICENSETop
  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
CONTACTTop
  Please email comments or questions to the public Ensembl
developers list at <ensembl-dev@ebi.ac.uk>.
Questions may also be sent to the Ensembl help desk at <helpdesk@ensembl.org>.