[Biopython-dev] [Bug 2711] GenomeDiagram.py: write() and write_to_string() are inefficient and don't check inputs

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Tue Jan 6 02:56:35 UTC 2009


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





------- Comment #22 from bsouthey at gmail.com  2009-01-05 21:56 EST -------
(In reply to comment #21)
> (In reply to comment #17)
> > I do not consider this bug completely fixed for multiple reasons of which my
> > patch addressed some of these prior to the creation of the _write function. I
> > do like where _write is heading as it is making cleaner and more
> > understandable code.
> 
> I decided that since ReportLab used a cStringIO or StringIO handle internally
> to implement its writeToString method, we might as well do the same as it
> allows a great simplification to the GenomeDiagram write and write_to_string
> methods (and we can get rid of _write too).
> 
> See revision 1.14 of Bio/Graphics/GenomeDiagram/Diagram.py
> http://cvs.biopython.org/cgi-bin/viewcvs/viewcvs.cgi/biopython/Bio/Graphics/GenomeDiagram/Diagram.py?cvsroot=biopython
> 
> I hope you'll agree that this is a further improvement (even if the dictionary
> approach is still used internally).
> 
> My plan (see Bug 2718) is to move this code into a shared private function for
> all of the Bio.Graphics modules to use.
> 

That is great! 

Note that reportlab's drawToString first uses it's getStringIO() and passes
that to drawToFile. I am not sure the difference between getStringIO() and
StringIO() but getStringIO() might be preferred. 

Also, I would presume that checking for the filename would allow you to combine
the writing to a file and writing to a string into a single new function to
maintain backwards compatibility.


-- 
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