Set Arbitrary Page Size In Genomediagram?
1
0
Entering edit mode
13.1 years ago
Zach Powers ▴ 340

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 • 2.0k views
ADD COMMENT
2
Entering edit mode
13.0 years ago

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)
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1218 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6