plot - Tick and Feature labels in Biopython -


with following minimal code

from bio.graphics import genomediagram bio.seqfeature import seqfeature, featurelocation  gdd = genomediagram.diagram('construct diagram') construct_track = gdd.new_track(1, scale=true, scale_format="sint", scale_smalltick_interval=10, scale_largetick_interval=100, scale_ticks=true, start=0, end=2222) track_features = construct_track.new_set()  feature = seqfeature(featurelocation(50,100, strand=+1)) track_features.add_feature(feature, name="my feature name", label=true, label_angle=30)  feature2 = seqfeature(featurelocation(500,550, strand=-1)) track_features.add_feature(feature2, name="my feature name", label=true, label_angle=30)  gdd.draw(format="linear", fragments=1, start=0, end=2222) gdd.write("test.png", "png") 

i obtain following (hideous) figure:

enter image description here

now, figure appearance can tweaked satisfaction, 2 notable exceptions:

  • i cannot set scale labels correctly (ntice how major ticks between 1kbp , 2 kbp read "1kbp" - settle either 1100 or 1.1kbp)
  • i cannot make label of second feature conform how first feature labeled (currently text up-side-down, , if change angle 210, starts extending rather outward track (see next figure)

enter image description here

can me out?

here couple of resources:

http://biopython.org/dist/docs/api/bio.graphics.genomediagram._track.track-class.html http://biopython.org/dist/docs/tutorial/tutorial.html

it looks there @ least couple of options can play around with:

tick labels

  • i cannot set scale labels correctly (ntice how major ticks between 1kbp , 2 kbp read "1kbp" - settle either 1100 or 1.1kbp)

if make scale_format=none in call gdd.new_track() (or leave argument out), you'll 1100, etc.

feature labels

  • i cannot make label of second feature conform how first feature labeled (currently text up-side-down, , if change angle 210, starts extending rather outward track (see next figure)

you can try passing label_position="end" track_features.add_feature(). if combine angle of 210, @ least make not extend outward track, though go green shaded area. perhaps acceptable you.


putting these 2 in example:

from bio.graphics import genomediagram bio.seqfeature import seqfeature, featurelocation  gdd = genomediagram.diagram('construct diagram') construct_track = gdd.new_track(1, scale=true, scale_format=none, scale_smalltick_interval=10, scale_largetick_interval=100, scale_ticks=true, start=0, end=2222) track_features = construct_track.new_set()  feature = seqfeature(featurelocation(50,100, strand=+1)) track_features.add_feature(feature, name="my feature name", label=true, label_angle=30)  feature2 = seqfeature(featurelocation(500,550, strand=-1)) track_features.add_feature(feature2, name="my feature name", label=true, label_angle=210, label_position="end")  gdd.draw(format="linear", fragments=1, start=0, end=2222) gdd.write("test.png", "png") 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -