What Python Libraries Exist For Drawing Genes/Features/Intervals?
4
12
Entering edit mode
12.5 years ago

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.

visualization python api • 15k views
ADD COMMENT
16
Entering edit mode
12.5 years ago

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

These look promising, thanks.

ADD REPLY
0
Entering edit mode

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 REPLY
5
Entering edit mode
12.4 years ago

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

alt text

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode
12.4 years ago
brentp 24k

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 COMMENT
2
Entering edit mode
10.0 years ago
bw. ▴ 260

Also, there is http://genes.mit.edu/burgelab/miso/docs/sashimi.html

ADD COMMENT

Login before adding your answer.

Traffic: 1474 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