DEEPTOOLS MULTI BIGWIG SUMMARY

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

Compute the average scores for each of the files in every genomic region.

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

Example

This wrapper can be used in the following way:

rule test_deeptools_multibwsummary_bins:
    input:
        bw=["a.bw", "b.bw"],
        blacklist="blacklist.bed", # Optional
    output:
        npz="bins.npz",
        counts="bins.counts",
    threads: 1
    params:
        extra="",
    log:
        "bins.logs"
    wrapper:
        "v5.6.1-7-g2ff6d79/bio/deeptools/multibigwigsummary"

rule test_deeptools_multibwsummary_bed:
    input:
        bw=["a.bw", "b.bw"],
        bed="intervals.bed",
        # blacklist="", # Optional
    output:
        npz="bed.npz",
        counts="bed.counts",
    threads: 1
    params:
        extra="",
    log:
        "bins.logs"
    wrapper:
        "v5.6.1-7-g2ff6d79/bio/deeptools/multibigwigsummary"

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

Subcomand is automatically inferred from the presence of input.bed (optional) key.

Software dependencies

  • deeptools=3.5.6

Input/Output

Input:

  • bw: Path to a bigwig file, or a list of bigwig files.

  • blacklist: Optional path to a BED file covering regions to exclude.

  • bed: Path to a bed file to limit the analysis of regions. This triggers the subcommand BED-file. Leave empty to run the bins subcommand.

Output:

  • npz: Path to the compressed matrix file.

  • counts: Path to average scores per region for each bigwig.

Params

  • extra: Optional arguments for multiBigwigSummary besides IO and processor.

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", "")

blacklist = snakemake.input.get("blacklist")
if blacklist:
    extra += f" --blackListFileName {blacklist} "

out_raw_counts = snakemake.output.get("counts")
if out_raw_counts:
    extra += f" --outRawCounts {out_raw_counts} "

bed = snakemake.input.get("bed")
subcommand = "bins"
if bed:
    subcommand = "BED-file"
    extra += f" --BED {bed} "


shell(
    "multiBigwigSummary {subcommand} "
    "--bwfiles {snakemake.input.bw} "
    "--outFileName {snakemake.output.npz} "
    "--numberOfProcessors {snakemake.threads} "
    "{extra} {log}"
)