[Bioperl-l] Bio::Graphics::Panel gridlines and pixels

Mitch Skinner mitch_skinner at berkeley.edu
Wed Feb 7 23:26:53 UTC 2007


Lincoln Stein wrote:
> Zero is not a forbidden coordinate, since gbrowse also works on 
> genetic maps which have negative and floating point coordinates. 
> You've simply picked up a boundary case where the rounding isn't 
> working properly. I will fix this now.
Thanks for the fix.  What do you think of the following case?.  This is 
something I actually ran into.  Suppose you have:
the original draw_grid:

    my $first_tick = $minor * int($self->start/$minor);

and my version of map_pt:

    my $val = $flip
      ? ($pr - ($length - ($_- 1)) * $scale)
      : (($_-$offset-1) * $scale);
    $val = int($val + .5 * ($val <=> 0));

and scale=0.5, offset=0, pad_left=0, flip=0, and minor=10.
Our tiles are currently 1000px wide.  So the first gridline will be at 
0bp => -1px and the 200th gridline will be at 2000bp => 1000px.  So the 
first tile will not have a gridline at it's 0th pixel but the second 
tile will have one there.  Last night I was thinking that this was an 
artifact of having gridlines start at 0bp but now I'm thinking this is 
just because rounding half-pixels leaves an extra space when crossing 
zero.  Which is not unreasonable; it just invalidates the assumption I 
was hoping to make that the gridlines are the same for each tile.  Maybe 
it's just unreasonable to think that floating point calculations will 
give pixel-exact results.

Or I may just be barking up the wrong tree entirely.  Perhaps it's time 
to reconsider at a higher level (see my next message).

Mitch



More information about the Bioperl-l mailing list