From 7531c8ade87746859b0e24facde1439e52c05f63 Mon Sep 17 00:00:00 2001 From: Lucas Czech Date: Wed, 11 Jan 2023 14:21:51 -0800 Subject: [PATCH] Add java options to picard tools --- config.yaml | 8 ++++++++ rules/calling-bcftools.smk | 6 ++++-- rules/duplicates-picard.smk | 1 + rules/qc-bam.smk | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index 871f459..5acd061 100644 --- a/config.yaml +++ b/config.yaml @@ -562,6 +562,14 @@ params: # Valid values: "processed", "merged" CollectMultipleMetrics-bams: "processed" + # For some specific error cases, it might be necessary to adjust java settings for the tools, + # such as `-Xmx10g` to increase the available memory within the Java virtual machine + # (because it limits itself otherwise, instead of using the available memory...). + # The last option, SortVcf-java-opts, is used by bcftools when using contig-group-size > 0. + MarkDuplicates-java-opts: "" + CollectMultipleMetrics-java-opts: "" + SortVcf-java-opts: "" + # ---------------------------------------------------------------------- # dedup # ---------------------------------------------------------------------- diff --git a/rules/calling-bcftools.smk b/rules/calling-bcftools.smk index ec7f9a7..ad8f063 100644 --- a/rules/calling-bcftools.smk +++ b/rules/calling-bcftools.smk @@ -65,9 +65,10 @@ if config["settings"].get("contig-group-size"): " USE_JDK_DEFLATER=true USE_JDK_INFLATER=true" if platform.system() == "Darwin" else "" - ) + ), + java_opts=config["params"]["picard"]["SortVcf-java-opts"] log: - "logs/vcflib/sort-genotyped.log" + "logs/picard/sort-genotyped.log" benchmark: "benchmarks/picard/sort-genotyped.bench.log" conda: @@ -75,6 +76,7 @@ if config["settings"].get("contig-group-size"): shell: # Weird new picard syntax... "picard SortVcf " + "{params.java_opts} " "INPUT={input.vcf} " "OUTPUT={output.vcf} " "SEQUENCE_DICTIONARY={input.refdict} " diff --git a/rules/duplicates-picard.smk b/rules/duplicates-picard.smk index 7bd3a34..d7ded39 100644 --- a/rules/duplicates-picard.smk +++ b/rules/duplicates-picard.smk @@ -31,6 +31,7 @@ rule mark_duplicates: # and some system libraries, leading the JRE to exit with fatal error SIGSEGV caused by # libgkl_compression, see https://github.com/broadinstitute/picard/issues/1329. # Hence, on MacOS, we add the two settings recommended by the github issue. + config["params"]["picard"]["MarkDuplicates-java-opts"] + " " + config["params"]["picard"]["MarkDuplicates"] + ( " USE_JDK_DEFLATER=true USE_JDK_INFLATER=true" if platform.system() == "Darwin" diff --git a/rules/qc-bam.smk b/rules/qc-bam.smk index bb4c50b..d8a04bd 100644 --- a/rules/qc-bam.smk +++ b/rules/qc-bam.smk @@ -191,6 +191,7 @@ rule picard_collectmultiplemetrics: log: "logs/picard/multiple_metrics/{sample}.log" params: + config["params"]["picard"]["CollectMultipleMetrics-java-opts"] + " " + config["params"]["picard"]["CollectMultipleMetrics-extra"] + ( " USE_JDK_DEFLATER=true USE_JDK_INFLATER=true" if platform.system() == "Darwin"