Skip to content

Commit

Permalink
refactor datatype() method into wiggle_minmax.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
lstein committed Jan 11, 2012
1 parent 7e2c91a commit e706f80
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
4 changes: 3 additions & 1 deletion lib/Bio/Graphics/Glyph/wiggle_density.pm
@@ -1,7 +1,9 @@
package Bio::Graphics::Glyph::wiggle_density; package Bio::Graphics::Glyph::wiggle_density;


use strict; use strict;
use base qw(Bio::Graphics::Glyph::box Bio::Graphics::Glyph::smoothing Bio::Graphics::Glyph::wiggle_minmax); use base qw(Bio::Graphics::Glyph::box
Bio::Graphics::Glyph::smoothing
Bio::Graphics::Glyph::wiggle_minmax);
use File::Spec; use File::Spec;


sub my_description { sub my_description {
Expand Down
19 changes: 19 additions & 0 deletions lib/Bio/Graphics/Glyph/wiggle_minmax.pm
Expand Up @@ -153,5 +153,24 @@ sub wig {
$d; $d;
} }


sub datatype {
my $self = shift;
my $feature = $self->feature;
my ($tag,$value);

foreach $tag ('wigfile','wigdata','densefile','coverage') {
($value) = eval{$feature->get_tag_values($tag)};
last if $value;
}
unless ($value) {
$tag = 'statistical_summary';
$value = eval{$feature->statistical_summary};
}
unless ($value) {
$tag = 'generic';
}
return wantarray ? ($tag,$value) : $tag;
}



1; 1;
21 changes: 1 addition & 20 deletions lib/Bio/Graphics/Glyph/wiggle_xyplot.pm
Expand Up @@ -99,7 +99,7 @@ sub draw {
my ($gd,$dx,$dy) = @_; my ($gd,$dx,$dy) = @_;


my $feature = $self->feature; my $feature = $self->feature;
my $datatype = $self->datatype; my $datatype = $self->datatype; # found in wiggle_minmax.pm


my $retval; my $retval;
$retval = $self->draw_wigfile($feature,@_) if $datatype eq 'wigfile'; $retval = $self->draw_wigfile($feature,@_) if $datatype eq 'wigfile';
Expand Down Expand Up @@ -237,25 +237,6 @@ sub _draw_wigfile {
$self->draw_plot($parts,@_); $self->draw_plot($parts,@_);
} }


sub datatype {
my $self = shift;
my $feature = $self->feature;
my ($tag,$value);

foreach $tag ('wigfile','wigdata','densefile','coverage') {
($value) = eval{$feature->get_tag_values($tag)};
last if $value;
}
unless ($value) {
$tag = 'statistical_summary';
$value = eval{$feature->statistical_summary};
}
unless ($value) {
$tag = 'generic';
}
return wantarray ? ($tag,$value) : $tag;
}

sub get_parts { sub get_parts {
my $self = shift; my $self = shift;
my $feature = $self->feature; my $feature = $self->feature;
Expand Down

0 comments on commit e706f80

Please sign in to comment.