Class Bio::Graphics::Glyph
In: lib/bio/graphics/glyph.rb
Parent: Object

A glyph is a particular shape that represents a genomic feature. Bio::Graphics::Glyph objects represent glyphs. Bio::Graphics::Glyphs are created internally according to specification from the Bio::Graphics::Track and not instantiated directly by the user. Internally, these are constructed as an array of Bio::Graphics::Primitive objects, which are collections of simple shapes, combined appropriately to make a glyph

Methods

Attributes

glyphs  [R]  The different type of Glyphs are:

Public Class methods

A circular glyph centered on the start of the feature it represents

args

 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }  #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
  • :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :x = base x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = base y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

returns

  • An Array of Bio::Graphic::Primitive objects

A polygon glyph with a point on the end that represents the features strand and direction

args

  • :width = the width of the feature in px
  • :fill_color = the fill colour of the Glyph (default = ‘red’), can be any SVG colour eg rgb(256,0,0) or FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }
  • :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :strand = the strand on which the feature is located. May be ’+’ or ’-’
  • :points = the x and y axis coordinates that make up the corners of the polygon, calculated and added by the Bio::Graphics::Page object
  • :x = base x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = base y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

The points of the polygon are calculated form the +:x+ and +:y+ co-ordinates

returns

  • An Array of Bio::Graphic::Primitive objects

A downward-pointing triangle glyph

args

 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 } #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
  • :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

returns

  • An Array of Bio::Graphic::Primitive objects

A generic glyph is a block of colour that displays no specific directional information attached.

args

 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }  #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
  • :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :x_round = x-axis radius of the ellipse used to round off the corners of the rectangle (default = 1)
  • :y_round = y-axis radius of the ellipse used to round off the corners of the rectangle (default = 1)
  • :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

returns

  • An Array of Bio::Graphic::Primitive objects

Sets the the type (linear or radial) and colours for a pre-defined gradient

args

 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

The list of pre-defined gradients

Creates a label Glyph to write text

args

  • :text = the text to write
  • :fill = the colour of the text ("black")
  • :style = the style of writing ("font-family:monospace;")
  • :x = the co-ordinates of the Glyph for the x-axis
  • :y = the co-ordinates of the Glyph for the y-axis

Glyph for the scale across the top of the rendered page

args

returns

  • An Array of Bio::Graphic::Primitive objects (of type ‘line’, ‘rectangle’ and ‘text’)

A line (span) glyph

args

 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }
  • :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :stroke_width = The width of the outline stroke (default = 1)
  • :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

returns

  • An Array of Bio::Graphic::Primitive objects

Creates a transcript glyph, which is a composite glyph containing generic glyphs for the exons/utrs and a directed glyph at the end. The glyphs are joined by lines.

args

  • :height = the height of the Glyph (default = 10)
  • :utr_fill_color = the fill colour of the utr part of the glyph (default = ‘black’), can be any SVG colour eg rgb(256,0,0) or FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }
  • :utr_stroke = the outline colour of the utr part of the glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :utr_stroke_width = The width of the outline stroke for the utr part of the glyph (default = 1)
  • :exon_fill_color = the fill colour of the utr part of the glyph (default = ‘red’), can be any SVG colour eg rgb(256,0,0) or FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients or a custom definition of a gradient
 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }
  • :exon_stroke = the outline colour of the exon part of the glyph (default = "black") can be any SVG colour eg rgb(256,0,0) or FF0000
  • :exon_stroke_width = The width of the outline stroke for the exon part of the glyph (default = 1)
  • :line_color = the colour for the line part that joins the blocks (default = ‘black’) can be any SVG colour eg rgb(256,0,0) or FF0000
  • :line_width = the width ffor the line part that joins the blocks (default = 1)
  • :exon_style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :utr_style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :line_style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :block_gaps = gaps between the rendered blocks - calculated internally by Bio::Graphics::Page object
  • :gap_marker = style of the line between blocks - either angled or straight
  • :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

returns

  • An Array of Bio::Graphic::Primitive objects

An upward-pointing triangle glyph

args

 [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]

or a custom definition of a gradient

 {:type => :radial,
 :id => :custom,
 :cx => 5,
 :cy => 5,
 :r => 50,
 :fx => 50,
 :fy => 50,
   :stops => [ {
        :offset => 0,
        :color => 'rgb(255,255,255)',
        :opacity => 0
        },  {
        :offset => 100,
        :color => 'rgb(0,127,200)',
        :opacity => 1
        }, ]
 }
  • :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or FF0000
  • :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
  • :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
  • :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object

returns

  • An Array of Bio::Graphic::Primitive objects

[Validate]