使用以下最小代码
from Bio.Graphics import GenomeDiagram
from 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")
我获得了以下(可怕的)数字:
现在,我可以调整数字外观,但有两个值得注意的例外:
你可以帮帮我吗?
答案 0 :(得分:0)
以下是一些资源:
http://biopython.org/DIST/docs/api/Bio.Graphics.GenomeDiagram._Track.Track-class.html http://biopython.org/DIST/docs/tutorial/Tutorial.html
看起来你可以玩至少有几个选项:
勾选标签
- 我无法正确设置比例标签(ntice如何在1Kbp和2 Kbp之间读取所有主要信号只是“1Kbp” - 我会解决 1100或1.1Kbp)
如果您在scale_format=None
的调用中gdd.new_track()
(或者只是将该论点保留),您将获得1100等等。
功能标签
- 我不能让我的第二个功能的标签符合第一个功能的标签(目前文字是正面朝下的,如果我 将角度更改为210,它开始延伸到而不是向外 从轨道(见下图)
您可以尝试将label_position="end"
传递给track_features.add_feature()
。如果将它与210的角度组合在一起,它至少会使它不会从轨道向外延伸,尽管它会进入绿色阴影区域。也许这对你来说是可以接受的。
将这两个放在你的例子中:
from Bio.Graphics import GenomeDiagram
from 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")