def self.scale(args)
first_mark = args[:start]
last_mark = args[:stop]
full_dist = last_mark - first_mark
interval_width = full_dist / (args[:number_of_intervals] - 1)
a = [Bio::Graphics::Primitive.new(:line,
:stroke => 'black',
:stroke_width => 1,
:x1 => 1, :x2 => args[:page_width],
:y1 => "20", :y2 => "20" )]
marks = (first_mark..last_mark).step(interval_width).to_a
px_per_nt = args[:page_width].to_f / full_dist.to_f
marks.each do |mark|
x = (mark.to_f - first_mark ).to_f * px_per_nt
a << Bio::Graphics::Primitive.new(:rectangle,
:x => x,
:y => 20,
:stroke => 'black',
:stroke_width => 1,
:width => 1,
:height => 5 )
a << Bio::Graphics::Primitive.new(:text,
:x => x,
:y => 40, :fill => 'black',
:text => mark,
:style => "font-family:Arial;font-style:italic")
end
return a
end