The libgtview library

The library libgtview consists of several classes, which take part in three visualization phases.

[Dataflow]

Figure 1: Schematic of the classes involved in image creation.

These phases are separated to improve performance in the kind of non-linear use often encountered in interactive applications.

Phase I: Feature selection

The GFF3 input data are parsed into a set of directed acyclic graphs (Fig. 2) which represent the part-of relationships between groups of genomic features according to the Sequence Ontology hierarchy.

[GFF3 tree]

Figure 2: Example sequence region containing two genes and their feature graphs depicting the part-of relationships between their components

These graphs are then registered into a persistent FeatureIndex object that can be (repeatedly) queried for all the features in a genomic region of interest.

Phase II: Layout

The next step consists of processing features into a structural Diagram object which contains an abstract, output-independent layout representation. Features are represented by Element objects which are space-efficiently distributed into Track, Line, and Block objects. These correspond to particular building blocks of the resulting diagram. This process can be customized through several options.

[Diagram]

Figure 3: The components of the Diagram class reflect sections of the resulting image.

Phase III: Rendering

In the final phase, the Diagram object is used as a blueprint to create an image of a given type and size, considering user-defined options. Rendering logic is implemented in a Render class, while the Graphics class provides methods to draw a number of primitives to a drawing surface abstraction. It wraps around the low-level graphics library and allows for easy extension or replacement of the graphics back-end.

Collapsing

By default, features are grouped by their type, resulting in one track per type. To obtain a shorter yet concise output, tracks for parent types in the feature graph can be enabled to contain all the features of their child types. This process is called collapsing.

[uncollapsed image]

(a)

[Collapsing]

(b)

[collapsed image]

(c)

Figure 3: Feature collapsing. (a) shows an uncollapsed view in which all types are drawn into separate tracks. As depicted in (b), the exon, intron and CDS types are collapsed into their parent type's track in (c).

Configuration

The Lua scripting language is used to provide user-defined settings. Settings can be imported from a script that is executed when loaded, thus eliminating the need for another parser. The Lua configuration data are made accessible to C via the Config class. Configurable options include assignment of display styles to each feature type, spacer and margin sizes, and collapsing parameters.