gatk3 gatk3 indelrealigner

gatk3 indelrealigner

Version:
3.8
Identifier: TL_6ad060_6f.80
Tool
1__author__ = "Patrik Smeds"
2__copyright__ = "Copyright 2019, Patrik Smeds"
3__email__ = "patrik.smeds@gmail.com.com"
4__license__ = "MIT"
5
6import os
7
8from snakemake.shell import shell
9from snakemake_wrapper_utils.java import get_java_opts
10
11input_known = snakemake.input.known
12extra = snakemake.params.get("extra", "")
13java_opts = get_java_opts(snakemake)
14
15
16bed = snakemake.input.get("bed", None)
17if bed is not None:
18    bed = "-L " + bed
19else:
20    bed = ""
21
22
23input_known_string = ""
24for known in input_known:
25    input_known_string = input_known_string + " -known {}".format(known)
26
27
28output_bai = snakemake.output.get("bai", None)
29if output_bai is None:
30    extra += " --disable_bam_indexing"
31
32
33log = snakemake.log_fmt_shell(stdout=True, stderr=True)
34
35
36shell(
37    "gatk3 {java_opts} -T IndelRealigner"
38    " {extra}"
39    " -I {snakemake.input.bam}"
40    " -R {snakemake.input.ref}"
41    " {input_known_string}"
42    " {bed}"
43    " --targetIntervals {snakemake.input.target_intervals}"
44    " -o {snakemake.output.bam}"
45    " {log}"
46)
47