GenPat Platform, Wiki

Topics
Topics

SPREAD, Spatiotemporal Pathogen Relationships and Epidemiological Analysis Dashboard

Formerly known as GrapeTree Extended.

Description

The dashboard is based on GrapeTree, a fully interactive tree visualization program from Newick (nwk) files, within EnteroBase system. Grapetree supports manipulation of both tree layout and metadata. It generates GrapeTree figures using the Neighbor-Joining (NJ) and the Minimal Spanning Tree (MSTree) algorithms or an improved Minimal Spanning Tree algorithm called MSTree V2. The original version is an integral part of EnteroBase and, for further details, you can refer to documentation.

For a formal description, please see the accepted manuscript in Genome Research.

The standalone version of GrapeTree has been integrated into the platform as the main tool for manipulating tree graphs and metadata, and it has been extended to conduct spatio-temporal analyses with an integrated geographic information system (GIS) and a time-based data visualization system. The web application allows users to upload geographic coordinates and temporal data related to each sample and allows to display them, reflecting the selection in the tree on the map and vice versa. Additionally, it enables users to reproduce a timelapse visualization both in the map and in the tree.

Using SPREAD

The dashboard is integrated with the platform, so you can launch analyses and view data on it. However, by directly accessing the address https://cohesive.izs.it/spread/, you can upload and visualize your own dataset.

Please note The uploaded dataset is displayed and managed exclusively client-side in the browser, which means no data is transmitted, and no tracking cookies are used. The only data downloaded from the internet are the visualization code (JavaScript), fonts and any necessary tiles for map. Therefore, you can also upload sensitive data.

You can upload the files by dragging them directly over the initial drop area or using the upload button. You can drag or load a .nwk file followed by a .tsv file containing the metadata and, optionally, a .geojson file containing geospatial information related to the samples.

Important!

The .nwk file must always be uploaded before the metadata or the geoJson files.

The dashboard allows you to download a complete JSON file that includes metadata and configurations. The generated JSON file can be loaded using the same drag and drop or upload functionalities mentioned earlier, which is very useful if you want to save your work and/or share it.

Please find an example dataset on the project repository at https://github.com/genpat-it/spread/tree/main/datasets/test.

Overview of General Functions

Whether you choose to upload data from your computer or you are visualizing a pre-processed dataset from the platform, you will be in the same configurable workspace. The main components that make up the dashboard along with the Tree are:

  • Settings
  • Map
  • Metadata
  • Legend
  • Video

These components can be shown or hidden using the respective toggles located at the top of the main workspace, depending on your work needs. Before delving into the details of these components, let's quickly mention two functions present in the header. One is related to language change, which can be set by clicking on the globe icon, and the other, accessible by clicking on the info icon, displays useful information and links.

Available Languages and Translations

Currently, the available languages are English, French and Italian. However, the application can be easily extended with new translations. If you would like to contribute, you can use the en.js or it.js file as a template from the i18n folder on the public repository of the project and translate the values. For any further information or support in this regard, please contact bionformatica@izs.it.

Components

Let's take a closer look at the various parts that make up the dashboard.

Tree tools

From the context menu, placed on the high right corner of the tree's working area, you can access this section containing some useful tools to modify the appearence and layout of the tree, as well as an option to revert the tree to previous state and undo changes and modifications. The available functions in this section are:

  • Centre tree: adjusts view settings so that the tree's core is at the centre of the working area.
  • Static redraw: refreshes the tree and redraws it with the preset layout.
  • Original tree: reloads the page and reverts the tree to the state and layout it was in when it was first loaded. You will be asked for confirmation before leaving the page. Caution: this function will cause you to lose all the changes you made to the tree.

Settings

By activating the settings, you will enter an editable section with a series of cards divided into thematic areas, which allow you to configure the tree. Each card can be expanded or collapsed based on your needs. Below, you will find descriptions of the various available configurations, also visible within the application by clicking on the ? icon of the respective card.

Node style

Under this category you can find some options to change the node's appearance or displayed information.

  • Colour by: from the dropdown menu of this section it's possible to choose the fill-in colour of the nodes according to metadata;
  • Show/Hide labels: the switch will allow you to choose whether to show the node labels or hide them. You can choose which label to show from the Labels dropdown menu just below.
  • Font Size: the font size of the labels can be chosen either by dragging the slider or by specifying a value in the box.
  • Highlight Labels: use the text box to provide a search term for the labels to highlight the corresponding nodes. It supports Regular Expressions.
  • Individual segments: use the switch to turn each node into a pie chart showing the breakdown of the members contained in it. Please note that the attivation of the breakdown function is based on the category selected in Colour by.

Node size

  • Radius size (%) nodes size can be increased or reduced by dragging the slider or by specifying the value in the box.
  • Kurtosis (%): by default the area of the nodes correlate with the members in them. Using the Kurtosis (%) section's slider or box, the node's size can be increased or decreased based on the distribution's kurtosis of the nodes. By increasing this value, you raise the percentage by which the node size grows per member in the node, thus nodes with a larger number of members will have a larger area and will stick out more.

Branch style

In this section you'll find options to customize the tree's branches.

  • Show/Hide Labels: this option allows you to choose whether to show the branch labels or hide them.
  • Font Size: this option allows you to choose the font size for the labels either by using the slider or by entering a value in the designated field.
  • Scaling (%): this option allows you to increase/decrease the overall branches' length, by using the slider or by specifying a value in the box below it.
  • Collapse Branches: use the slider or enter a value in the box to collapse all branches shorter than the specified length. Nodes falling in that interval will be merged together. Branch length values are scaled to the branch lengths defined in the original tree data.
  • Log Scale: by checking the box, all lengths of all branches will be scaled logarithmically.

Branch cutoffs

The settings in this section allow you to render the branches in different ways depending on their length (branch length values are scaled to the branch lengths defined in the original tree data). To increase/decrease the scale you can enter a value in Cut off branches longer than field. You can then choose whether to display them, hide them, or shorten them:

  • Display: show longer branches as normal (default).
  • Hide: makes longer branches transparent. Even though the branches are not displayed, it's still possible to interact with them.
  • Shorten: branches longer than the specified cutoff will be cropped back to the specified cutoff. Branches will be displayed as dashed lines to indicate those affected by the reduction.

Rendering

This section contains some options that allow to control how nodes are positioned in the tree. Two modes are available: Static and Dynamic.

  • Static: in this mode, the tree layout is calculated when the chart is generated and remains static (but interactive). The relative length of the branches and their scaling (from the original tree data) will always be maintained as long as the Real Branch Length option is checked.
  • Dynamic: nodes are positioned dynamically in a way similar to a Force Directed Layout and will try to fan out in order to distance themselves from the neighbors. The tree can be moved around freely by dragging it and the nodes will spread out to maintain the distances among themselves. The Dynamic mode can be used to improve the aesthetics of the tree but the branch length scaling will be modified compared to the original: branches will NOT be to scale when in Dynamic mode. Toggle on the Selected Only option to apply only to selected nodes.

Map

This area allows you to view an interactive map if geographic coordinates have been defined for the samples (either through metadata files or geoJSON files). On the map, some markers are drawn with varying radius sizes, based on the number of samples present in a particular area. By clicking on each marker, you can open an informative popup containing the list of samples within.

The markers reflect the colors of the chosen theme for the tree visualization and selection. You can interact with the map through its context menu, which can be accessed by right-clicking on it or by using the three vertical dots button located at the top-right corner.

Map tools

You can control the appearance of the map through the options available in this section.

  • Join by coordinates/by metadata: The toggle allows you to aggregate points on the map based on the geographical proximity of the provided coordinates or on the values of the uploaded metadata. In the first case, you can set a value for delta, which determines the degree of aggregation.
  • Minimum/Maximum marker radius: With these two fields, you can adjust the size of the points on the map by defining a minimum and a maximum radius. The initial size is relative to the number of nodes located at the same geographical coordinates.
  • Pie Chart mode/Heatmap mode: This toggle allows you to change the visualization mode of the points on the map. With the first option (selected by default), the points will be displayed with pie charts based on the categories of the tree nodes while, with the second option, a blur effect is applied to the nodes.

Metadata

By activating the Metadata toggle, you will be able to view the metadata within an interactive grid. The table allows you to move columns, expand and/or reduce them, sort them or filter them based on search keys. By clicking on a row, you can select/deselect the samples within the tree.

Similar to the map, the metadata table also has tools that can be accessed by right-clicking on the table or by using the button located at the top-right corner with three vertical dots.

Legend

This is a key tool for both the interaction with the tree and for the temporal visualization/selection of data. Through the Legend tools, you can change the category and color of the tree, customize the colors or select samples from a specific category.

The following video demonstrates how to access the context menu of the legend and its options, how to interact with the legend, and how to modify preferences and the color palette.

Video

In Video mode, the legend turns into a proper timeline. The video player, placed at the bottom right, allows you to iterate through the legend elements at a configurable speed. The video functions are completely metadata-driven, so if temporal information is present in the metadata, you can color the legend based on that information, sort it in ascending order and, consequently, have a timeline to measure the spread and development of a pathogen over time.

In the following video, you will find a possible use case.

Macros

The Macros component can be accessed via the fast-forward icon located at the top-right corner of the application. This section provides a growing collection of action sequences (macros), which can be searched and categorized by tags.

The component allows you to search for macros and, by using specific keys (title:, tag:, desc:), you can narrow your search to focus on specific elements.

If you have suggestions for new macros, we warmly welcome your input!

Cluster zoom

The application can be used to display the results generated by using ReporTree. In short, ReporTree allows the generation of a series of zooms on the clusters by specifying the samples of interest and some parameters such as thresholds and distance; in this context, it is possible to indicate their presence to the dashboard, so they can be displayed accordingly. On the tree's interface, you can click on Available zooms you can access the Zoom tools to highlight any clusters that are available. You can select the zoom type, the threshold and the cluster to which the sample can be associated as well as the involved nodes. Additionally, the functions allow you to load in a new tab a modified cluster for which you can choose if keeping current settings or not.

In the following video, you will find a possible use case.

Tree

This is, of course, the main component and, therefore, always visible. It displays the tree visualization of the data and is fully interactive. You can interact with this component directly, through the context menu or through all the other components.

You can interact directly with the tree by moving individual nodes or hovering over them to see tooltips; you can also select nodes by pressing Shift and clicking on them or drawing an area with the mouse. The selection will also be reflected in the Map and Metadata components.

TIP

To enable the selection in the chart workspace, press and hold the Shift key on the keyboard: as long as the slider appears as a crosshair, you can select or deselect individual nodes by clicking on them. You can also select multiple nodes by drawing a selection area (dragging the cursor while holding down the left mouse button).

More interesting things can certainly be done through the context menu or, as mentioned, through interactions with the other components (which we have discuss in their respective sections). You can access the context menu by right-clicking on the tree or by using the button at the top-right corner with three vertical dots. The menu options are quite self-explanatory and we invite you to try them out to better understand their functionality, through interaction. Basically, they support you in modifying the tree view.

Here, we will focus on the save function.

  • Save as complete json (.json): it allows you to save the current work in a complete .json file containing all the information about the tree, its metadata and the current configurations of the different components. This functionality is crucial, as it is the only way to save your progress in editing SPREAD, resume it at a later time or share it with others. The .json file stores information such as: node placement and color, current category, node visualization modes on the map, workspace layout configuration and even which settings cards are expanded or collapsed.
  • Export newick (.nwk): it exports data in the .nwk format.
  • Export metadata (.tsv): it exports metadata in the .tsv format.
  • Export geoJson (.geoJson): it exports the spatial metadata in the .geojson format.

All files produced are compatible to be reloaded later in the dashboard, as mentioned in Using SPREAD.