.. _`bio/gatk3/indelrealigner`: GATK3 INDELREALIGNER ==================== .. image:: https://img.shields.io/github/issues-pr/snakemake/snakemake-wrappers/bio/gatk3/indelrealigner?label=version%20update%20pull%20requests :target: https://github.com/snakemake/snakemake-wrappers/pulls?q=is%3Apr+is%3Aopen+label%3Abio/gatk3/indelrealigner Run gatk3 IndelRealigner Example ------- This wrapper can be used in the following way: .. code-block:: python rule indelrealigner: input: bam="{sample}.bam", bai="{sample}.bai", ref="genome.fasta", fai="genome.fasta.fai", dict="genome.dict", known="dbsnp.vcf.gz", known_idx="dbsnp.vcf.gz.tbi", target_intervals="{sample}.intervals", output: bam="{sample}.realigned.bam", bai="{sample}.realigned.bai", log: "logs/gatk3/indelrealigner/{sample}.log", params: extra="--defaultBaseQualities 20 --filter_reads_with_N_cigar", # optional threads: 16 resources: mem_mb=1024, wrapper: "v4.6.0-24-g250dd3e/bio/gatk3/indelrealigner" 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" (memory is automatically inferred from `resources` and temp dir from `output.java_temp`. * The `extra` param allows for additional program arguments. * For more information see, https://github.com/broadinstitute/gatk-docs/blob/master/gatk3-tutorials/(howto)_Perform_local_realignment_around_indels.md * Gatk3.jar is not included in the bioconda package, i.e it need to be added to the conda environment manually. Software dependencies --------------------- * ``gatk=3.8`` * ``python=3.12.6`` * ``snakemake-wrapper-utils=0.6.2`` Input/Output ------------ **Input:** * bam file * reference genome * target intervals to realign * bed file (optional) * vcf files known variation (optional) **Output:** * indel realigned bam file * indel realigned bai file (optional) * temp dir (optional) Authors ------- * Patrik Smeds * Filipe G. Vieira Code ---- .. code-block:: python __author__ = "Patrik Smeds" __copyright__ = "Copyright 2019, Patrik Smeds" __email__ = "patrik.smeds@gmail.com.com" __license__ = "MIT" import os from snakemake.shell import shell from snakemake_wrapper_utils.java import get_java_opts extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) java_opts = get_java_opts(snakemake) bed = snakemake.input.get("bed", "") if bed: bed = f"--intervals {bed}" known = snakemake.input.get("known", "") if known: if isinstance(known, str): known = f"--knownAlleles {known}" else: known = list(map("----knownAlleles {}".format, known)) output_bai = snakemake.output.get("bai", None) if output_bai is None: extra += " --disable_bam_indexing" shell( "gatk3 {java_opts}" " --analysis_type IndelRealigner" " --input_file {snakemake.input.bam}" " --reference_sequence {snakemake.input.ref}" " {known}" " {bed}" " --targetIntervals {snakemake.input.target_intervals}" " {extra}" " --out {snakemake.output.bam}" " {log}" ) .. |nl| raw:: html