SODA: a TypeScript/JavaScript library for visualizing biological sequence annotation

Jack W Roddy, George T. Lesica, Travis J. Wheeler

Abstract

We present SODA, a lightweight and open-source visualization library for biological sequence annotations that enables straightforward development of flexible, dynamic, and interactive web graphics. SODA is implemented in TypeScript and can be used as a library within TypeScript and JavaScript.

Introduction

Visualizing how biological features align with a reference sequence is a fundamental task in bioinformatics. Developers typically choose between heavyweight genome browsers like JBrowse, which offer extensive functionality but are difficult to customize, and low-level libraries like D3.js, which provide total freedom but require significant boilerplate code for genomic coordinates and track management. SODA (Soda Obediently Draws Annotations) addresses this "Goldilocks" gap by providing a lightweight, web-native toolkit designed specifically for biological annotations.

Methods and Architecture

SODA is built with TypeScript and utilizes Scalable Vector Graphics (SVG) for rendering. Its architecture centers on two main concepts:

  • Chart Objects: These act as wrappers for SVG viewports, managing data display and user interactions like panning and zooming.
  • Annotation Objects: A minimal abstraction of genomic data, defined primarily by an ID and start/end coordinates.

The library's "secret sauce" is its Rendering API, which uses callback functions for styling. Because these callbacks are re-evaluated at runtime, visualizations remain dynamic and responsive. Developers can easily define functions to change a glyph's color or shape based on metadata such as alignment scores or sequence age.

Key Insights

SODA's design philosophy emphasizes being a toolkit rather than a full application. Key features include:

  • Compound Glyphs: SODA handles fragmented genomic data by allowing "compound glyphs"—using dashed lines or angled connectors to show that separate visual blocks represent a single biological entity.
  • Semantic Zooming: The library intelligently manages visual clutter by automatically simplifying or hiding text labels as the user zooms out.
  • Interoperability: SODA integrates seamlessly with other web components. For instance, clicking a rendered glyph can instantly highlight a corresponding row in an HTML table.

Real-World Applications

The utility of SODA is demonstrated through its implementation in several biological projects:

Dfam and RepeatMasker

SODA has been used to create interactive tracks for the Dfam database, supporting high-density information like grayscale shading for sequence age and chevron textures to indicate strand direction.

SODA-based visualization in the Dfam database, demonstrating synchronized track and table highlighting.

VIBES: Linked Genomic Views

In the VIBES pipeline, SODA facilitates linked views where a linear genome map and a circular bacterial genome map stay in sync, allowing researchers to track viral integrations across different scales.

Linked linear and circular genomic views created with SODA for the VIBES pipeline.

Conclusion

SODA provides a flexible framework for building highly interactive biological sequence visualizations without the overhead of massive software suites. While currently optimized for linear tracks, future work will focus on expanding the variety of available glyphs and enhancing community-driven features.

Source Code: https://github.com/sodaviz/soda
Documentation: https://sodaviz.org/

Summary updated

BibTeX
@inproceedings{roddy2022soda,
  author = {Jack W Roddy and George T. Lesica and Travis J. Wheeler},
  title = {{SODA: a TypeScript/JavaScript library for visualizing biological sequence annotation}},
  booktitle = {NAR},
  year = {2022},
  doi = {10.1093/nargab/lqac077},
}
Figure