Skip to content

Commit

Permalink
Standardized use of mem parameters in CNV WDLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelklee committed Jan 17, 2018
1 parent bec3701 commit f9b2701
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
10 changes: 6 additions & 4 deletions scripts/cnv_wdl/cnv_common_tasks.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ task CollectCounts {
Int? preemptible_attempts
Int? disk_space_gb

Int machine_mem = select_first([mem, 8]) * 1000
Int command_mem = machine_mem - 1000

# Sample name is derived from the bam filename
String base_filename = basename(bam, ".bam")
String counts_filename = if !defined(format) then "${base_filename}.counts.hdf5" else "${base_filename}.counts.tsv"
Expand All @@ -100,7 +103,7 @@ task CollectCounts {
set -e
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}

gatk --java-options "-Xmx${default="8" mem}g" CollectFragmentCounts \
gatk --java-options "-Xmx${command_mem}m" CollectFragmentCounts \
--input ${bam} \
-L ${intervals} \
--format ${default="HDF5" format} \
Expand All @@ -110,7 +113,7 @@ task CollectCounts {

runtime {
docker: "${gatk_docker}"
memory: select_first([mem, 8]) + " GB"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space_gb, ceil(size(bam, "GB")) + 50]) + " HDD"
preemptible: select_first([preemptible_attempts, 5])
}
Expand All @@ -137,8 +140,7 @@ task CollectAllelicCounts {
Int? preemptible_attempts
Int? disk_space_gb

# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem) then mem * 1000 else 13000
Int machine_mem = select_first([mem, 13]) * 1000
Int command_mem = machine_mem - 1000

# Sample name is derived from the bam filename
Expand Down
16 changes: 8 additions & 8 deletions scripts/cnv_wdl/germline/cnv_germline_case_workflow.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ task DetermineGermlineContigPloidyCaseMode {

# We do not expose Hybrid ADVI parameters -- the default values are decent
Int machine_mem = if defined(mem) then select_first([mem]) else 8
Float command_mem = machine_mem - 0.5
Int machine_mem = select_first([mem, 8]) * 1000
Int command_mem = machine_mem - 500

# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
Expand All @@ -218,7 +218,7 @@ task DetermineGermlineContigPloidyCaseMode {
mkdir input-contig-ploidy-model
tar xzf ${contig_ploidy_model_tar} -C input-contig-ploidy-model

gatk --java-options "-Xmx${machine_mem}g" DetermineGermlineContigPloidy \
gatk --java-options "-Xmx${command_mem}m" DetermineGermlineContigPloidy \
--input ${sep=" --input " read_count_files} \
--model input-contig-ploidy-model \
--output ${output_dir_} \
Expand All @@ -232,7 +232,7 @@ task DetermineGermlineContigPloidyCaseMode {

runtime {
docker: "${gatk_docker}"
memory: command_mem + " GB"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space_gb, 150]) + " HDD"
preemptible: select_first([preemptible_attempts, 2])
cpu: select_first([cpu, 8])
Expand Down Expand Up @@ -293,8 +293,8 @@ task GermlineCNVCallerCaseMode {
Float? caller_admixing_rate
Boolean? disable_annealing

Int machine_mem = if defined(mem) then select_first([mem]) else 8
Float command_mem = machine_mem - 0.5
Int machine_mem = select_first([mem, 8]) * 1000
Int command_mem = machine_mem - 500

# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
Expand All @@ -312,7 +312,7 @@ task GermlineCNVCallerCaseMode {
mkdir gcnv-model
tar xzf ${gcnv_model_tar} -C gcnv-model

gatk --java-options "-Xmx${machine_mem}g" GermlineCNVCaller \
gatk --java-options "-Xmx${command_mem}m" GermlineCNVCaller \
--run-mode CASE \
--input ${sep=" --input " read_count_files} \
--contig-ploidy-calls contig-ploidy-calls-dir \
Expand Down Expand Up @@ -353,7 +353,7 @@ task GermlineCNVCallerCaseMode {

runtime {
docker: "${gatk_docker}"
memory: command_mem + " GB"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space_gb, 150]) + " HDD"
preemptible: select_first([preemptible_attempts, 2])
cpu: select_first([cpu, 8])
Expand Down
16 changes: 8 additions & 8 deletions scripts/cnv_wdl/germline/cnv_germline_cohort_workflow.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ task DetermineGermlineContigPloidyCohortMode {

# We do not expose Hybrid ADVI parameters -- the default values are decent
Int machine_mem = if defined(mem) then select_first([mem]) else 8
Float command_mem = machine_mem - 0.5
Int machine_mem = select_first([mem, 8]) * 1000
Int command_mem = machine_mem - 500

# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
Expand All @@ -261,7 +261,7 @@ task DetermineGermlineContigPloidyCohortMode {
export MKL_NUM_THREADS=${default=8 cpu}
export OMP_NUM_THREADS=${default=8 cpu}

gatk --java-options "-Xmx${machine_mem}g" DetermineGermlineContigPloidy \
gatk --java-options "-Xmx${command_mem}m" DetermineGermlineContigPloidy \
--input ${sep=" --input " read_count_files} \
--contig-ploidy-priors ${contig_ploidy_priors} \
--output ${output_dir_} \
Expand All @@ -278,7 +278,7 @@ task DetermineGermlineContigPloidyCohortMode {

runtime {
docker: "${gatk_docker}"
memory: command_mem + " GB"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space_gb, 150]) + " HDD"
preemptible: select_first([preemptible_attempts, 2])
cpu: select_first([cpu, 8])
Expand Down Expand Up @@ -349,8 +349,8 @@ task GermlineCNVCallerCohortMode {
Float? caller_admixing_rate
Boolean? disable_annealing

Int machine_mem = if defined(mem) then select_first([mem]) else 8
Float command_mem = machine_mem - 0.5
Int machine_mem = select_first([mem, 8]) * 1000
Int command_mem = machine_mem - 500

# If optional output_dir not specified, use "out"
String output_dir_ = select_first([output_dir, "out"])
Expand All @@ -365,7 +365,7 @@ task GermlineCNVCallerCohortMode {
mkdir contig-ploidy-calls-dir
tar xzf ${contig_ploidy_calls_tar} -C contig-ploidy-calls-dir

gatk --java-options "-Xmx${machine_mem}g" GermlineCNVCaller \
gatk --java-options "-Xmx${command_mem}m" GermlineCNVCaller \
--run-mode COHORT \
-L ${intervals} \
--input ${sep=" --input " read_count_files} \
Expand Down Expand Up @@ -418,7 +418,7 @@ task GermlineCNVCallerCohortMode {

runtime {
docker: "${gatk_docker}"
memory: command_mem + " GB"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space_gb, 150]) + " HDD"
preemptible: select_first([preemptible_attempts, 2])
cpu: select_first([cpu, 8])
Expand Down
15 changes: 5 additions & 10 deletions scripts/cnv_wdl/somatic/cnv_somatic_pair_workflow.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ task DenoiseReadCounts {
Int? preemptible_attempts
Int disk_space_gb

# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem) then mem * 1000 else 13000
Int machine_mem = select_first([mem, 13]) * 1000
Int command_mem = machine_mem - 1000

command <<<
Expand Down Expand Up @@ -371,8 +370,7 @@ task ModelSegments {
Int? preemptible_attempts
Int disk_space_gb

# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem) then mem * 1000 else 13000
Int machine_mem = select_first([mem, 13]) * 1000
# ModelSegments seems to need at least 3GB of overhead to run
Int command_mem = machine_mem - 3000

Expand Down Expand Up @@ -449,8 +447,7 @@ task CallCopyRatioSegments {
Int? preemptible_attempts
Int disk_space_gb

# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem) then mem * 1000 else 7000
Int machine_mem = select_first([mem, 7]) * 1000
Int command_mem = machine_mem - 1000

command <<<
Expand Down Expand Up @@ -492,8 +489,7 @@ task PlotDenoisedCopyRatios {
Int? preemptible_attempts
Int disk_space_gb

# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem) then mem * 1000 else 7000
Int machine_mem = select_first([mem, 7]) * 1000
Int command_mem = machine_mem - 1000

# If optional output_dir not specified, use "out"
Expand Down Expand Up @@ -546,8 +542,7 @@ task PlotModeledSegments {
Int? preemptible_attempts
Int disk_space_gb

# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem) then mem * 1000 else 7000
Int machine_mem = select_first([mem, 7]) * 1000
Int command_mem = machine_mem - 1000

# If optional output_dir not specified, use "out"
Expand Down
8 changes: 4 additions & 4 deletions scripts/cnv_wdl/somatic/cnv_somatic_panel_workflow.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ task CreateReadCountPanelOfNormals {
Int? preemptible_attempts
Int? disk_space_gb

Int machine_mem = if defined(mem) then select_first([mem]) else 8
Float command_mem = machine_mem - 0.5
Int machine_mem = select_first([mem, 8]) * 1000
Int command_mem = machine_mem - 500

command <<<
set -e
export GATK_LOCAL_JAR=${default="/root/gatk.jar" gatk4_jar_override}

gatk --java-options "-Xmx${machine_mem}g" CreateReadCountPanelOfNormals \
gatk --java-options "-Xmx${command_mem}m" CreateReadCountPanelOfNormals \
--input ${sep=" --input " read_count_files} \
--minimum-interval-median-percentile ${default="10.0" minimum_interval_median_percentile} \
--maximum-zeros-in-sample-percentage ${default="5.0" maximum_zeros_in_sample_percentage} \
Expand All @@ -127,7 +127,7 @@ task CreateReadCountPanelOfNormals {

runtime {
docker: "${gatk_docker}"
memory: command_mem + " GB"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space_gb, 150]) + " HDD"
preemptible: select_first([preemptible_attempts, 2])
}
Expand Down

0 comments on commit f9b2701

Please sign in to comment.