Skip to content

Commit

Permalink
fix wiggle_density so that it flips correctly when displaying reverse…
Browse files Browse the repository at this point in the history
… strand
  • Loading branch information
lstein committed Jan 12, 2012
1 parent a5633d8 commit 8fc9499
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/Bio/Graphics/Glyph/generic.pm
Expand Up @@ -144,7 +144,6 @@ sub font {
sub fontcolor {
my $self = shift;
my $fontcolor = $self->color('labelcolor') || $self->color('fontcolor');
warn "opacity = ",$self->default_opacity;
return defined $fontcolor ? $fontcolor : $self->fgcolor;
}
sub font2color {
Expand Down
7 changes: 6 additions & 1 deletion lib/Bio/Graphics/Glyph/wiggle_density.pm
Expand Up @@ -124,6 +124,7 @@ sub draw_plot {
}

my %color_cache;
my $flip = $self->{flip};

$self->panel->startGroup($gd);
foreach (@$parts) {
Expand All @@ -134,6 +135,11 @@ sub draw_plot {

my $x1 = $left + ($start - $f_start) * $x_scale;
my $x2 = $left + ($end - $f_start) * $x_scale;
if ($flip) {
$x1 = $right - ($x1-$left);
$x2 = $right - ($x2-$left);
($x1,$x2) = ($x2,$x1);
}

my ($r,$g,$b) = $pivot
? $score > $midpoint ? $self->calculate_color($score,$rgb_pos,
Expand All @@ -143,7 +149,6 @@ sub draw_plot {
: $self->calculate_color($score,$rgb,
$scaled_min,$scaled_max);
my $idx = $color_cache{$r,$g,$b} ||= $self->panel->translate_color($r,$g,$b);
# debugging
$self->filled_box($gd,$x1,$top,$x2,$bottom,$idx,$idx);
}
return 1;
Expand Down

0 comments on commit 8fc9499

Please sign in to comment.