GATK DENOISEREADCOUNTS

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

Denoises read counts to produce denoised copy ratios

URL: https://gatk.broadinstitute.org/hc/en-us/articles/13832751133851-DenoiseReadCounts

Example

This wrapper can be used in the following way:

rule denoisereadcounts:
    input:
        hdf5=["a.counts.hdf5"],
    output:
        std_copy_ratio="a.standardizedCR.tsv",
        denoised_copy_ratio="a.denoisedCR.tsv",
    log:
        "logs/gatk/denoisereadcounts.log",
    params:
        extra="",  # optional
        java_opts="",  # optional
    resources:
        mem_mb=1024,
    wrapper:
        "v3.9.0-14-g476823b/bio/gatk/denoisereadcounts"

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

  • gatk4=4.5.0.0

  • snakemake-wrapper-utils=0.6.2

Input/Output

Input:

  • hdf5: TSV or HDF5 file with counts from CollectReadCounts.

  • pon: Panel-of-normals from CreateReadCountPanelOfNormals (optional)

  • gc_interval: GC-content annotated-intervals from {@link AnnotateIntervals (optional)

Output:

  • std_copy_ratio: Standardized-copy-ratios file

  • denoised_copy_ratio: Denoised-copy-ratios file

Params

  • java_opts: additional arguments to be passed to the java compiler, e.g. “-XX:ParallelGCThreads=10” (not for -XmX or -Djava.io.tmpdir, since they are handled automatically).

  • extra: additional program arguments.

Authors

  • Patrik Smeds

Code

__author__ = "Patrik Smeds"
__copyright__ = "Copyright 2023, Patrik Smed"
__email__ = "patrik.smeds@gmail.com"
__license__ = "MIT"


import tempfile
from snakemake.shell import shell
from snakemake_wrapper_utils.java import get_java_opts


pon = snakemake.input.get("pon", "")
if pon:
    pon = f"--count-panel-of-normals {snakemake.input.pon}"


gc_interval = snakemake.input.get("gc_interval", "")
if gc_interval:
    gc_interval = f"--annotated-intervals {snakemake.input.gc_interval}"


extra = snakemake.params.get("extra", "")
java_opts = get_java_opts(snakemake)

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

with tempfile.TemporaryDirectory() as tmpdir:
    shell(
        "gatk --java-options '{java_opts}' DenoiseReadCounts"
        " --input {snakemake.input.hdf5}"
        " {pon}"
        " {gc_interval}"
        " {extra}"
        " --standardized-copy-ratios {snakemake.output.std_copy_ratio}"
        " --denoised-copy-ratios {snakemake.output.denoised_copy_ratio}"
        " --tmp-dir {tmpdir}"
        " {log}"
    )