1 unstable release

0.5.0 Apr 14, 2023

#222 in Visualization

MIT/Apache

2MB
4K SLoC

Rust 3.5K SLoC // 0.0% comments Python 517 SLoC // 0.2% comments

shu

What?

Documentation: https://biosustain.github.io/shu/docs/ Web deployment: https://biosustain.github.io/shu

App to plot multidimensional data to a metabolic map. Metabolic maps are graphs with metabolites as nodes and reactions as edges.

Why?

Escher is great. In fact, the format of the map is exactly the same as escher's. However, escher only allows for plotting 2 (+2 with tooltips) kinds of data: reaction data and metabolite data. Shu attempts to provide ways of plotting at least 6:

  • Reaction sizes.
  • Reaction colors.
  • Reaction right sides.
  • Reaction left sides.
  • Metabolite sizes.
  • Metabolite colors.

(+2 with hovers):

  • Hover reactions.
  • Hover metabolites.

with special focus on being able to plot distributions (not just points) and n-conditions. Escher also has the distinction between color and size, it is simply that they are not independently accessible from the GUI.

How to use

Shu is distributed both through a web app (preview build at https://carrascomj.github.io/shu) and as standalone native application. To use the latter, download the latest release for your operating system, unpack if necessary and run it as executable.

Documentation for the rust crate and the python API will be made available once they are published. In the meantime, a preview of the python documentation can be found at https://carrascomj.github.io/shu/docs.

Building from source (latest master commit)

Install cargo and run

git clone https://github.com/biosustain/shu.git
cd shu
cargo install --path .

This may possibly require extra dependencies. Check the bevy setup, shu uses lld to fasten linking times.

API design

Shu follows a Grammar of Graphics design like ggplot or plotnine. See the python API for the full analogy. The particular implementation is an Entity Component System in bevy:

  • Each aesthetic is a component (Gsize, Gcolor, etc.) containing its data (see src/aesthetics.rs). Identifiers are stored in the Aesthetic component.
  • Entities with Aesthetic, other aes components and Geom component (GeomArrow, GeomMetabolite, etc. in src/geom.rs) are processed and plotted by a system (in src/aesthetics.rs).
  • The accepted aesthetics for a given geom are made explicit in the queries of the systems.

Data handling (df, ad map_file) lives in src/data.rs and src/escher.rs and the GUI componets lives in src/gui.rs.

License

Copyright 2023 The Novo Nordisk Foundation Center for Biosustainability.

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~50–69MB
~1M SLoC