DEEPTOOLS PLOT CORRELATION
Analysis and visualization of sample correlations based on the output of multiBamSummary or multiBigwigSummary.
URL: https://deeptools.readthedocs.io/en/develop/content/tools/plotCorrelation.html
Example
This wrapper can be used in the following way:
rule test_deeptools_plot_correlation:
input:
"bins.npz",
output:
plot="bins.svg",
counts="counts.tsv", # Optional output file
threads: 1
params:
extra="--skipZeros", # Any optional parameters besides IO and --plotFileFormat
correlation="spearman", # either spearman or pearson
plot="heatmap", # either heatmap or scatterplot
log:
"corr.log",
wrapper:
"v5.0.1/bio/deeptools/plotcorrelation"
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 plot file extension.
Software dependencies
deeptools=3.5.5
Input/Output
Input:
Path to compressed matrix file
Output:
plot
: Path to scatterplot/heatmap. The available formats are .png, .eps, .pdf and .svgmatrix
: Optional path to pairwise correlation values (TSV)
Params
extra
: Optional parameters except IO and –plotFileFormat.correlation
: Either spearman, or pearson. No default is set in DeepTools. This wrapper considers spearman as default value.plot
: Either heatmap, or scatterplot. No default is set in DeepTools. This wrapper considers heatmap as default value.
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 required arguments
cor_method = snakemake.params.get("correlation", "spearman")
what_to_plot = snakemake.params.get("plot", "heatmap")
# Get plot file format
fmt = str(snakemake.output["plot"]).split(".")[-1].lower()
# Get optional output matrix
corr_matrix = snakemake.output.get("counts")
if corr_matrix:
extra += f" --outFileCorMatrix {corr_matrix} "
shell(
"plotCorrelation "
"--corData {snakemake.input[0]} "
"--corMethod {cor_method} "
"--whatToPlot {what_to_plot} "
"--plotFile {snakemake.output.plot} "
"--plotFileFormat {fmt} "
"{extra} {log}"
)