DEEPTOOLS PLOTPROFILE

deepTools plotProfile plots scores over sets of genomic regions. As input, it requires a matrix file generated by deepToolscomputeMatrix. For usage information about deepTools plotProfile, 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 for them (see example Snakemake rule below).

PlotProfile option Output

Name of output

variable to be used

Recommended

extension(s)

–outFileName, -out, -o profile plot

plot_img

(required)

“.png” or

“.eps” or

“.pdf” or

“.svg”

–outFileSortedRegions

BED file with

sorted regions

regions “.bed”
–outFileNameData

tab-separated table

for average profile

data “.tab”

Example

This wrapper can be used in the following way:

rule plot_profile:
    input:
         # matrix file from deepTools computeMatrix tool
         "matrix.gz"
    output:
        # Please note that --outFileSortedRegions and --outFileNameData 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/plotprofile.html.
        # Through the output variables image file and more output options for plot profile can be selected.
        plot_img="plot_profile/plot.png",  # required
        # optional output files
        regions="plot_profile/regions.bed",
        data="plot_profile/data.tab"
    log:
        "logs/deeptools/plot_profile.log"
    params:
        # optional parameters
        "--plotType=fill "
        "--perGroup "
        "--colors red yellow blue "
        "--dpi 150 "
    wrapper:
        "0.72.0/bio/deeptools/plotprofile"

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_data = snakemake.output.get("data")

optional_output = ""

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

if out_data:
    optional_output += " --outFileNameData {out_data} ".format(out_data=out_data)

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