Commit 03dafae9 authored by Andrea Pierleoni's avatar Andrea Pierleoni
Browse files

1.0 alpha commit

parent c298899d
File added
src/test.py
src/biograpy/tests/*.png
src/biograpy/tests/*.svg
src/biograpy/tests/*.pdf
src/biograpy/tests/*.jpg
BioGraPy
BioGraPy - Biological Graphical Library in Python
=================================================
Quick examples
------------------------------------------
Simple test
>>> from biograpy import Panel, tracks, features
>>> panel=Panel(fig_width=1000,fig_dpi=100)#initialize a drawer
>>> test_track = tracks.BaseTrack(name = 'test')
Create 5 graphicfeatures
>>> feat1=features.Simple(name='feat1',start=100,end=756,fc='r',aplha=0.5,height=1)
>>> feat2=features.Simple(name='feat2',start=300,end=1056,fc='pink',aplha=0.5,height=1)
>>> feat3=features.Simple(name='feat3',start=600,end=1356,fc='y',aplha=0.5,height=1)
>>> feat4=features.Simple(name='feat4',start=800,end=1356,fc='g',aplha=0.5,height=1)
>>> feat5=features.Simple(name='feat5',start= 1357,end=1806,fc='b',aplha=0.5,height=1)
Add the features to the track::
>>> test_track.append(feat1)
>>> test_track.append(feat2)
>>> test_track.append(feat3)
>>> test_track.append(feat4)
>>> test_track.append(feat5)
Add the track to the panel::
>>> panel.add_track(test_track)
Save the drawn image in PDF format::
>>> panel.save('test.pdf')
or in short, using default styles, and saving as PNG::
>>> from biograpy import Panel, tracks, features
>>> panel=Panel(fig_width=1000)#initialize a drawer
>>> test_track = tracks.BaseTrack(features.Simple(name='feat1',start=100,end=756,),
features.Simple(name='feat2',start=300,end=1056,),
features.Simple(name='feat3',start=600,end=1356,),
features.Simple(name='feat4',start=800,end=1356,),
features.Simple(name='feat5',start= 1357,end=1806,),
name = 'test')
>>> panel.add_track(test_track)
>>> panel.save('test.png')
draw a SeqRecord
>>> from biograpy.seqrecord import SeqRecordDrawer
>>> from Bio import SeqIO
>>> seqrec = SeqIO.read(open('biograpy/tests/test_uniprot.xml'),'uniprot-xml')
>>> grseqrec = SeqRecordDrawer(seqrec)
>>> grseqrec.save('biograpy/tests/test_uniprot.svg')
from setuptools import setup, find_packages
import os
version = '0.0.2'
version = '1.0a'
setup(name='biograpy',
version=version,
description="",
long_description=open("README.txt").read() + "\n" +
open(os.path.join("src", "biograpy", "README.txt")).read() + "\n" +
open(os.path.join("src", "biograpy", "docs", "HISTORY.txt")).read() + "\n" +
open(os.path.join("src", "biograpy", "docs", "AUTHORS.txt")).read(),
# Get more strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
......@@ -15,10 +14,10 @@ setup(name='biograpy',
"Programming Language :: Python",
],
keywords='',
author='',
author_email='',
author='Andrea Pierleoni',
author_email='andrea@biocomp.unibo.it',
url='',
license='GPL',
license='LGPL',
packages=find_packages('src', exclude=['ez_setup']),
package_dir = {'':'src'},
namespace_packages=['biograpy'],
......@@ -28,7 +27,7 @@ setup(name='biograpy',
'setuptools',
# -*- Extra requirements: -*-
'biopython',
'matplotlib>=0.99',
'matplotlib>=1.0',
'numpy>=1.1',
],
entry_points="""
......
File added
Simple test
>>> import tempfile
>>> import os
>>> import Image
>>> from Bio import SeqIO
>>> from biograpy import Panel, tracks, features
>>> panel=Panel(2000,fig_width=1000,fig_dpi=100)#initialize a drawer
>>> panel.draw_ref_obj(10,950,name='reference',height=0.02)#draw a reference object
>>> test_track = tracks.BaseTrack('test')
Create 5 graphicfeatures
>>> feat1=features.Simple(name='feat1',start=100,end=756,fc='r',aplha=0.5,height=0.015)
>>> feat2=features.Simple(name='feat2',start=300,end=1056,fc='pink',aplha=0.5,height=0.015)
>>> feat3=features.Simple(name='feat3',start=600,end=1356,fc='y',aplha=0.5,height=0.015)
>>> feat4=features.Simple(name='feat4',start=800,end=1356,fc='g',aplha=0.5,height=0.015)
>>> feat5=features.Simple(name='feat5',start= 1357,end=1806,fc='b',aplha=0.5,height=0.015)
Add the features to the track::
>>> test_track.add_feature(feat1)
>>> test_track.add_feature(feat2)
>>> test_track.add_feature(feat3)
>>> test_track.add_feature(feat4)
>>> test_track.add_feature(feat5)
Add the track to the panel::
>>> panel.add_track(test_track)
Save the drawn image in PDF format::
>>> (fhandle, fname) = tempfile.mkstemp(suffix='.pdf')
>>> os.close(fhandle)
>>> panel.save(fname)
>>> open(fname).read(4)
'%PDF'
>>> os.unlink(fname)
from SeqRecord ...
>>> from biograpy import Panel, tracks, features
>>> from biograpy.seqrecord import SeqRecordDrawer
>>> from Bio import SeqIO
>>> seqrec = SeqIO.read(open('plone4bio/graphics/tests/test_uniprot.xml'),'uniprot')
>>> grseqrec = SeqRecordDrawer(seqrec)
>>> grseqrec.save('plone4bio/graphics/tests/test_uniprot.png')
from drawer import Panel
# from seqrecord import SeqRecordDrawer, SliceSeqRec
from seqrecord import SeqRecordDrawer, SliceSeqRec
......@@ -3,6 +3,21 @@
Changelog
=========
1.0 alpha
---------------------
Major revision
- Added novel feature type: PlotFeature, BarPlotFeature
TextSequence
- Added colorbars
- Can now use sequence as X tick labels
- Improved track and figure positioning
- Added per-letter annotation support
- Added url in SVG as alternative to
HTML maps
- Added legend for tracks
- Many bug fix and minor improvements
0.3 (released)
---------------------
......
......@@ -6,16 +6,15 @@ TIPS
REQUIREMENTS
-------------------------------------------
MatPlotLib 0.99 or above.
* MatPlotLib 1.0 or above
* BioPython
Installation tips
WebServer Installation tips
-------------------------------------------
1.
When installing on debian lenny both python-matplotlib and python-numpy
must be installed from testing repository. installing just python-matplotlib ends in a segmentation fault.
2.
1.
When deploying in web application call:
::
......@@ -24,26 +23,13 @@ When deploying in web application call:
before import biograpy to make matplotlib work
3. web2py module import
TO LOAD MODULES USE:
::
import os,sys
path=os.path.join(request.folder,'modules')
if not path in sys.path:
sys.path.append(path)
import SeqRecordHandler as SRH
os.environ['HOME'] = '/tmp'
AND NOT:
::
2.
exec('import applications.%s.modules.SeqRecordHandler as SRH'% request.application)
this avoid erratic behavior due to the slowness of the exec method
After saving the image call
::
some erratic behavior still remain if multiple, fast calls are made to the drawing controller
panel.close()
to free matplotlib data from memory
add a
time.sleep(0.10)
in drawer.py after matplotlib import to make it work (slowly)
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config:
tags:
config: b35520e4e4eac3f2e11a6aad774f98db
tags: fbb0d17656682115ca4d033fb2f83ba1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment