Package Bio :: Package Graphics :: Package GenomeDiagram :: Module _LinearDrawer :: Class LinearDrawer
[hide private]
[frames] | no frames]

Class LinearDrawer

source code

                    object --+    
                             |    
_AbstractDrawer.AbstractDrawer --+
                                 |
                                LinearDrawer

Linear Drawer.

Inherits from:
Attributes:
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, fragments=10, fragment_size=0.9, track_size=0.75, cross_track_links=None)
Initialize.
source code
 
draw(self)
Draw a linear diagram of the data in the parent Diagram object.
source code
 
init_fragments(self)
Initialize useful values for positioning diagram elements.
source code
 
set_track_heights(self)
Set track heights.
source code
 
draw_test_tracks(self)
Draw test tracks.
source code
 
draw_track(self, track)
Draw track.
source code
 
draw_tick(self, tickpos, ctr, ticklen, track, draw_label)
Draw tick.
source code
 
draw_scale(self, track)
Draw scale.
source code
 
draw_greytrack(self, track)
Draw greytrack.
source code
 
draw_feature_set(self, set)
Draw feature set.
source code
 
draw_feature(self, feature)
Draw feature.
source code
 
draw_feature_location(self, feature, locstart, locend)
Draw feature location.
source code
 
draw_cross_link(self, cross_link)
Draw cross-link between two features.
source code
 
get_feature_sigil(self, feature, x0, x1, fragment, **kwargs)
Get feature sigil.
source code
 
draw_graph_set(self, set)
Draw graph set.
source code
 
draw_line_graph(self, graph)
Return a line graph as a list of drawable elements.
source code
 
draw_heat_graph(self, graph)
Return a list of drawable elements for the heat graph.
source code
 
draw_bar_graph(self, graph)
Return list of drawable elements for a bar graph.
source code
 
canvas_location(self, base)
Canvas location of a base on the genome.
source code
 
_draw_sigil_box(self, bottom, center, top, x1, x2, strand, **kwargs)
Draw BOX sigil.
source code
 
_draw_sigil_octo(self, bottom, center, top, x1, x2, strand, **kwargs)
Draw OCTO sigil, a box with the corners cut off.
source code
 
_draw_sigil_jaggy(self, bottom, center, top, x1, x2, strand, color, border=None, **kwargs)
Draw JAGGY sigil.
source code
 
_draw_sigil_arrow(self, bottom, center, top, x1, x2, strand, **kwargs)
Draw ARROW sigil.
source code
 
_draw_sigil_big_arrow(self, bottom, center, top, x1, x2, strand, **kwargs)
Draw BIGARROW sigil, like ARROW but straddles the axis.
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, fragments=10, fragment_size=0.9, track_size=0.75, cross_track_links=None)
(Constructor)

source code 

Initialize.

Arguments:
  • parent Diagram object containing the data that the drawer draws
  • pagesize String describing the ISO size of the image, or a tuple of pixels
  • orientation String describing the required orientation of the final drawing ('landscape' or 'portrait')
  • x Float (0->1) describing the relative size of the X margins to the page
  • y Float (0->1) describing the relative size of the Y margins to the page
  • xl Float (0->1) describing the relative size of the left X margin to the page (overrides x)
  • xl Float (0->1) describing the relative size of the left X margin to the page (overrides x)
  • xr Float (0->1) describing the relative size of the right X margin to the page (overrides x)
  • yt Float (0->1) describing the relative size of the top Y margin to the page (overrides y)
  • yb Float (0->1) describing the relative size of the lower Y margin to the page (overrides y)
  • start Int, the position to begin drawing the diagram at
  • end Int, the position to stop drawing the diagram at
  • tracklines Boolean flag to show (or not) lines delineating tracks on the diagram
  • fragments Int, the number of equal fragments into which the sequence should be divided for drawing
  • fragment_size Float(0->1) The proportion of the available height for the fragment that should be taken up in drawing
  • track_size The proportion of the available track height that should be taken up in drawing
  • 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 

Set track heights.

Since tracks may not be of identical heights, the bottom and top offsets of each track relative to the fragment top and bottom is stored in a dictionary - self.track_offsets, keyed by track number.

draw_test_tracks(self)

source code 

Draw test tracks.

Draw red lines indicating the top and bottom of each fragment, and blue ones indicating tracks to be drawn.

draw_track(self, track)

source code 

Draw track.

Arguments:
  • track Track object

Returns a tuple (list of elements in the track, list of labels in the track).

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

source code 

Draw tick.

Arguments:
  • tickpos Int, position of the tick on the sequence
  • ctr Float, Y co-ord of the center of the track
  • ticklen How long to draw the tick
  • track Track, the track the tick is drawn on
  • draw_label Boolean, write the tick label?

Returns a drawing element that is the tick on the scale

draw_scale(self, track)

source code 

Draw scale.

Argument:
  • track Track object

Returns a tuple of (list of elements in the scale, list of labels in the scale).

draw_greytrack(self, track)

source code 

Draw greytrack.

Arguments:
  • track Track object

Put in a grey background to the current track in all fragments, if track specifies that we should.

draw_feature_set(self, set)

source code 

Draw feature set.

Arguments:
  • set FeatureSet object

Returns a tuple (list of elements describing features, list of labels for elements).

draw_feature(self, feature)

source code 

Draw feature.

Arguments:
  • feature Feature containing location info

Returns tuple of (list of elements describing single feature, list of labels for those elements).

get_feature_sigil(self, feature, x0, x1, fragment, **kwargs)

source code 

Get feature sigil.

Arguments:
  • feature Feature object
  • x0 Start X co-ordinate on diagram
  • x1 End X co-ordinate on diagram
  • fragment The fragment on which the feature appears

Returns a drawable indicator of the feature, and any required label for it.

draw_graph_set(self, set)

source code 

Draw graph set.

Arguments:
  • set GraphSet object

Returns tuple (list of graph elements, list of graph labels).

draw_line_graph(self, graph)

source code 

Return a line graph as a list of drawable elements.

Arguments:
  • graph Graph object

canvas_location(self, base)

source code 

Canvas location of a base on the genome.

Arguments:
  • base The base number on the genome sequence

Returns the x-coordinate and fragment number of a base on the genome sequence, in the context of the current drawing setup

_draw_sigil_jaggy(self, bottom, center, top, x1, x2, 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.