Package Bio :: Package Graphics :: Package GenomeDiagram :: Module _CircularDrawer :: Class CircularDrawer
[hide private]
[frames] | no frames]

Class CircularDrawer

source code

                    object --+    
                             |    
_AbstractDrawer.AbstractDrawer --+
                                 |
                                CircularDrawer

Object for drawing circular diagrams.

o __init__(self, ...) Called on instantiation

o set_page_size(self, pagesize, orientation)    Set the page size to the
                                            passed size and orientation

o set_margins(self, x, y, xl, xr, yt, yb)   Set the drawable area of the
                                            page

o set_bounds(self, start, end)  Set the bounds for the elements to be
                                drawn

o is_in_bounds(self, value)     Returns a boolean for whether the position
                                is actually to be drawn

o __len__(self)     Returns the length of sequence that will be drawn


o draw(self)    Place the drawing elements on the diagram

o init_fragments(self)  Calculate information
                        about sequence fragment locations on the drawing

o set_track_heights(self)   Calculate information about the offset of
                            each track from the fragment base

o draw_test_tracks(self)    Add lines demarcating each track to the
                            drawing

o draw_track(self, track)   Return the contents of the passed track as
                            drawing elements

o draw_scale(self, track)   Return a scale for the passed track as
                            drawing elements

o draw_greytrack(self, track)   Return a grey background and superposed
                                label for the passed track as drawing
                                elements

o draw_feature_set(self, set)   Return the features in the passed set as
                                drawing elements

o draw_feature(self, feature)   Return a single feature as drawing
                                elements

o get_feature_sigil(self, feature, x0, x1, fragment)    Return a single
                                feature as its sigil in drawing elements

o draw_graph_set(self, set)     Return the data in a set of graphs as
                                drawing elements

o draw_line_graph(self, graph)  Return the data in a graph as a line
                                graph in drawing elements

o draw_heat_graph(self, graph)  Return the data in a graph as a heat
                                graph in drawing elements

o draw_bar_graph(self, graph)   Return the data in a graph as a bar
                                graph in drawing elements

o canvas_angle(self, base)      Return the angle, and cos and sin of
                                that angle, subtended by the passed
                                base position at the diagram center

o draw_arc(self, inner_radius, outer_radius, startangle, endangle,
            color)    Return a drawable element describing an arc

Attributes:

o tracklines    Boolean for whether to draw lines dilineating tracks

o pagesize      Tuple describing the size of the page in pixels

o x0            Float X co-ord for leftmost point of drawable area

o xlim          Float X co-ord for rightmost point of drawable area

o y0            Float Y co-ord for lowest point of drawable area

o ylim          Float Y co-ord for topmost point of drawable area

o pagewidth     Float pixel width of drawable area

o pageheight    Float pixel height of drawable area

o xcenter       Float X co-ord of center of drawable area

o ycenter       Float Y co-ord of center of drawable area

o start         Int, base to start drawing from

o end           Int, base to stop drawing at

o length        Size of sequence to be drawn

o track_size    Float (0->1) the proportion of the track height to
                draw in

o drawing       Drawing canvas

o drawn_tracks  List of ints denoting which tracks are to be drawn

o current_track_level   Int denoting which track is currently being
                        drawn

o track_offsets     Dictionary of number of pixels that each track top,
                    center and bottom is offset from the base of a
                    fragment, keyed by track

o sweep     Float (0->1) the proportion of the circle circumference to
            use for the diagram

o cross_track_links List of tuples each with four entries (track A,
                    feature A, track B, feature B) to be linked.

Instance Methods [hide private]
 
__init__(self, parent=None, pagesize='A3', orientation='landscape', x=0.05, y=0.05, xl=None, xr=None, yt=None, yb=None, start=None, end=None, tracklines=0, track_size=0.75, circular=1, circle_core=0.0, cross_track_links=None)
Create CircularDrawer object.
source code
 
set_track_heights(self)
Initialise track heights.
source code
 
draw(self)
Draw a circular diagram of the stored data.
source code
 
draw_track(self, track)
Returns list of track elements and list of track labels.
source code
 
draw_feature_set(self, set)
Returns list of feature elements and list of labels for them.
source code
 
draw_feature(self, feature)
Returns list of feature elements and list of labels for them.
source code
 
get_feature_sigil(self, feature, locstart, locend, **kwargs)
Returns graphics for feature, and any required label for it.
source code
 
draw_cross_link(self, cross_link) source code
 
draw_graph_set(self, set)
Returns list of graph elements and list of their labels.
source code
 
draw_line_graph(self, graph)
Returns line graph as list of drawable elements.
source code
 
draw_bar_graph(self, graph)
Returns list of drawable elements for a bar graph.
source code
 
draw_heat_graph(self, graph)
Returns list of drawable elements for the heat graph.
source code
 
draw_scale(self, track)
Returns list of elements in the scale and list of their labels.
source code
 
draw_tick(self, tickpos, ctr, ticklen, track, draw_label)
Returns drawing element for a tick on the scale.
source code
 
draw_test_tracks(self)
Draw blue test tracks with grene line down their center.
source code
 
draw_greytrack(self, track)
Drawing element for grey background to passed track.
source code
 
canvas_angle(self, base)
Given base-pair position, return (angle, cosine, sin).
source code
 
_draw_sigil_box(self, bottom, center, top, startangle, endangle, strand, **kwargs)
Draw BOX sigil.
source code
 
_draw_arc(self, inner_radius, outer_radius, startangle, endangle, color, border=None, colour=None, **kwargs)
Returns close path describing an arc box.
source code
 
_draw_arc_line(self, path, start_radius, end_radius, start_angle, end_angle, move=False)
Adds a list of points to a path object.
source code
 
_draw_arc_poly(self, inner_radius, outer_radius, inner_startangle, inner_endangle, outer_startangle, outer_endangle, color, border=None, flip=False, **kwargs)
Returns polygon path describing an arc.
source code
 
_draw_sigil_cut_corner_box(self, bottom, center, top, startangle, endangle, strand, color, border=None, corner=0.5, **kwargs)
Draw OCTO sigil, box with corners cut off.
source code
 
_draw_sigil_arrow(self, bottom, center, top, startangle, endangle, strand, **kwargs)
Draw ARROW sigil.
source code
 
_draw_sigil_big_arrow(self, bottom, center, top, startangle, endangle, strand, **kwargs)
Draw BIGARROW sigil, like ARROW but straddles the axis.
source code
 
_draw_arc_arrow(self, inner_radius, outer_radius, startangle, endangle, color, border=None, shaft_height_ratio=0.4, head_length_ratio=0.5, orientation='right', colour=None, **kwargs)
Draw an arrow along an arc.
source code
 
_draw_sigil_jaggy(self, bottom, center, top, startangle, endangle, strand, color, border=None, **kwargs)
Draw JAGGY sigil.
source code

Inherited from _AbstractDrawer.AbstractDrawer: __len__, is_in_bounds, set_bounds, set_margins, set_page_size

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent=None, pagesize='A3', orientation='landscape', x=0.05, y=0.05, xl=None, xr=None, yt=None, yb=None, start=None, end=None, tracklines=0, track_size=0.75, circular=1, circle_core=0.0, cross_track_links=None)
(Constructor)

source code 
Create CircularDrawer object.

o parent    Diagram object containing the data that the drawer
            draws

o pagesize  String describing the ISO size of the image, or a tuple
            of pixels

o orientation   String describing the required orientation of the
                final drawing ('landscape' or 'portrait')

o x         Float (0->1) describing the relative size of the X
            margins to the page

o y         Float (0->1) describing the relative size of the Y
            margins to the page

o xl        Float (0->1) describing the relative size of the left X
            margin to the page (overrides x)

o xl        Float (0->1) describing the relative size of the left X
            margin to the page (overrides x)

o xr        Float (0->1) describing the relative size of the right X
            margin to the page (overrides x)

o yt        Float (0->1) describing the relative size of the top Y
            margin to the page (overrides y)

o yb        Float (0->1) describing the relative size of the lower Y
            margin to the page (overrides y)

o start     Int, the position to begin drawing the diagram at

o end       Int, the position to stop drawing the diagram at

o tracklines    Boolean flag to show (or not) lines delineating tracks
                on the diagram

o track_size    The proportion of the available track height that
                should be taken up in drawing

o circular      Boolean flaw to show whether the passed sequence is
                circular or not

o circle_core   The proportion of the available radius to leave
                empty at the center of a circular diagram (0 to 1).

o cross_track_links List of tuples each with four entries (track A,
                    feature A, track B, feature B) to be linked.

Overrides: object.__init__

set_track_heights(self)

source code 
Initialise track heights.

Since tracks may not be of identical heights, the bottom and top
radius for each track is stored in a dictionary - self.track_radii,
keyed by track number

get_feature_sigil(self, feature, locstart, locend, **kwargs)

source code 
Returns graphics for feature, and any required label for it.

o feature       Feature object

o locstart      The start position of the feature

o locend        The end position of the feature

draw_graph_set(self, set)

source code 
Returns list of graph elements and list of their labels.

o set       GraphSet object

draw_line_graph(self, graph)

source code 
Returns line graph as list of drawable elements.

o graph     GraphData object

draw_bar_graph(self, graph)

source code 
Returns list of drawable elements for a bar graph.

o graph     Graph object

draw_heat_graph(self, graph)

source code 
Returns list of drawable elements for the heat graph.

o graph     Graph object

draw_scale(self, track)

source code 
Returns list of elements in the scale and list of their labels.

o track     Track object

draw_tick(self, tickpos, ctr, ticklen, track, draw_label)

source code 
Returns drawing element for a tick on the scale.

o tickpos   Int, position of the tick on the sequence

o ctr       Float, Y co-ord of the center of the track

o ticklen   How long to draw the tick

o track     Track, the track the tick is drawn on

o draw_label    Boolean, write the tick label?

draw_greytrack(self, track)

source code 
Drawing element for grey background to passed track.

o track     Track object

_draw_arc(self, inner_radius, outer_radius, startangle, endangle, color, border=None, colour=None, **kwargs)

source code 
Returns close path describing an arc box.

    o inner_radius  Float distance of inside of arc from drawing center

    o outer_radius  Float distance of outside of arc from drawing center

    o startangle    Float angle subtended by start of arc at drawing center
                    (in radians)

    o endangle      Float angle subtended by end of arc at drawing center
                    (in radians)

    o color        colors.Color object for arc (overridden by backwards
                   compatible argument with UK spelling, colour).

Returns a closed path object describing an arced box corresponding to
the passed values.  For very small angles, a simple four sided
polygon is used.

_draw_arc_line(self, path, start_radius, end_radius, start_angle, end_angle, move=False)

source code 
Adds a list of points to a path object.

Assumes angles given are in degrees!

Represents what would be a straight line on a linear diagram.

_draw_sigil_jaggy(self, bottom, center, top, startangle, endangle, strand, color, border=None, **kwargs)

source code 
Draw JAGGY sigil.

Although we may in future expose the head/tail jaggy lengths, for now
both the left and right edges are drawn jagged.