biopython v1.71.0 Bio.Graphics.KGML_vis.KGMLCanvas

Reportlab Canvas-based representation of a KGML pathway map.

Link to this section Summary

Functions

Add compound elements to the drawing of the map (PRIVATE)

Add gene elements to the drawing of the map (PRIVATE)

Add the passed graphics object to the map (PRIVATE)

Add labels for the passed graphics objects to the map (PRIVATE)

Add maps to the drawing of the map (PRIVATE)

Add ‘ortholog’ Entry elements to the drawing of the map (PRIVATE)

Add Entry elements for Reactions to the map drawing (PRIVATE)

Add relations to the map (PRIVATE)

Draw an arrow between given Entry objects (PRIVATE)

Initialize

Add the map elements to the drawing

Link to this section Functions

Link to this function __add_compounds()

Add compound elements to the drawing of the map (PRIVATE).

Add gene elements to the drawing of the map (PRIVATE).

Link to this function __add_graphics()

Add the passed graphics object to the map (PRIVATE).

Add text, add after the graphics object, for sane Z-ordering.

Add labels for the passed graphics objects to the map (PRIVATE).

We don’t check that the labels fit inside objects such as circles/ rectangles/roundrectangles.

Add maps to the drawing of the map (PRIVATE).

We do this first, as they’re regional labels to be overlaid by information. Also, we want to set the color to something subtle.

We’re using Hex colors because that’s what KGML uses, and Reportlab doesn’t mind.

Link to this function __add_orthologs()

Add ‘ortholog’ Entry elements to the drawing of the map (PRIVATE).

In KGML, these are typically line objects, so we render them before the compound circles to cover the unsightly ends/junctions.

Link to this function __add_reaction_entries()

Add Entry elements for Reactions to the map drawing (PRIVATE).

In KGML, these are typically line objects, so we render them before the compound circles to cover the unsightly ends/junctions

Link to this function __add_relations()

Add relations to the map (PRIVATE).

This is tricky. There is no defined graphic in KGML for a relation, and the corresponding entries are typically defined as objects ‘to be connected somehow’. KEGG uses KegSketch, which is not public, and most third-party software draws straight line arrows, with heads to indicate the appropriate direction (at both ends for reversible reactions), using solid lines for ECrel relation types, and dashed lines for maplink relation types.

The relation has:

  • entry1: ‘from’ node
  • entry2: ‘to’ node
  • subtype: what the relation refers to

Typically we have entry1 = map/ortholog; entry2 = map/ortholog, subtype = compound.

Draw an arrow between given Entry objects (PRIVATE).

Draws an arrow from the g_from Entry object to the g_to Entry object; both must have Graphics objects.

Initialize.

Add the map elements to the drawing.