Permalink
Browse files

Subtle change to chromosome diagram API to allow low level ReportLab …

…trickery

For example, this allows me to get the drawing objects and lay them
out on separate pages of the same PDF, or add additional graphics
elements.
  • Loading branch information...
1 parent 764c5ed commit 67f067aa11d327e5b924e539efd3e9030628c77d @peterjc peterjc committed Mar 19, 2013
Showing with 7 additions and 0 deletions.
  1. +7 −0 Bio/Graphics/BasicChromosome.py
@@ -119,6 +119,9 @@ def draw(self, output_file, title):
o output_file -- The name of a file specifying where the
document should be saved, or a handle to be written to.
The output format is set when creating the Organism object.
+ Alternatively, output_file=None will return the drawing using
+ the low-level ReportLab objects (for further processing, such
+ as adding additional graphics, before writing).
o title -- The output title of the produced document.
"""
@@ -149,6 +152,10 @@ def draw(self, output_file, title):
self._draw_legend(cur_drawing, self._legend_height + 0.5 * inch, width)
+ if output_file is None:
+ #Let the user take care of writing to the file...
+ return cur_drawing
+
return _write(cur_drawing, output_file, self.output_format)
def _draw_title(self, cur_drawing, title, width, height):

0 comments on commit 67f067a

Please sign in to comment.