diff --git a/bio/gatk/learnreadorientationmodel/environment.yaml b/bio/gatk/learnreadorientationmodel/environment.yaml new file mode 100644 index 00000000000..1f691037aa6 --- /dev/null +++ b/bio/gatk/learnreadorientationmodel/environment.yaml @@ -0,0 +1,7 @@ +channels: + - conda-forge + - bioconda + - nodefaults +dependencies: + - gatk4 =4.2 + - snakemake-wrapper-utils =0.3 diff --git a/bio/gatk/learnreadorientationmodel/meta.yaml b/bio/gatk/learnreadorientationmodel/meta.yaml new file mode 100644 index 00000000000..502c94d0536 --- /dev/null +++ b/bio/gatk/learnreadorientationmodel/meta.yaml @@ -0,0 +1,12 @@ +name: GATK LearnOrientationModel +url: https://gatk.broadinstitute.org/hc/en-us/articles/4405451237147-LearnReadOrientationModel +description: Get the maximum likelihood estimates of artifact prior probabilities in the orientation bias mixture model filter +authors: + - Thibault Dayris +input: + - f1r2: Path to one or multiple f1r2 files +output: + - Path to tar.gz of artifact prior tables +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. diff --git a/bio/gatk/learnreadorientationmodel/test/Snakefile b/bio/gatk/learnreadorientationmodel/test/Snakefile new file mode 100644 index 00000000000..df7f91377f8 --- /dev/null +++ b/bio/gatk/learnreadorientationmodel/test/Snakefile @@ -0,0 +1,13 @@ +rule test_gatk_learnreadorientationmodel: + input: + f1r2="f1r2.tar.gz", + output: + "artifacts_prior.tar.gz", + resources: + mem_mb=1024, + params: + extra="", + log: + "learnreadorientationbias.log", + wrapper: + "master/bio/gatk/learnreadorientationmodel" diff --git a/bio/gatk/learnreadorientationmodel/test/f1r2.tar.gz b/bio/gatk/learnreadorientationmodel/test/f1r2.tar.gz new file mode 100644 index 00000000000..20f588be9fa Binary files /dev/null and b/bio/gatk/learnreadorientationmodel/test/f1r2.tar.gz differ diff --git a/bio/gatk/learnreadorientationmodel/wrapper.py b/bio/gatk/learnreadorientationmodel/wrapper.py new file mode 100644 index 00000000000..da10f054025 --- /dev/null +++ b/bio/gatk/learnreadorientationmodel/wrapper.py @@ -0,0 +1,36 @@ +#!/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 + ) diff --git a/test.py b/test.py index 9d6fb8ce681..fc09d38cd13 100644 --- a/test.py +++ b/test.py @@ -3652,6 +3652,14 @@ def test_gatk_mutect(): ) +@skip_if_not_modified +def test_gatk_learn_read_orientation(): + run( + "bio/gatk/learnreadorientationmodel", + ["snakemake", "--cores", "1", "--use-conda"] + ) + + @skip_if_not_modified def test_gatk_getpileupsummaries(): run(