Clustergrammer is a web-based tool for visualizing high-dimensional data as interactive and shareable hierarchically clustered heatmaps. Clustergrammer can be used in three main ways:
- Clustergrammer Web App (http://amp.pharm.mssm.edu/clustergrammer)
- Clustergrammer Jupyter Widget
- Clustergrammer-JS and Clustergrammer-PY libraries
This section will provide instructions on how to quickly visualize your data using the Clustergrammer Web App and the Clustergrammer Jupyter Widget as well as instructions on how to interact with the visualization. For developers interested in building their own web page using Clustergrammer, please see the Web-Development with Clustergrammer section.
Users can easily generate an interactive and shareable heatmap visualization using the Clustergrammer Web App (see upload section screenshot below). Simply upload a tab-separated matrix file (see Matrix Formats and Input/Output for more information) at the homepage to be redirected to a permanent and shareable visualization of your data.
Once you upload your data, the Clustergrammer Web App clusters your data and produces three views: a heatmap of your input matrix, a similarity matrix of your columns, and a similarity matrix of your rows. See the screenshots below and the example visualization for an example results page.
Similarity Matrix View
Users can share their interactive visualizations using the permanent link. See Interacting with the Visualization for more information.
Jupyter notebooks are ideal for generating reproducible workflows and analysis. They are also the best way to share Clustergrammer’s interactive visualizations while providing context, analysis, and the underlying data to enable reproducibility (see Sharing with nbviewer). The Clustergrammer Jupyter Widget enables users to easily produce interactive visualizations within a Jupyter notebook that can be shared with collaborators (using nbviewer). The Clustergrammer Jupyter Widget can be used to visualize a matrix of data from a matrix file or from a Pandas DataFrame (see Matrix Formats and Input/Output for more information).
Clustergrammer has been applied to visualize and analyze a wide variety of biological and non-biological data. See the Jupyter notebook examples below:
- Single Cell RNA-seq Visualization.ipynb
- Iris Dataset.ipynb
To use the Clustergrammer Jupyter Widget users need to install: Python, Jupyter notebook, the widget dependencies (see Jupyter Widget Dependencies), and ipywidgets version >6.0.0 (required for saving notebook with widgets). Users can install Anaconda, a Python distribution that includes the Jupyter notebook as well as other scientific computing libraries, to easily obtain the necessary dependencies (except ipywidgets version >6.0.0). Once these requirements have been met,
clustergrammer_widget can then be installed (with pip) and enabled using the following commands:
pip install --upgrade clustergrammer_widget jupyter nbextension enable --py --sys-prefix widgetsnbextension jupyter nbextension enable --py --sys-prefix clustergrammer_widget
clustergrammer_widget installed and enabled users can visualize their data (from a file) using the following Python commands:
# import clustergrammer_widgets and initialize network object from clustergrammer_widget import * net = Network(clustergrammer_widget) # load matrix file and cluster using default parameters net.load_file('rc_two_cats.txt') net.cluster() # make interactive widget net.widget()
See the screenshot below for an example widget visualization:
Users can download and reproduce the example notebook, Running_clustergrammer_widget.ipynb, by cloning its GitHub repo. For more information about using the widget (e.g. visualizing data from a Pandas DataFrame and sharing notebooks) see Clustergrammer Jupyter Widget.
Interacting with Clustergrammer¶
Clustergrammer produces highly interactive visualizations that enable intuitive exploration of high-dimensional data including:
- Zooming and Panning
- Row and Column Reordering (e.g. reorder based on sum)
- Interactive Dendrogram
- Interactive Dimensionality Reduction (e.g. filter rows based on variance)
- Interactive Categories
- Row Searching
Press play or interact with the gene-expression demo below to see some of Clustergrammer’s interactive features and see Interacting with the Visualization for more information:
Clustergrammer also has Biology-Specific Features for working with gene-level data including: