The AnnotationSketch module

# Per-type settings

These settings must be given for a specific type, e.g. for the gene type it could look like this:

      gene = {
        stroke             = {red=0.0, green=0.0, blue=0.0, alpha = 1.0},
        stroke_marked      = {red=1.0, green=0.0, blue=0.0},
        fill               = {red=0.9, green=0.9, blue=1.0},
        style              = "box",
        collapse_to_parent = false,
        split_lines        = true,
        max_num_lines      = 10,
      },

## Color options

These settings need to be set to a table with the `red`, `blue`, `green` and `alpha` keys. Alternatively, they can be set to a Lua function which returns such a table, given a FeatureNode object of the current element:

    fill = function(gn)
             if gn:get_score() then
               aval = gn:get_score()*1.0
             else
               aval = 0.0
             end
             return {red=1.0, green=0.0, blue=0.0, alpha=aval}
           end

which would scale the transparency of the red element with the score value of the associated feature. The following settings are available:

- stroke = {red=redval, green=greenval, blue=blueval, alpha=alphaval}
  Sets the outline color of elements of this type to the given RGBA color. All values must be decimal values between 0 and 1.
- stroke_marked = {red=redval, green=greenval, blue=blueval, alpha=alphaval}
  Similar to `stroke`, but applies only to marked elements.
- fill = {red=redval, green=greenval, blue=blueval, alpha=alphaval}
  Sets the fill color of all elements of this type to the given RGBA color.

## Drawing options

- style = "box"/"line"/"rectangle"/"dashes"/"caret"
  Defines the visual style in which the elements of this type are drawn. Possible values are:
  - "box", which draws the elements as an box with arrowheads depending on their strand property.
  - "line", which draws the elements as straight lines with arrowheads depending on their strand property.
  - "rectangle", which draws the elements as a box without arrowheads.
  - "dashes", which draws the elements as straight lines with arrowheads depending on their strand property.
  - "caret", which draws the elements as a '^'-like glyph (often used for introns). Arrowheads are drawn depending on the strand property.
- bar_height = value
  Sets the height of elements of this type to n pixels/points.
- z_index = value
  Sets the z-index of the given type. The z-indices of collapsed types determine the order in which features are drawn on each other. Particularly, element with types with higher index numbers are drawn on top of elements with lower-numbered types. Elements whose types do not have a no z-index are always drawn below those with indices and their internal ordering is determined alphabetically.

## Track layout options

- collapse_to_parent = true/false
  This boolean value determines whether the elements of this type should be drawn on top of their parent type's elements. This property can be used to recursively collapse feature trees by setting it in the parent type to true as well.

## Caption options

- max_capt_show_width = value,
  This value determines up to which zoom width block captions are shown. If the width of the displayed sequence region (in characters) exceeds this value, then captions are omitted. If set to 0, captions are never shown for this type. If set to `nil`, then captions are always shown.
- max_show_width = value,
  This value determines up to which zoom width blocks of this type are shown. It behaves just like `max_capt_show_width`.
- block_caption = string/function
  This value determines how a block caption of a block of this top-level type should be generated. For example, it can be set to a Lua function which returns a string and receives a FeatureNode object of the top-level feature in the block:

      block_caption = function(gn)
                        rng = gn:get_range()
                        return string.format("%s/%s (%dbp)",
                                             gn:get_attribute("Parent"),
                                             gn:get_attribute("ID"),
                                             rng:get_end() - rng:get_start() + 1)
                      end,

  This function creates a block caption which consists of IDs of the parent feature and the feature itself followed by the length of the feature, for example:

      gene1/mRNA1 (3400bp)

# Per-image settings

## Layout options

- split_lines = true/false
  If this option set to false, all blocks per track are drawn in one line, instead of breaking lines if blocks overlap.
- max_num_lines = value
  This value limits the number of lines per track. If the line breaker tries to create more tracks that set here (e.g. if many blocks overlap or if the displayed range is extremely wide), no more tracks are created. If the existing lines fill up, no more blocks will be drawn and the number of discarded blocks will be displayed next to the track title. This can be used to prevent the layouter from generating images of extreme height if a lot of features is packed at a very far zoom level.

## Ruler options

- ruler_font_size = value
  Defines the font size (in pixels/points) of the top ruler.
- ruler_space = value
  Defines the amount of vertical space (in pixels/points) between the ruler and the first track.

## Caption options

- show_block_captions = true/false
  If set to false, no block captions are shown at all for all type tracks.
- block_caption_font_size = value
  Defines the font size (in pixels/points) of the block captions.
- block_caption_space = value
  Defines the amount of space (in pixels/points) between a block caption and the corresponding block.
- show_track_captions = true/false
  If set to false, no track captions are shown at all.
- track_caption_font_size = value
  Defines the font size (in pixels/points) of the track captions.
- track_caption_space = value
  Defines the amount of space (in pixels/points) between a track caption and the lines in the track.
- track_title_color = {red=redval, green=greenval, blue=blueval, alpha=alphaval}
  Defines the color in which track captions are drawn.

## Image options

- background_color = {red=redval, green=greenval, blue=blueval, alpha=alphaval}
  Defines the background color of the image. If PNG output is used, this alpha value can be used to produce images with transparent backgrounds (e.g. for layering).
- margins = value
  This value defines the amount of space left to the left and right of the diagram (in pixels/points).
- bar_height = value
  Defines the default height of a single line (in pixels/points). Can be overridden by a per-type setting.
- bar_vspace = value
  Defines the space left between lines (in pixels/points).
- track_vspace = value
  Defines the space left between tracks (in pixels/points).
- arrow_width = value
  Defines the width of an arrowhead in the "box", "dashes", "line" or "caret" element styles.
- stroke_width = value
  Defines the width of the outline of an element.
- stroke_marked_width = value
  Defines the width of the outline of a marked element.
- default_stroke_color = {red=redval, green=greenval, blue=blueval, alpha=alphaval}
  Defines the default color of the outline of an element. Can be overidden by a per-type setting.
- show_grid = true/false
  If set to true, then light vertical lines are drawn at minor ticks of the ruler for better orientation.
- split_lines = true/false
  If this option set to false, all blocks for each type are drawn in one line per type track, instead of breaking lines if blocks overlap.
- min_len_block = value
  Defines minimum pixel or point size of a block in which single collapsed elements are shown. If a block is more narrow then this threshold, only its outline will be drawn and its outline will be dashed. Set this to nil to always draw all elements in collapsed blocks.