Visualization : The Genome Diagram
Introduction
GenomeDiagram was designed for drawing whole genomes, either as linear diagrams (optionally broken up into fragments to fit better) or as circular wheel diagrams.
Top level of the GenomeDiagram:
horizontal axis: diagram object representing a sequence (or sequence region)
vertical axis: several tracks stacked vertically possible (on circular diagrams: radially stacked), would typically represent the same sequence region
Building up a diagram: top down approach
Top down approach: create a diagram object and then add tracks and features (code example: https://biopython-cn.readthedocs.io/zh_CN/latest/en/chr17.html)
load sequence
create empty diagram
add empty track
add empty featrue set
in your SeqRecord: take each gene SeqFeature object and use it to generate a feature on the diagram, for example coloring them blue and light blue
create output file
draw: creates the shapes using ReportLab objects
write: output possible in several file formats
Bottom up approach: create the different objects directly and then combine them
Create a FeatureSet for each separate set of features you want to display, and add Bio.SeqFeature objects to them.
Create a GraphSet for each graph you want to display, and add graph data to them.
Create a Track for each track you want on the diagram, and add GraphSets and FeatureSets to the tracks you require.
Create a Diagram, and add the Tracks to it.
Tell the Diagram to draw the image.
Write the image to a file.
Helpful links:
Biopython Tutorial and Cookbook Chapter 17 http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc252
GenomeDiagram: Userguide http://biopython.org/DIST/docs/GenomeDiagram/userguide.pdf
https://biopython-cn.readthedocs.io/zh_CN/latest/en/chr17.html
https://www.tutorialspoint.com/biopython/biopython_genome_analysis#