DEEPTOOLS PLOTHEATMAP

deepTools plotHeatmap creates a heatmap for scores associated with genomic regions. As input, it requires a matrix file generated by deepTools computeMatrix. For usage information about deepTools plotHeatmap, please see the documentation. For more information about deepTools, also see the source code.

You can select which optional output files are generated by adding the respective output variable with the recommended extension(s) for them (see example Snakemake rule below).

PlotHeatmap option Output

Name of output

variable to be used

Recommended

extension(s)

–outFileName, -out, -o plot image

heatmap_img

(required)

“.png” or

“.eps” or

“.pdf” or

“.svg”

–outFileSortedRegions

BED file with

sorted regions

regions “.bed”
–outFileNameMatrix

tab-separated matrix

of values underlying

the heatmap

heatmap_matrix “.tab”

Example

This wrapper can be used in the following way:

rule plot_heatmap:
    input:
         # matrix file from deepTools computeMatrix tool
         "matrix.gz"
    output:
        # Please note that --outFileSortedRegions and --outFileNameMatrix are exclusively defined via output files.
        # Usable output variables, their extensions and which option they implicitly call are listed here:
        #         https://snakemake-wrappers.readthedocs.io/en/stable/wrappers/deeptools/plotheatmap.html.
        heatmap_img="plot_heatmap/heatmap.png",  # required
        # optional output files
        regions="plot_heatmap/heatmap_regions.bed",
        heatmap_matrix="plot_heatmap/heatmap_matrix.tab"
    log:
        "logs/deeptools/heatmap.log"
    params:
        # optional parameters
        "--plotType=fill "
    wrapper:
        "0.72.0/bio/deeptools/plotheatmap"

Note that input, output and log file paths can be chosen freely. When running with

snakemake --use-conda

the software dependencies will be automatically deployed into an isolated environment before execution.

Software dependencies

  • deeptools==3.4.3

Input/Output

Input:

  • gzipped matrix file from deepTools computeMatrix (.gz)

Output:

  • plot file in image format (.png, .eps, .pdf or .svg) AND/OR
  • file with sorted regions after skipping zeros or min/max threshold values (.bed) AND/OR
  • tab-separated table for average profile (.tab)

Authors

  • Antonie Vietor

Code

__author__ = "Antonie Vietor"
__copyright__ = "Copyright 2020, Antonie Vietor"
__email__ = "antonie.v@gmx.de"
__license__ = "MIT"

from snakemake.shell import shell

log = snakemake.log_fmt_shell(stdout=True, stderr=True)

out_region = snakemake.output.get("regions")
out_matrix = snakemake.output.get("heatmap_matrix")

optional_output = ""

if out_region:
    optional_output += " --outFileSortedRegions {out_region} ".format(
        out_region=out_region
    )

if out_matrix:
    optional_output += " --outFileNameMatrix {out_matrix} ".format(
        out_matrix=out_matrix
    )

shell(
    "(plotHeatmap "
    "-m {snakemake.input[0]} "
    "-o {snakemake.output.heatmap_img} "
    "{optional_output} "
    "{snakemake.params}) {log}"
)