[Biopython-dev] [Bug 2718] New: Bio.Graphics and output file formats (PDF, EPS, SVG, and bitmaps)

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Tue Dec 23 12:45:55 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2718

           Summary: Bio.Graphics and output file formats (PDF, EPS, SVG, and
                    bitmaps)
           Product: Biopython
           Version: Not Applicable
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: biopython-bugzilla at maubp.freeserve.co.uk


In addition to PDF and PS/EPS (encapsulated postscript), ReportLab can also do
SVG, and with its optional renderPM module can do assorted bitmaps too (e.g.
PNG, JPG, TIFF, GIF, BMP).  Note that renderPM may not be installed (see Bug
2710).

The recently added Bio.Graphics.GenomeDiagram module supports all of these
formats - see Diagram.py with write (to filename or a handle) and
write_to_string methods.

Looking at the older Bio.Graphics code, it currently only supports PDF
postscript, using a mixture of method names (which isn't very consistent):

Bio.Graphics.Distribution has a DistributionPage object with a draw method
(which writes to a filename or handle).

Bio.Graphics.BasicChromosome has an Organism object with a write method (which
writes to a filename or handle).

Bio.Graphics.Comparative has a ComparativeScatterPlot object with a
draw_to_file method (which writes to a filename or handle).

I would like:

(1) All the Bio.Graphics "write to file/handle" functions to accept any of the
supported file formats (like Bio.Graphics.GenomeDiagram), which would require
renderPM at run time for the bitmap formats (see Bug 2710).  They should share
some code for mapping format names to ReportLab rendering module.  This would
be easy to do without changing the existing mix of method names.

(2) Update the docstrings for the "write to file/handle" functions to make it
clear they can accept a filename OR a handle (a result of the underlying
reportlab renderer's drawToFile function's behaviour - see note below).

(3) Standardise on the method naming (and perhaps deprecate the old methods). 
Using "write" seems to be a sensible choice based on the current names used in
Bio.Graphics.

For reference/comparison, ReportLab's render modules have three related
functions:

* drawToString - Returns a string, calls drawToFile internally with a StringIO
handle.
* drawToFile - Takes a filename OR a handle (although their docstrings do not
make this clear, this works as the Canvas object takes either).  Calls the draw
function internally.
* draw - Takes a canvas object

See also Bug 2711 which touched on these issues in the context of GenomeDiagram
only.


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list