Module Bio::Graphics
In: lib/bio/graphics/panel.rb

DESCRIPTION

The Bio::Graphics set of objects allow for creating simple images that display features on a linear map. A picture consists of:

  • one panel: container of all tracks
  • one or more tracks: container of the features. Multiple tracks can exist in the same graphic to allow for differential visualization of different feature types (e.g. genes as blue rectangles and polymorphisms as red triangles)
  • one or more features in each track: these are the actual features that you want to display (e.g. ‘gene 1’, ‘SNP 123445’)
  • a ruler on top of the panel: is added automatically

Schematically:

 panel
   +-> track 1
   |     +-> feature 1
   |     +-> feature 2
   |     +-> feature 3
   +-> track 2
   |     +-> feature 4
   |     +-> feature 5
   +-> ruler

USAGE

  # Create a panel for something with a length of 653. This could be a
  # sequence of 653 bp, but also a genetic map of 653 cM.
  g = Bio::Graphics::Panel.new(653)

  # Add the first track (e.g. 'genes')
  track1 = g.add_track('genes')

  # And put features in that track
  track1.add_feature('gene1','250..375')
  track1.add_feature('gene2','54..124')
  track1.add_feature('gene3','100..500')

  # Add a second track (e.g. 'polymorphisms')
  track2 = g.add_track('polymorphisms', false, [1,0,0], :triangle)

  # And put features on this one
  track2.add_feature('polymorphism 1','56')
  track2.add_feature('polymorphism 2','103')

  # Create the actual image as SVG text
  g.draw('my_picture.png')

NOTE ON ARGUMENTS

As there can be an overwhelming number of arguments for some methods in Bio::Graphics, any optional arguments have to be provided as a hash. For example: the Track#add_feature method has only one mandatory argument (the feature object) and several optional ones. This is how you can use that method:

  track.add_feature(my_feature_object,
                    :label => 'anonymous',
                    :link => 'http://www.google.com',
                    :glyph => :box,
                    :colour => [0,1,0]
                   )

Classes and Modules

Module Bio::Graphics::Glyph
Class Bio::Graphics::Feature
Class Bio::Graphics::ImageMap
Class Bio::Graphics::Panel
Class Bio::Graphics::Ruler
Class Bio::Graphics::SubFeature
Class Bio::Graphics::Track

Constants

DEFAULT_PANEL_WIDTH = 800   The defaults
TRACK_HEADER_HEIGHT = 12
FEATURE_HEIGHT = 10
FEATURE_V_DISTANCE = 5
FEATURE_ARROW_LENGTH = 5
FONT = ['Georgia', 1, 1]

[Validate]