Class LinearDrawer
source code
object --+
|
_AbstractDrawer.AbstractDrawer --+
|
LinearDrawer
LinearDrawer(AbstractDrawer)
Inherits from:
o AbstractDrawer
Provides:
Methods:
o __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) 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_tick(self, tickpos, ctr, ticklen, track, draw_label) Return a
tick line and possibly a label
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_location(self, base) Return the fragment, and the offset from
the left margin, of a passed position
in the sequence, on the diagram.
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 Int, size of sequence to be drawn
o fragments Int, number of fragments into which to divide the
drawn sequence
o fragment_size Float (0->1) the proportion of the fragment height to
draw in
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 fragment_height Float total fragment height in pixels
o fragment_bases Int total fragment length in bases
o fragment_lines Dictionary of top and bottom y-coords of fragment,
keyed by fragment number
o fragment_limits Dictionary of start and end bases of each fragment,
keyed by fragment number
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
|
__init__(AbstractDrawer)
o parent Diagram object containing the data that the drawer
draws |
source code
|
|
|
draw(self)
Draw a linear diagram of the data in the parent Diagram object |
source code
|
|
|
init_fragments(self)
Initialises useful values for calculating the positioning of diagram
elements |
source code
|
|
|
set_track_heights(self)
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 |
source code
|
|
|
draw_test_tracks(self)
Draw red lines indicating the top and bottom of each fragment, and
blue ones indicating tracks to be drawn. |
source code
|
|
([element, element,...], [element, element,...])
|
|
(element, element)
|
draw_tick(self,
tickpos,
ctr,
ticklen)
o tickpos Int, position of the tick on the sequence |
source code
|
|
([element, element,...], [element, element,...])
|
|
([element, element,...], [element, element,...])
|
|
([element, element,...], [element, element,...])
|
|
([element, element,...], [element, element,...])
|
|
|
draw_feature_location(self,
feature,
locstart,
locend) |
source code
|
|
(element, element, element)
|
|
([element, element,...], [element, element,...])
|
|
[element, element,...]
|
|
[element, element,...]
|
|
[element, element,...]
|
|
(int, float)
|
|
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__
|
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 fragments Int, the number of equal fragments into which the
sequence should be divided for drawing
o fragment_size Float(0->1) The proportion of the available height
for the fragment that should be taken up in drawing
o track_size The proportion of the available track height that
should be taken up in drawing
- Overrides:
object.__init__
|
o track Track object
Returns a tuple (list of elements in the track, list of labels in the
track)
- Returns: ([element, element,...], [element, element,...])
|
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?
Returns a drawing element that is the tick on the scale
- Returns: (element, element)
|
o track Track object
Returns a tuple of (list of elements in the scale, list of labels in
the scale)
- Returns: ([element, element,...], [element, element,...])
|
o track Track object
Put in a grey background to the current track in all fragments, if
track specifies that we should
- Returns: ([element, element,...], [element, element,...])
|
o set FeatureSet object
Returns a tuple (list of elements describing features, list of labels
for elements)
- Returns: ([element, element,...], [element, element,...])
|
draw_feature(self,
feature,
parent_feature=None)
| source code
|
o feature Feature containing location info
Returns tuple of (list of elements describing single feature, list of
labels for those elements)
- Returns: ([element, element,...], [element, element,...])
|
get_feature_sigil(self,
feature,
x0,
x1,
fragment)
| source code
|
o feature Feature object
o x0 Start X co-ordinate on diagram
o x1 End X co-ordinate on diagram
o fragment The fragment on which the feature appears
Returns a drawable indicator of the feature, and any required label
for it
- Returns: (element, element, element)
|
o set GraphSet object
Returns tuple (list of graph elements, list of graph labels)
- Returns: ([element, element,...], [element, element,...])
|
o graph Graph object
Returns a line graph as a list of drawable elements
- Returns: [element, element,...]
|
o graph Graph object
Returns a list of drawable elements for the heat graph
- Returns: [element, element,...]
|
o graph Graph object
Returns a list of drawable elements for a bar graph of the passed
Graph object
- Returns: [element, element,...]
|
o 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
- Returns: (int, float)
|