.. _`bio/gatk/learnreadorientationmodel`: GATK LEARNREADORIENTATIONMODEL ============================== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/gatk/learnreadorientationmodel?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/gatk/learnreadorientationmodel Get the maximum likelihood estimates of artifact prior probabilities in the orientation bias mixture model filter **URL**: https://gatk.broadinstitute.org/hc/en-us/articles/9570329571227-LearnReadOrientationModel Example ------- This wrapper can be used in the following way: .. code-block:: python rule test_gatk_learnreadorientationmodel: input: f1r2="f1r2.tar.gz", output: "artifacts_prior.tar.gz", resources: mem_mb=1024, params: extra="", log: "learnreadorientationbias.log", wrapper: "v3.0.1/bio/gatk/learnreadorientationmodel" Note that input, output and log file paths can be chosen freely. When running with .. code-block:: bash 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. "-XX:ParallelGCThreads=10" (not for `-XmX` or `-Djava.io.tmpdir`, since they are handled automatically). * The `extra` param allows for additional program arguments. Software dependencies --------------------- * ``gatk4=4.4.0.0`` * ``snakemake-wrapper-utils=0.6.2`` Input/Output ------------ **Input:** * ``f1r2``: Path to one or multiple f1r2 files **Output:** * Path to tar.gz of artifact prior tables Authors ------- * Thibault Dayris Code ---- .. code-block:: python #!/usr/bin/env python3 # coding: utf-8 """Snakemake wrapper for GATK4 LearnReadOrientationModel""" __author__ = "Thibault Dayris" __copyright__ = "Copyright 2022, Dayris Thibault" __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) f1r2 = "--input " if isinstance(snakemake.input["f1r2"], list): # Case user provided a list of archives f1r2 += "--input ".join(snakemake.input["f1r2"]) else: # Case user provided a single archive as a string f1r2 += snakemake.input["f1r2"] with tempfile.TemporaryDirectory() as tmpdir: shell( "gatk --java-options '{java_opts}' LearnReadOrientationModel" # Tool and its subprocess " {f1r2}" # Path to input mapping file " {extra}" # Extra parameters " --tmp-dir {tmpdir}" " --output {snakemake.output[0]}" # Path to output vcf file " {log}" # Logging behaviour ) .. |nl| raw:: html