Skip to content

Commit c7c0a24

Browse files
authored
Add a WDL to run ExpansionHunter on multiple samples (#253)
* Add a WDL to run ExpansionHunter on multiple inputs. * Add output prefix arg, defaults to input filename. * Rename docker var in EH WDLs to 'expansion_hunter_docker' * Add an optional list of per sample output prefix.
1 parent c493629 commit c7c0a24

File tree

2 files changed

+74
-6
lines changed

2 files changed

+74
-6
lines changed

wdl/ExpansionHunter.wdl

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ workflow ExpansionHunter {
2020
File reference_fasta
2121
File? reference_fasta_index
2222
File variant_catalog
23-
String docker_file
23+
File? output_prefix
24+
String expansion_hunter_docker
2425
RuntimeAttr? runtime_attr
2526
}
2627

@@ -35,14 +36,24 @@ workflow ExpansionHunter {
3536
reference_fasta_index,
3637
reference_fasta + ".fai"])
3738

39+
String output_prefix_ =
40+
if defined(output_prefix) then
41+
select_first([output_prefix])
42+
else
43+
if is_bam then
44+
basename(bam_or_cram, ".bam")
45+
else
46+
basename(bam_or_cram, ".cram")
47+
3848
call RunExpansionHunter {
3949
input:
4050
bam_or_cram = bam_or_cram,
4151
bam_or_cram_index = bam_or_cram_index_,
4252
reference_fasta = reference_fasta,
4353
reference_fasta_index = reference_fasta_index_,
4454
variant_catalog = variant_catalog,
45-
docker_file = docker_file,
55+
output_prefix = output_prefix_,
56+
expansion_hunter_docker = expansion_hunter_docker,
4657
runtime_attr_override = runtime_attr,
4758
}
4859
@@ -60,12 +71,11 @@ task RunExpansionHunter {
6071
File reference_fasta
6172
File reference_fasta_index
6273
File variant_catalog
63-
String docker_file
74+
String output_prefix
75+
String expansion_hunter_docker
6476
RuntimeAttr? runtime_attr_override
6577
}
6678

67-
String output_prefix = "output"
68-
6979
output {
7080
File json = "${output_prefix}.json"
7181
File vcf = "${output_prefix}.vcf"
@@ -99,7 +109,7 @@ task RunExpansionHunter {
99109
runtime_attr_str_profile_default])
100110

101111
runtime {
102-
docker: docker_file
112+
docker: expansion_hunter_docker
103113
cpu: runtime_attr.cpu_cores
104114
memory: runtime_attr.mem_gb + " GiB"
105115
disks: "local-disk " + runtime_attr.disk_gb + " HDD"

wdl/ExpansionHunterScatter.wdl

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version 1.0
2+
3+
import "Structs.wdl"
4+
import "ExpansionHunter.wdl" as ExpansionHunter
5+
6+
workflow ExpansionHunterScatter {
7+
8+
input {
9+
Array[File] bams_or_crams
10+
Array[File]? bams_or_crams_indexes
11+
Array[String]? sample_ids
12+
File reference_fasta
13+
File? reference_fasta_index
14+
File variant_catalog
15+
String expansion_hunter_docker
16+
RuntimeAttr? runtime_attr
17+
}
18+
19+
scatter (i in range(length(bams_or_crams))) {
20+
File bam_or_cram_ = bams_or_crams[i]
21+
Boolean is_bam =
22+
basename(bam_or_cram_, ".bam") + ".bam" == basename(bam_or_cram_)
23+
File bam_or_cram_index_ =
24+
if defined(bams_or_crams_indexes) then
25+
select_first([bams_or_crams_indexes])[i]
26+
else
27+
bam_or_cram_ + if is_bam then ".bai" else ".crai"
28+
File reference_fasta_index_ = select_first([
29+
reference_fasta_index, reference_fasta + ".fai"])
30+
31+
String output_prefix =
32+
if defined(sample_ids) then
33+
select_first([sample_ids])[i]
34+
else
35+
if is_bam then
36+
basename(bam_or_cram_, ".bam")
37+
else
38+
basename(bam_or_cram_, ".cram")
39+
40+
call ExpansionHunter.ExpansionHunter as expanionHunter {
41+
input:
42+
bam_or_cram=bam_or_cram_,
43+
bam_or_cram_index=bam_or_cram_index_,
44+
reference_fasta=reference_fasta,
45+
reference_fasta_index=reference_fasta_index_,
46+
variant_catalog=variant_catalog,
47+
output_prefix=output_prefix,
48+
expansion_hunter_docker=expansion_hunter_docker,
49+
runtime_attr=runtime_attr
50+
}
51+
}
52+
53+
output {
54+
Array[File] jsons = expanionHunter.json
55+
Array[File] vcfs = expanionHunter.vcf
56+
Array[File] overlapping_reads = expanionHunter.overlapping_reads
57+
}
58+
}

0 commit comments

Comments
 (0)