[BioPython] Tweaking GenomeDiagram / Release of Genome Diagram 0.2

Peter (BioPython List) biopython at maubp.freeserve.co.uk
Mon Mar 27 18:03:14 UTC 2006


Peter wrote:
 >
 > This email is mainly aimed at Leighton Pritchard (who I have spotted
 > posting on the list in the past) as it concerns his (bio)python
 > add-on, GenomeDiagram:
 >
 > http://bioinf.scri.ac.uk/lp/programs.html#genomediagram
 >
 > First Query
 > -----------
 > I would like to attach labels to (selected) features.

See earlier email with example - I hadn't looked closely enough.

http://www.biopython.org/pipermail/biopython/2006-March/002967.html

 > Second Query
 > -------------
 > When drawing circular genomes following the examples, the major tick
 > marks seem to be at 1, 10001, 20001, ... (depending on the tick
 > interval size).
 >
 > It would look much better to display 10000 rather than 10001 (or even,
 > leading to my third question, 10 Kb).

Fixed in GenomeDiagram release 0.2

 > Third Query
 > -----------
 > I would like to have genome size "tick labels" in terms of kilo-bases
 > or mega-bases (i.e. 3 Kb rather than 3000, or 2 Mb rather than
 > 2000000).

This is a new option in GenomeDiagram release 0.2, see below.

Leighton has also improved the positioning of the size captions on the 
lower half of circular diagrams, and probably other things as well.

The following email was sent to me, and I am forwarding it to the 
mailing list because Leighton PGP signature was confusing the server.

Thanks again,

Peter

--------------------------------------------------------------------

Hi Peter,

I think I've implemented everything you asked for, and the new source
and Windows installer are located at:

http://bioinf.scri.sari.ac.uk/lp/programs.php

and

http://bioinf.scri.sari.ac.uk/lp/programs.html#genomediagram

(take your pick).

To use the new features, you need to do the following sort of thing:


     parser = GenBank.FeatureParser()
     fhandle = open
('/data/genomes/Bacteria/Nanoarchaeum_equitans/NC_005213.gbk','r')
     genbank_entry = parser.parse(fhandle)
     fhandle.close()
     gdd = GDDiagram('Test Diagram')

     gdfs1 = GDFeatureSet(name='CDS features')
     for feature in genbank_entry.features:
         if feature.type == 'CDS':
             # This is how you can override any attribute of the
             # GDFeature as you add it to the GDFeatureSet, just by
             # passing the appropriate keyword and argument
             gdfs1.add_feature(feature, name="Some feature or other")
     # By passing the scale_format = "SInt" argument, you can use SI-like
     # suffixes for scale markers.  So far we only have Kbp and Mbp
     # suffixes, and the default goes to just a string of the marker
     # base postion.
     gdt1 = GDTrack('CDS features', greytrack=1,
                    scale_largetick_interval=1e4,
                    scale_smalltick_interval=1e3,
                    scale_format = "SInt")
     gdt1.add_set(gdfs1)
     # You can now do regular expression comparisons, startswith
     # comparisons, exclusions or just plain matches to any GDFeature
     # attribute, just by passing the appropriate attribute, value and
     # comparator mode
     mod_features = gdfs1.get_features('name', 'NEQ0[2-4]', 'like')
     #mod_features = gdfs1.get_features('name', 'NEQ02', 'startswith')
     #mod_features = gdfs1.get_features('name', 'NEQ05', 'not')
     #mod_features = gdfs1.get_features('name', 'NEQ016')
     for feature in mod_features:
         feature.label = 1

And, finally, the marker labels in the lower halves of GenomeDiagram
images have been lowered so that they hit the marker line at the top of
the string, rather than the bottom.

Phew!

L.

-- Dr Leighton Pritchard AMRSC D131, Plant-Pathogen Interactions, 
Scottish Crop Research Institute Invergowrie, Dundee, Scotland, DD2 5DA, 
UK T: +44 (0)1382 562731 x2405 F: +44 (0)1382 568578 E: 
lpritc at scri.sari.ac.uk W: http://bioinf.scri.sari.ac.uk/lp




More information about the Biopython mailing list