This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Set Arbitrary Page Size In Genomediagram?

I am writing a script to take a folder full of Genbank files (annotated contigs) and to create a pictorial representation of the ORFs. My approach is to make an image for each file using GenomeDiagram and then to stitch them together into one large PDF file. The problem with this approach is that GenomeDiagram only supports a standard set of Page Sizes that are based around a common Aspect ratio. (My approach would require a stacking of long horizontal images with an extreme aspect ration.)

If I enter a tuple as mentioned in the _Diagram.py file file:

gd_diagram.draw(format="linear", orientation="landscape",pagesize=("5000","1000"), x=0.05, y=0.05,fragments=1, start=0, end=len(record))

I obtain this:

TypeError: can't multiply sequence by non-int of type 'float'

So my question is this: Does anyone know if it is currently possible to set an arbitrary page size for GenomeDrawer? And if not can you think of an alternative strategy to accomplish the same goal? (another graphing library for biopython or a way to combine eps files to get rid of all the white space?

thanks, zach cp

biopython

1 answer

I don't know much about the package you are using. But it's most likely because it takes in a tuple of integers and not string. When you put quotes around things in python, it's interpreted as a string.

Change

pagesize=("5000","1000")

To

pagesize=(5000,1000)

ahh! always simpler then you think... thanks!

And the units are defined in ReportLab, e.g. Import the cm unit and use 30*cm or similar.

Log in to answer this question.