diff --git a/src/main/java/org/broadinstitute/hellbender/tools/copynumber/DetermineGermlineContigPloidy.java b/src/main/java/org/broadinstitute/hellbender/tools/copynumber/DetermineGermlineContigPloidy.java
index c29d1067ef8..fe07f4619be 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/copynumber/DetermineGermlineContigPloidy.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/copynumber/DetermineGermlineContigPloidy.java
@@ -58,6 +58,14 @@
* the python environment is already set up. Otherwise, the environment must be created and activated as described in the
* main GATK README.md file.
*
+ * Advanced users may wish to set the THEANO_FLAGS
environment variable to override the GATK theano
+ * configuration. For example, by running
+ * THEANO_FLAGS="base_compiledir=PATH/TO/BASE_COMPILEDIR" gatk DetermineGermlineContigPloidy ...
, users can specify
+ * the theano compilation directory (which is set to $HOME/.theano
by default). See theano documentation
+ * at
+ * http://deeplearning.net/software/theano/library/config.html.
+ *
+ *
* Tool run modes
*
* This tool has two operation modes as described below:
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/copynumber/GermlineCNVCaller.java b/src/main/java/org/broadinstitute/hellbender/tools/copynumber/GermlineCNVCaller.java
index 8875ee448b1..99dfa000c72 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/copynumber/GermlineCNVCaller.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/copynumber/GermlineCNVCaller.java
@@ -70,6 +70,14 @@
* the python environment is already set up. Otherwise, the environment must be created and activated as described in the
* main GATK README.md file.
*
+ * Advanced users may wish to set the THEANO_FLAGS
environment variable to override the GATK theano
+ * configuration. For example, by running
+ * THEANO_FLAGS="base_compiledir=PATH/TO/BASE_COMPILEDIR" gatk GermlineCNVCaller ...
, users can specify
+ * the theano compilation directory (which is set to $HOME/.theano
by default). See theano documentation
+ * at
+ * http://deeplearning.net/software/theano/library/config.html.
+ *
+ *
* Tool run modes
*
* - COHORT mode:
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/copynumber/PostprocessGermlineCNVCalls.java b/src/main/java/org/broadinstitute/hellbender/tools/copynumber/PostprocessGermlineCNVCalls.java
index e7051457866..73eb2200351 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/copynumber/PostprocessGermlineCNVCalls.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/copynumber/PostprocessGermlineCNVCalls.java
@@ -61,7 +61,24 @@
* calls of {@link DetermineGermlineContigPloidy}.
*
* Finally, the tool concatenates posterior means for denoised copy ratios from all the call shards produced by
- * the {@link GermlineCNVCaller} into a single file.
+ * the {@link GermlineCNVCaller} into a single file.
+ *
+ * Python environment setup
+ *
+ * The computation done by this tool, aside from input data parsing and validation, is performed outside of the Java
+ * Virtual Machine and using the gCNV computational python module, namely {@code gcnvkernel}. It is crucial that
+ * the user has properly set up a python conda environment with {@code gcnvkernel} and its dependencies
+ * installed. If the user intends to run {@link PostprocessGermlineCNVCalls} using one of the official GATK Docker images,
+ * the python environment is already set up. Otherwise, the environment must be created and activated as described in the
+ * main GATK README.md file.
+ *
+ * Advanced users may wish to set the THEANO_FLAGS
environment variable to override the GATK theano
+ * configuration. For example, by running
+ * THEANO_FLAGS="base_compiledir=PATH/TO/BASE_COMPILEDIR" gatk PostprocessGermlineCNVCalls ...
, users can specify
+ * the theano compilation directory (which is set to $HOME/.theano
by default). See theano documentation
+ * at
+ * http://deeplearning.net/software/theano/library/config.html.
+ *
*
* Required inputs:
*
diff --git a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_denoising_calling.py b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_denoising_calling.py
index 54cbd2a834e..0fe7b4f6ce2 100644
--- a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_denoising_calling.py
+++ b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_denoising_calling.py
@@ -1,8 +1,11 @@
import os
# set theano flags
-os.environ["THEANO_FLAGS"] = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
- "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+user_theano_flags = os.environ.get("THEANO_FLAGS")
+default_theano_flags = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
+ "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+theano_flags = default_theano_flags + ("" if user_theano_flags is None else "," + user_theano_flags)
+os.environ["THEANO_FLAGS"] = theano_flags
import logging
import argparse
@@ -148,6 +151,8 @@ def update_args_dict_from_saved_model(input_model_path: str,
args = parser.parse_args()
gcnvkernel.cli_commons.set_logging_config_from_args(args)
+ logger.info("THEANO_FLAGS environment variable has been set to: {theano_flags}".format(theano_flags=theano_flags))
+
# check gcnvkernel version in the input model path
gcnvkernel.io_commons.check_gcnvkernel_version_from_path(args.input_model_path)
diff --git a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_determine_ploidy_and_depth.py b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_determine_ploidy_and_depth.py
index 0929dbf2048..1ffa372d5f7 100644
--- a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_determine_ploidy_and_depth.py
+++ b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/case_determine_ploidy_and_depth.py
@@ -1,12 +1,18 @@
import os
# set theano flags
-os.environ["THEANO_FLAGS"] = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
- "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+user_theano_flags = os.environ.get("THEANO_FLAGS")
+default_theano_flags = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
+ "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+theano_flags = default_theano_flags + ("" if user_theano_flags is None else "," + user_theano_flags)
+os.environ["THEANO_FLAGS"] = theano_flags
+import logging
import argparse
import gcnvkernel
+logger = logging.getLogger("case_determine_ploidy_and_depth")
+
parser = argparse.ArgumentParser(description="gCNV contig ploidy and read depth determination tool",
formatter_class=gcnvkernel.cli_commons.GCNVHelpFormatter)
@@ -67,6 +73,8 @@
args = parser.parse_args()
gcnvkernel.cli_commons.set_logging_config_from_args(args)
+ logger.info("THEANO_FLAGS environment variable has been set to: {theano_flags}".format(theano_flags=theano_flags))
+
# check gcnvkernel version in the input model path
gcnvkernel.io_commons.check_gcnvkernel_version_from_path(args.input_model_path)
diff --git a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_denoising_calling.py b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_denoising_calling.py
index aa1ccfd2348..20927c3f55d 100644
--- a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_denoising_calling.py
+++ b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_denoising_calling.py
@@ -1,13 +1,16 @@
import os
-import shutil
# set theano flags
-os.environ["THEANO_FLAGS"] = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
- "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+user_theano_flags = os.environ.get("THEANO_FLAGS")
+default_theano_flags = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
+ "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+theano_flags = default_theano_flags + ("" if user_theano_flags is None else "," + user_theano_flags)
+os.environ["THEANO_FLAGS"] = theano_flags
import logging
import argparse
import gcnvkernel
+import shutil
logger = logging.getLogger("cohort_denoising_calling")
@@ -97,6 +100,8 @@
args = parser.parse_args()
gcnvkernel.cli_commons.set_logging_config_from_args(args)
+ logger.info("THEANO_FLAGS environment variable has been set to: {theano_flags}".format(theano_flags=theano_flags))
+
# load modeling interval list
modeling_interval_list = gcnvkernel.io_intervals_and_counts.load_interval_list_tsv_file(args.modeling_interval_list)
diff --git a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_determine_ploidy_and_depth.py b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_determine_ploidy_and_depth.py
index 1c557aac27d..6343776c37b 100644
--- a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_determine_ploidy_and_depth.py
+++ b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/cohort_determine_ploidy_and_depth.py
@@ -1,13 +1,19 @@
import os
# set theano flags
-os.environ["THEANO_FLAGS"] = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
- "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+user_theano_flags = os.environ.get("THEANO_FLAGS")
+default_theano_flags = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
+ "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+theano_flags = default_theano_flags + ("" if user_theano_flags is None else "," + user_theano_flags)
+os.environ["THEANO_FLAGS"] = theano_flags
+import logging
import argparse
import gcnvkernel
import shutil
+logger = logging.getLogger("cohort_determine_ploidy_and_depth")
+
parser = argparse.ArgumentParser(description="gCNV contig ploidy and read depth determination tool",
formatter_class=gcnvkernel.cli_commons.GCNVHelpFormatter)
@@ -74,6 +80,8 @@
args = parser.parse_args()
gcnvkernel.cli_commons.set_logging_config_from_args(args)
+ logger.info("THEANO_FLAGS environment variable has been set to: {theano_flags}".format(theano_flags=theano_flags))
+
# read contig ploidy prior map from file
contig_ploidy_prior_map = gcnvkernel.io_ploidy.get_contig_ploidy_prior_map_from_tsv_file(
args.contig_ploidy_prior_table)
diff --git a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/segment_gcnv_calls.py b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/segment_gcnv_calls.py
index 87f4557fd6e..cf7d94868c2 100644
--- a/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/segment_gcnv_calls.py
+++ b/src/main/resources/org/broadinstitute/hellbender/tools/copynumber/segment_gcnv_calls.py
@@ -1,8 +1,11 @@
import os
# set theano flags
-os.environ["THEANO_FLAGS"] = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
- "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+user_theano_flags = os.environ.get("THEANO_FLAGS")
+default_theano_flags = "device=cpu,floatX=float64,optimizer=fast_run,compute_test_value=ignore," + \
+ "openmp=true,blas.ldflags=-lmkl_rt,openmp_elemwise_minsize=10"
+theano_flags = default_theano_flags + ("" if user_theano_flags is None else "," + user_theano_flags)
+os.environ["THEANO_FLAGS"] = theano_flags
import logging
import argparse
@@ -57,6 +60,8 @@
args = parser.parse_args()
gcnvkernel.cli_commons.set_logging_config_from_args(args)
+ logger.info("THEANO_FLAGS environment variable has been set to: {theano_flags}".format(theano_flags=theano_flags))
+
# load read depth and ploidy metadata
logger.info("Loading ploidy calls...")
logger.debug("Ploidy calls path: {0}".format(args.ploidy_calls_path))