forked from gatk-workflows/gatk4-cnn-variant-filter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_happy.wdl
145 lines (117 loc) · 3.62 KB
/
run_happy.wdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Run the hap.py VCF evaluation over input vcfs given a validated truth vcf and confidence region
workflow HappyWorkflow {
Array[File] vcf_files # VCF files to evaluate with hap.py
File reference_fasta
File reference_dict
File reference_fasta_index
File truth_vcf
File truth_vcf_index
File truth_bed
File rscript
Int? preemptible_attempts
Int? disk_space
Int? mem_gb
Int? cpu
call RunHappy {
input:
vcf_files = vcf_files,
truth_vcf = truth_vcf,
truth_vcf_index = truth_vcf_index,
truth_bed = truth_bed,
reference_fasta = reference_fasta,
reference_dict = reference_dict,
reference_fasta_index = reference_fasta_index,
cpu = cpu,
mem_gb = mem_gb,
disk_space = disk_space,
preemptible_attempts = preemptible_attempts
}
call RunHappyPlots{
input:
happy_outputs = RunHappy.happy_outputs,
rscript = rscript,
cpu = cpu,
mem_gb = mem_gb,
disk_space = disk_space,
preemptible_attempts = preemptible_attempts
}
output {
RunHappy.*
RunHappyPlots.*
}
}
task RunHappy {
Array[File] vcf_files
File reference_fasta
File reference_dict
File reference_fasta_index
File truth_vcf
File truth_vcf_index
File truth_bed
# Runtime parameters
Int? mem_gb
Int? preemptible_attempts
Int? disk_space
Int? cpu
Boolean use_ssd = false
# You may have to change the following two parameter values depending on the task requirements
Int default_ram_mb = 16000
Int default_disk_space_gb = 100
# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem_gb) then mem_gb *1000 else default_ram_mb
Int command_mem = machine_mem - 1000
command {
for vcf_file in ${sep=" " vcf_files}; do
vname=$(basename "$vcf_file")
/opt/hap.py/bin/hap.py \
${truth_vcf} \
"$vcf_file" \
-f ${truth_bed} \
-r ${reference_fasta} \
-o ./happy_"$vname"
done
}
output {
Array[File] happy_outputs = glob("./happy_*")
}
runtime {
docker: "pkrusche/hap.py"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space, 100]) + if use_ssd then " SSD" else " HDD"
preemptible: select_first([preemptible_attempts, 10])
cpu: select_first([cpu, 1])
}
}
task RunHappyPlots {
Array[File] happy_outputs
File rscript
# Runtime parameters
Int? mem_gb
Int? preemptible_attempts
Int? disk_space
Int? cpu
Boolean use_ssd = false
# You may have to change the following two parameter values depending on the task requirements
Int default_ram_mb = 16000
Int default_disk_space_gb = 100
# Mem is in units of GB but our command and memory runtime values are in MB
Int machine_mem = if defined(mem_gb) then mem_gb *1000 else default_ram_mb
Int command_mem = machine_mem - 1000
command {
for file in ${sep=" " happy_outputs}; do
mv "$file" ./
done
find `pwd`
Rscript ${rscript}
}
output {
Array[File] plots = glob("*png")
}
runtime {
docker: "rocker/tidyverse"
memory: machine_mem + " MB"
disks: "local-disk " + select_first([disk_space, 100]) + if use_ssd then " SSD" else " HDD"
preemptible: select_first([preemptible_attempts, 10])
cpu: select_first([cpu, 1])
}
}