Skip to content

Commit

Permalink
Move VcfToBed to Utils.wdl.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Apr 29, 2024
1 parent 0791d82 commit 3b229a7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 45 deletions.
48 changes: 3 additions & 45 deletions wdl/DeNovoSVsScatter.wdl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version 1.0

import "Structs.wdl"
import "Utils.wdl" as Utils

workflow DeNovoSVsScatter {

Expand All @@ -27,9 +28,10 @@ workflow DeNovoSVsScatter {
# Scatter genotyping over shards
scatter (shard in vcf_files) {
call VcfToBed {
call Utils.VcfToBed as VcfToBed {
input:
vcf_file=shard,
args="--info ALL --include-filters",
variant_interpretation_docker=variant_interpretation_docker,
runtime_attr_override = runtime_attr_vcf_to_bed
}
Expand Down Expand Up @@ -156,50 +158,6 @@ task RunDeNovo {
}
}
task VcfToBed {

input {
File vcf_file
String variant_interpretation_docker
RuntimeAttr? runtime_attr_override
}
Float vcf_size = size(vcf_file, "GB")
RuntimeAttr default_attr = object {
mem_gb: 3.75,
disk_gb: ceil(10 + vcf_size * 1.5),
cpu_cores: 1,
preemptible_tries: 2,
max_retries: 1,
boot_disk_gb: 8
}

RuntimeAttr runtime_attr = select_first([runtime_attr_override, default_attr])
output {
File bed_output = "~{basename}.bed.gz"
}

String basename = basename(vcf_file, ".vcf.gz")
command {
set -exuo pipefail

svtk vcf2bed ~{vcf_file} --info ALL --include-filters ~{basename}.bed
bgzip ~{basename}.bed
}

runtime {
cpu: select_first([runtime_attr.cpu_cores, default_attr.cpu_cores])
memory: select_first([runtime_attr.mem_gb, default_attr.mem_gb]) + " GB"
disks: "local-disk " + select_first([runtime_attr.disk_gb, default_attr.disk_gb]) + " HDD"
bootDiskSizeGb: select_first([runtime_attr.boot_disk_gb, default_attr.boot_disk_gb])
preemptible: select_first([runtime_attr.preemptible_tries, default_attr.preemptible_tries])
maxRetries: select_first([runtime_attr.max_retries, default_attr.max_retries])
docker: variant_interpretation_docker
}
}
task MergeBedFiles {

input {
Expand Down
45 changes: 45 additions & 0 deletions wdl/Utils.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -782,3 +782,48 @@ task SubsetVcfBySamplesList {
maxRetries: select_first([runtime_attr.max_retries, default_attr.max_retries])
}
}
task VcfToBed {

input {
File vcf_file
String variant_interpretation_docker
String? args
RuntimeAttr? runtime_attr_override
}
Float vcf_size = size(vcf_file, "GB")
RuntimeAttr default_attr = object {
mem_gb: 3.75,
disk_gb: ceil(10 + vcf_size * 1.5),
cpu_cores: 1,
preemptible_tries: 2,
max_retries: 1,
boot_disk_gb: 8
}

RuntimeAttr runtime_attr = select_first([runtime_attr_override, default_attr])
output {
File bed_output = "~{basename}.bed.gz"
}

String basename = basename(vcf_file, ".vcf.gz")
command {
set -exuo pipefail

svtk vcf2bed ~{vcf_file} --info ALL --include-filters ~{basename}.bed
bgzip ~{basename}.bed
}

runtime {
cpu: select_first([runtime_attr.cpu_cores, default_attr.cpu_cores])
memory: select_first([runtime_attr.mem_gb, default_attr.mem_gb]) + " GB"
disks: "local-disk " + select_first([runtime_attr.disk_gb, default_attr.disk_gb]) + " HDD"
bootDiskSizeGb: select_first([runtime_attr.boot_disk_gb, default_attr.boot_disk_gb])
preemptible: select_first([runtime_attr.preemptible_tries, default_attr.preemptible_tries])
maxRetries: select_first([runtime_attr.max_retries, default_attr.max_retries])
docker: variant_interpretation_docker
}
}

0 comments on commit 3b229a7

Please sign in to comment.