DEEPTOOLS PLOT CORRELATION

https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/deeptools/plotpca?label=version%20update%20pull%20requests

Generate a principal component analysis (PCA) plot from multiBamSummary or multiBigwigSummary output.

URL: https://deeptools.readthedocs.io/en/develop/content/tools/plotPCA.html

Example

This wrapper can be used in the following way:

rule test_deeptools_plot_pca:
    input:
        "bins.npz",
    output:
        plot="pca.svg",
        matrix="pca.tab",  # Optional
    threads: 1
    params:
        extra="--ntop 5",
    log:
        "pca.log",
    wrapper:
        "v5.0.1/bio/deeptools/plotpca"

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.

Notes

Plot file format is automatically inferred from output.plot extension.

Software dependencies

  • deeptools=3.5.5

Input/Output

Input:

  • Path to compressed matrix file

Output:

  • plot: Path to PCA plot. The available options are .png, .eps, .pdf and .svg.

  • matrix: Optional path to the data underlying the plot.

Params

  • extra: Optional parameters besides IO and –plotFileFormat

Authors

  • Thibault Dayris

Code

# coding: utf-8

__author__ = "Thibault Dayris"
__copyright__ = "Copyright 2024, Thibault Dayris"
__email__ = "thibault.dayris@gustaveroussy.fr"
__license__ = "MIT"


from snakemake.shell import shell

# Optional parameters
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
extra = snakemake.params.get("extra", "")


# Get plot file format
fmt = str(snakemake.output["plot"]).split(".")[-1].lower()

# Get optional output matrix
pca_tab = snakemake.output.get("matrix")
if pca_tab:
    extra += f" --outFileNameData {pca_tab} "

shell(
    "plotPCA "
    "--corData {snakemake.input[0]} "
    "--plotFile {snakemake.output.plot} "
    "--plotFileFormat {fmt} "
    "{extra} {log}"
)