[Biopython-dev] Cross-links between tracks in GenomeDiagram

Peter Cock p.j.a.cock at googlemail.com
Wed Nov 16 16:27:46 UTC 2011


Hi all,

Something I've been working on this month in discussion with Leighton
is some enhancements to GenomeDiagram, driven partly by a figure
I wanted to draw for a paper. The code is here,
https://github.com/peterjc/biopython/tree/gd-links

First, we can now show links between tracks joining any two features
or regions. One use of this is to mimic the output from the Artemis
Comparison Tool, ACT, http://www.sanger.ac.uk/resources/software/act/
ACT is great as an exploratory tool, but doesn't let you output a high
quality vector image.

Related to this, it is useful to be able to "crop" different tracks, since
for ACT style comparisons the different sequences are unlikely to
be the same length. Therefore each GenomeDiagram track can now
have its own start/end positions outside which is doesn't get drawn.

This includes some extra unit tests, run test_GenomeDiagram.py
and have a look at Graphics/GD_by_obj_*.pdf

Also try the file Doc/example/ACT_example.py which mimics
a simple two-reference ACT diagram:
https://github.com/peterjc/biopython/blob/gd-links/Doc/examples/ACT_example.py

Simple linear output (split into three fragments) shown here:
http://twitter.com/#!/pjacock/status/136509137826754560

Circular version here (in this case deliberately not using a
closed circle, but that works too), note the curving links are
intentional so as to display very large cross-links nicely:
http://twitter.com/#!/pjacock/status/136840628502933505

This demo script should use blue flipped links where the matches
are to the reverse strand. I haven't put together a nice example
for a proper demonstration of that yet. Perhaps a set of several
E. coli genomes would work nicely...

I plan to merge this to the trunk, and write some end-use
documentation, but would be happy to have someone else
look over the code first.

Note that the API is intended to be quite low level but very
flexible in terms of creating the cross links. You can use
transparency (as in the current version of ACT_example.py)
or explicitly colour links according to say BLAST bit score.
The user also has full control of the z-order, which again
allows you to do things like ACT does and put longer
matches at the back with short matches at the front, etc.

Peter



More information about the Biopython-dev mailing list