GATK GET PILEUP SUMMARIES

Summarizes counts of reads that support reference, alternate and other alleles

URL: https://gatk.broadinstitute.org/hc/en-us/articles/360037593451-GetPileupSummaries

Example

This wrapper can be used in the following way:

rule test_gatk_get_pileup_summaries:
    input:
        bam="mapped/a.bam",
        intervals="genome/intervals.bed",
        variants="genome/variants.vcf.gz",
    output:
        "summaries.table",
    threads: 1
    resources:
        mem_mb=1024,
    params:
        extra="",
    log:
        "logs/summary.log",
    wrapper:
        "v1.9.0/bio/gatk/getpileupsummaries"

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.2
  • snakemake-wrapper-utils=0.3

Input/Output

Input:

  • bam: Path to bam file (sorted and indexed)
  • intervals: Path to one or more BED genomic intervals over which to operate
  • variants: Path to a VCF containing allele frequencies (pbgzipped and tabix indexed)

Output:

  • Path to output table

Params

  • extra: Optional parameters

Authors

Code

#!/usr/bin/env python3
# coding: utf-8

"""Snakemake wrapper for GATK GetPileupSummaries"""

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


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

log = snakemake.log_fmt_shell(stdout=True, stderr=True)
extra = snakemake.params.get("extra", "")
java_opts = get_java_opts(snakemake)

with tempfile.TemporaryDirectory() as tempdir:
    shell(
        "gatk GetPileupSummaries "
        "--java-options '{java_opts}' "
        "--input {snakemake.input.bam} "
        "--intervals {snakemake.input.intervals} "
        "--variant {snakemake.input.variants} "
        "--output {snakemake.output[0]} "
        "--tmp-dir {tempdir} "
        "{extra} "
        "{log} "
    )