GATK3 PRINTREADS

Run gatk3 PrintReads

Software dependencies

  • gatk ==3.8

Example

This wrapper can be used in the following way:

rule printreads:
    input:
        bam="mapped/{sample}.bam",
        ref="genome.fasta",
        recal_data="{sample}.recal_data_table"
    output:
        "alignment/{sample}.bqsr.bam"
    log:
        "logs/gatk/bqsr/{sample}..log"
    params:
        extra="",  # optional
        java_opts="",
    threads: 16
    wrapper:
        "bio/gatk3/printreads"

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

  • The java_opts param allows for additional arguments to be passed to the java compiler, e.g. “-Xmx4G” for one, and “-Xmx4G -XX:ParallelGCThreads=10” for two options.
  • The extra param alllows for additional program arguments.
  • For more inforamtion see, https://software.broadinstitute.org/gatk/documentation/article?id=11050
  • Gatk3.jar is not included in the bioconda package, i.e it need to be added to the conda environment manually.

Authors

  • Patrik Smeds

Code

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

import os

from snakemake.shell import shell

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

input_bam = snakemake.input.bam
input_recal_data = snakemake.input.recal_data
input_ref = snakemake.input.ref

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

shell(
    "gatk3 {java_opts} -T PrintReads"
    " {extra}"
    " -I {input_bam}"
    " -R {input_ref}"
    " -BQSR {input_recal_data}"
    " -o {snakemake.output}"
    " {log}"
)