Question: Set Arbitrary Page Size In Genomediagram?
0
gravatar for Zach Powers
8.0 years ago by
Zach Powers340
Zach Powers340 wrote:

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.2k views
ADD COMMENTlink modified 8.0 years ago by Damian Kao15k • written 8.0 years ago by Zach Powers340
2
gravatar for Damian Kao
8.0 years ago by
Damian Kao15k
USA
Damian Kao15k wrote:

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 COMMENTlink written 8.0 years ago by Damian Kao15k

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

ADD REPLYlink written 8.0 years ago by Zach Powers340

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

ADD REPLYlink written 8.0 years ago by Peter5.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1831 users visited in the last hour