Clustergrammer is a web-based tool for visualizing and analyzing high-dimensional data as interactive and shareable hierarchically clustered heatmaps (see :ref:`intro_heatmap_clustergram` for more information). Clustergrammer can be used in three main ways:
- :ref:`clustergrammer_web`: http://amp.pharm.mssm.edu/clustergrammer
- :ref:`clustergrammer_js` and :ref:`clustergrammer_py` libraries
This section will provide information on how to interact with the visualization and how to quickly visualize your own data using the :ref:`clustergrammer_web` and the :ref:`clustergrammer_widget`. See :ref:`case_studies` for examples of how Clustergrammer can be used to explore and analyze real world data. For developers interested in building their own web page using Clustergrammer, please refer to the :ref:`building_web_page` section.
Interacting with Clustergrammer Heatmaps
Clustergrammer produces highly interactive visualizations that enable intuitive exploration of high-dimensional data including:
- :ref:`row_col_reordering` (e.g. reorder based on sum)
- :ref:`interactive_dim_reduction` (e.g. filter rows based on variance)
Press play or interact with the gene-expression demo below to see some of Clustergrammer's interactive features and see :ref:`interacting_with_viz` for more information:
Clustergrammer also has :ref:`biology_specific_features` for working with gene-level data including:
- Mouseover gene names and description look-up (using Harmonizome)
- Enrichment analysis to find biological information (e.g. up-stream transcription factors) specific to your set of genes (using Enrichr)
Users can easily generate an interactive and shareable heatmap visualization using the :ref:`clustergrammer_web` (see upload section screenshot below). Simply upload a tab-separated matrix file (see :ref:`matrix_format_io` for more information) at the homepage to be redirected to a permanent and shareable visualization of your data.
Users can upload their data using the web app homepage. Simply choose your file and upload to be redirected to your permanent and shareable visualization.
Once you upload your data, the :ref:`clustergrammer_web` 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.
Above is an example clustergram visualization produced by the :ref:`clustergrammer_web`. Clustergrammer produces three views of your data; the clustered heatmap view is shown above.
Similarity Matrix View
Clustergrammer produces similarity matrices of rows and columns to provide additional perspectives on your data. Above is an example column similarity matrix.
Users can share their interactive visualizations using their permanent link. See :ref:`interacting_with_viz` 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 :ref:`clustergrammer_widget_examples`). The :ref:`clustergrammer_widget` enables users to easily produce interactive visualizations within a Jupyter notebook that can be shared with collaborators (using nbviewer). The :ref:`clustergrammer_widget` can be used to visualize a matrix of data from a matrix file or from a Pandas DataFrame (see :ref:`matrix_format_io` 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 and :ref:`case_studies` for more information:
- CCLE Jupyter Notebook
- Lung Cancer PTM and Gene Expression Regulation
- Single-Cell CyTOF Data
- MNIST Notebook
- USDA Nutrient Dataset
- Iris Dataset.ipynb
To use the :ref:`clustergrammer_widget` users need to install: Python, Jupyter notebook, the widget dependencies (see :ref:`clustergrammer_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:
Clustergrammer can be used as an interactive widget within a Jupyter notebook and shared using nbviewer (see Running_clustergrammer_widget.ipynb example).
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 :ref:`clustergrammer_widget`.