Package Bio :: Package Graphics :: Package GenomeDiagram :: Module _AbstractDrawer
[hide private]
[frames] | no frames]

Module _AbstractDrawer

source code

AbstractDrawer module (considered to be a private module, the API may change!).

Provides:

For drawing capabilities, this module uses reportlab to draw and write the diagram: http://www.reportlab.com

For dealing with biological information, the package expects Biopython objects like SeqFeatures.

Classes [hide private]
  AbstractDrawer
Abstract Drawer.
Functions [hide private]
 
page_sizes(size)
Convert size string into a Reportlab pagesize.
source code
 
_stroke_and_fill_colors(color, border)
Deal with border and fill colors (PRIVATE).
source code
 
draw_box(point1, point2, color=Color(.564706,.933333,.564706,1), border=None, colour=None, **kwargs)
Draw a box.
source code
 
draw_cut_corner_box(point1, point2, corner=0.5, color=Color(.564706,.933333,.564706,1), border=None, **kwargs)
Draw a box with the corners cut off.
source code
 
draw_polygon(list_of_points, color=Color(.564706,.933333,.564706,1), border=None, colour=None, **kwargs)
Draw polygon.
source code
 
draw_arrow(point1, point2, color=Color(.564706,.933333,.564706,1), border=None, shaft_height_ratio=0.4, head_length_ratio=0.5, orientation='right', colour=None, **kwargs)
Draw an arrow.
source code
 
deduplicate(points)
Remove adjacent duplicate points.
source code
 
angle2trig(theta)
Convert angle to a reportlab ready tuple.
source code
 
intermediate_points(start, end, graph_data)
Generate intermediate points describing provided graph data..
source code
Variables [hide private]
  __package__ = 'Bio.Graphics.GenomeDiagram'
Function Details [hide private]

page_sizes(size)

source code 

Convert size string into a Reportlab pagesize.

Arguments:
  • size - A string representing a standard page size, eg 'A4' or 'LETTER'

draw_box(point1, point2, color=Color(.564706,.933333,.564706,1), border=None, colour=None, **kwargs)

source code 

Draw a box.

Arguments:
  • point1, point2 - coordinates for opposite corners of the box (x,y tuples)
  • color /colour - The color for the box (colour takes priority over color)
  • border - Border color for the box

Returns a closed path object, beginning at (x1,y1) going round the four points in order, and filling with the passed color.

draw_polygon(list_of_points, color=Color(.564706,.933333,.564706,1), border=None, colour=None, **kwargs)

source code 

Draw polygon.

Arguments:
  • list_of_point - list of (x,y) tuples for the corner coordinates
  • color / colour - The color for the box

Returns a closed path object, beginning at (x1,y1) going round the four points in order, and filling with the passed colour.

draw_arrow(point1, point2, color=Color(.564706,.933333,.564706,1), border=None, shaft_height_ratio=0.4, head_length_ratio=0.5, orientation='right', colour=None, **kwargs)

source code 

Draw an arrow.

Returns a closed path object representing an arrow enclosed by the box with corners at {point1=(x1,y1), point2=(x2,y2)}, a shaft height given by shaft_height_ratio (relative to box height), a head length given by head_length_ratio (also relative to box height), and an orientation that may be 'left' or 'right'.

deduplicate(points)

source code 

Remove adjacent duplicate points.

This is important for use with the Polygon class since reportlab has a bug with duplicate points.

Arguments:
  • points - list of points [x1, y1, x2, y2,...]

Returns a list in the same format with consecutive duplicates removed

angle2trig(theta)

source code 

Convert angle to a reportlab ready tuple.

Arguments:
  • theta - Angle in degrees, counter clockwise from horizontal

Returns a representation of the passed angle in a format suitable for ReportLab rotations (i.e. cos(theta), sin(theta), -sin(theta), cos(theta) tuple)

intermediate_points(start, end, graph_data)

source code 

Generate intermediate points describing provided graph data..

Returns a list of (start, end, value) tuples describing the passed graph data as 'bins' between position midpoints.