Method: Bio::Graphics::Ruler#first_tick_position

Defined in:
lib/bio/graphics/ruler.rb

#first_tick_position(start = @panel.display_start, minor_tick = @minor_tick_distance) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/bio/graphics/ruler.rb', line 52

def first_tick_position(start = @panel.display_start,
                        minor_tick = @minor_tick_distance)
  #  * Find position of first tick.
  #    Most of the time, we don't want the first tick on the very first
  #    basepair of the view. Suppose that would be position 333 in the
  #    sequence. Then the numbers under the major tickmarks would be:
  #    343, 353, 363, 373 and so on. Instead, we want 350, 360, 370, 380.
  #    So we want to find the position of the first tick.
  modulo_from_tick = (start % minor_tick)
  start + (modulo_from_tick > 0 ? (minor_tick - modulo_from_tick + 1) : 0)
end