GenomeDiagram
与Jupyter(iPython)一起使用时,显示图像的最简单方法是将GenomeDiagram转换为PNG图像。可以使用IPython.display.Image对象包装它,使其在笔记本中显示。
from Bio.Graphics import GenomeDiagram
from Bio.SeqFeature import SeqFeature, FeatureLocation
from IPython.display import display, Image
gd_diagram = GenomeDiagram.Diagram("Test diagram")
gd_track_for_features = gd_diagram.new_track(1, name="Annotated Features")
gd_feature_set = gd_track_for_features.new_set()
gd_feature_set.add_feature(SeqFeature(FeatureLocation(25, 75), strand=+1))
gd_diagram.draw(format="linear", orientation="landscape", pagesize='A4',
fragments=1, start=0, end=100)
Image(gd_diagram.write_to_string("PNG"))
[请参阅笔记本]
from IPython.display import Image
从0.13开始应该可以使用。