PyComplexHeatmap Documentation

repository·main·Indexed 18 days ago

https://github.com/dingwb/pycomplexheatmap

A Python package for plotting complex heatmaps and clustermaps, specifically optimized for visualizing multimodal genomics data. It features specialized tools for high-dimensional data visualization, including DotClustermapPlotter for up to five-dimensional data, OncoPrint for categorical variables, and composite heatmaps. The library provides comprehensive annotation capabilities via HeatmapAnnotation, supporting barplots, boxplots, scatterplots, and text labels.

Tokens
21K
Snippets
66
Records
78
Agent score
59%

What's inside PyComplexHeatmap

  1. Explore PyComplexHeatmap visualization examples

    main

    The PyComplexHeatmap gallery demonstrates various complex visualization capabilities. Key use cases include:

    • Heatmap Annotations: Creating heatmaps with associated annotations, custom annotations, or plotting only the annotations.
    • Composite Heatmaps: Combining multiple heatmaps horizontally.
    • Clustering Strategies: Clustering between groups or clustering within groups.
    • Specialized Plots:
      • OncoPrint: Visualizing categorical variables or using split columns.
      • Dot Clustermap: Visualizing enrichment results or dot clustermaps with annotations.
      • DotClustermapPlotter: Visualizing up to five-dimensional data.
    • Biological Data Types: Specialized workflows for DNA methylation (cell type specific signatures) and single-cell data.
  2. Explore PyComplexHeatmap submodules

    main

    The PyComplexHeatmap package is organized into several specialized submodules for different heatmap and visualization tasks:

    • PyComplexHeatmap.annotations: For managing and visualizing annotations.
    • PyComplexHeatmap.clustermap: For creating clustered heatmaps.
    • PyComplexHeatmap.colors: For color palette management.
    • PyComplexHeatmap.dotHeatmap: For generating dot heatmaps.
    • PyComplexHeatmap.oncoPrint: For creating OncoPrint-style visualizations.
    • PyComplexHeatmap.utils: For utility functions.
  3. Install the developmental version from GitHub

    main

    If you need the latest features or fixes from the development branch, you can install directly from the GitHub repository using pip or by cloning the repository and running the setup script.

    # Install directly via pip from GitHub
    pip install git+https://github.com/DingWB/PyComplexHeatmap
    
    # OR: Manual installation via git clone
    git clone https://github.com/DingWB/PyComplexHeatmap
    cd PyComplexHeatmap
    python setup.py install
  4. Update PyComplexHeatmap from GitHub

    main

    If you previously installed a version of PyComplexHeatmap and want to switch to the developmental version from GitHub, it is recommended to uninstall the existing version first to avoid conflicts.

    pip uninstall PyComplexHeatmap
    pip install git+https://github.com/DingWB/PyComplexHeatmap
  5. PyComplexHeatmap dependencies

    main

    PyComplexHeatmap requires the following Python packages:

    • matplotlib
    • numpy
    • pandas
    • scipy
    • fastcluster (optional, but recommended for clustering performance)

    You can pre-install the core dependencies using:

    pip install --ignore-install matplotlib numpy pandas fastcluster
  6. Install documentation build dependencies

    main

    To build the project documentation, you need to install Sphinx and several extensions via pip and conda. This setup includes support for Jupyter notebooks (nbsphinx), various themes, and Pandoc for document conversion.

    pip install sphinx sphinx-autobuild sphinx-rtd-theme pandoc nbsphinx sphinx_pdj_theme sphinx_sizzle_theme recommonmark readthedocs-sphinx-search
    conda install conda-forge::pandoc
  7. Explore PyComplexHeatmap usage and examples

    main

    PyComplexHeatmap provides several ways to learn how to use the package for visualizing multimodal genomics data:

    • Simple Guide: A quickstart for beginners to get started with basic heatmaps.
    • Advanced Usage: Detailed tutorials for complex scenarios like clustering between groups, custom annotations, or plotting only annotations.
    • Kwargs Reference: A comprehensive list of keyword arguments available for customizing plots.
    • Gallery/Examples: Visual examples covering various plot types including:
      • oncoPrint: Visualizing categorical variables.
      • DotClustermapPlotter: Visualizing up to five-dimensional data using dot clustermaps.
      • anno_img: Visualizing motif enrichment results using images.
      • Composite heatmaps (combining heatmaps horizontally).
  8. Install PyComplexHeatmap

    main

    You can install PyComplexHeatmap via pip for the stable version or directly from GitHub for the developmental version.

    Stable Version

    Use pip to install or upgrade the package.

    Developmental Version

    To install the latest version from the GitHub repository, use the git+https URL. You can also clone the repository and install it manually using setup.py.

    # Install stable version
    pip install PyComplexHeatmap
    
    # Upgrade stable version
    pip install --upgrade PyComplexHeatmap
    
    # Install developmental version from GitHub
    pip install git+https://github.com/DingWB/PyComplexHeatmap
    
    # Reinstall developmental version
    pip uninstall -y PyComplexHeatmap && pip install git+https://github.com/DingWB/PyComplexHeatmap
    
    # Manual installation from cloned repo
    git clone https://github.com/DingWB/PyComplexHeatmap
    cd PyComplexHeatmap
    python setup.py install
  9. Initialize Sphinx documentation directory

    main

    Follow these steps to initialize the documentation structure using sphinx-quickstart:

    1. Create and enter the docs directory: mkdir -p docs && cd docs.
    2. Run sphinx-quickstart.
    3. When prompted, select y for Separate source and build directories.
    4. Provide the project name (e.g., PyComplexHeatmap).
    5. Configure source/conf.py as needed and add .rst files to the source directory.
    6. To allow the root index.html to redirect to the built documentation, edit docs/index.html to include: <meta http-equiv="refresh" content="0; url=./build/html/index.html" />.
    mkdir -p docs && cd docs
    sphinx-quickstart
    # Separate source and build directories (y/n) [n]: y
    # Project name: PyComplexHeatmap