Question: What Python Libraries Exist For Drawing Genes/Features/Intervals?
12
gravatar for Aaronquinlan
7.8 years ago by
Aaronquinlan11k
United States
Aaronquinlan11k wrote:

I am working on new software for exploring genetic variation and genome annotations. One feature I would like to add is the ability to plot features (gene's, SNPs, SVs, etc.) in a given genomic region. What libraries are you aware of for producing "plots" or images like this in Python. Essentially, I am looking for something similar to Perl's Bio::Graphics module.

So far, I've seen that GenomeTools has a Python interface, but I am looking for possible alternatives.

python api visualization • 8.7k views
ADD COMMENTlink modified 2.3 years ago by Biostar ♦♦ 20 • written 7.8 years ago by Aaronquinlan11k
16
gravatar for Giovanni M Dall'Olio
7.8 years ago by
London, UK
Giovanni M Dall'Olio26k wrote:

Have a look at BioGraphy by Andrea Pierleoni. It is probably going to be integrated into BioPython soon.

Example of BioGraphy output (from the tutorial):

alt text

Another alternative is GenomeDiagram. I can not reach the page linked in the article now, but this library should be included in the newer versions of BioPython. You can see some examples in the BioPython cookbook, chapter 15.

Example of GenomeDiagram output:

alt text

ADD COMMENTlink modified 7.8 years ago • written 7.8 years ago by Giovanni M Dall'Olio26k

These look promising, thanks.

ADD REPLYlink written 7.8 years ago by Aaronquinlan11k

I have tryed to use BioGraphy and got it via: git clone git://github.com/apierleoni/BioGraPy After the two steps python setup.py build and python setup.py install, I tested the tutorial code from http://apierleoni.github.io/BioGraPy/tutorial.html:

from biograpy import Panel, tracks, features panel=Panel(fig_width=900, padding = 25)#initialize a drawer, and add some padding test_track = tracks.BaseTrack(features.Simple(name = 'feat1', start = 100, end = 356, ), features.Simple(name = 'feat2', start = 30, end = 856, ), features.Simple(name = 'feat3', start = 400, end = 700, ), sort_by = 'None',) panel.add_track(test_track) panel.save('basic_test.png')

However, after this I got the following error message by using the ipython notebook (python 2.7): AttributeError Traceback (most recent call last) <ipython-input-1-050f14eab25c> in <module>() 4 features.Simple(name = 'feat2', start = 30, end = 856, ), 5 features.Simple(name = 'feat3', start = 400, end = 700, ), ----> 6 sort_by = 'None',) 7 panel.add_track(test_track) 8 panel.save('basic_test.png')

/home/linux/anaconda2/lib/python2.7/site-packages/biograpy-1.0b0dev_r0-py2.7.egg/biograpy/tracks.pyc in __init__(self, args, *kwargs) 151 self.norm = kwargs.get('norm', None)# normalizing function, if None build one. could be any function taking a value an returning a float between 0 and 1 152 if not self.norm: --> 153 self.norm = colors.normalize(vmin = self.min_score, vmax = self.max_score) 154 155

AttributeError: 'module' object has no attribute 'normalize'

Does somebody know how to solve this problem?

Thanks

ADD REPLYlink written 3.4 years ago by jochenfra0
5
gravatar for Michael Schubert
7.8 years ago by
Cambridge, UK
Michael Schubert6.9k wrote:

BioPython can now do diagrams as well. The picture below is for restriction analysis, but you get the idea.

alt text

ADD COMMENTlink written 7.8 years ago by Michael Schubert6.9k

The link is outdated. It should be Chapter 17 Graphics including GenomeDiagram

ADD REPLYlink written 2.4 years ago by sbliven30
2
gravatar for brentp
7.8 years ago by
brentp23k
Salt Lake City, UT
brentp23k wrote:

I haven't tried these, but also check out:

  1. willow by Titus brown--I think that's tied to pygr somehow
  2. GenomeViewer which uses Wx for rendering.
ADD COMMENTlink written 7.8 years ago by brentp23k
2
gravatar for bw.
5.4 years ago by
bw.150
San Francisco
bw.150 wrote:

Also, there is

http://genes.mit.edu/burgelab/miso/docs/sashimi.html

 

ADD COMMENTlink written 5.4 years ago by bw.150
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: 1559 users visited in the last hour