-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparallelGuppyGPU.wdl
198 lines (150 loc) · 3.92 KB
/
parallelGuppyGPU.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
version 1.0
workflow parallelGuppyGPU {
input {
# input must be tar files
Array[File] fast5_tar_files
}
# scatter in case multiple tar files are given
scatter (fast5_tar in fast5_tar_files) {
call splitFast5s {
input:
file_to_split_tar = fast5_tar
}
# call guppyGPU on each of the smaller "proportioned" tar files
scatter (split_fast5_tar in splitFast5s.split_fast5_tar) {
call guppyGPU {
input:
fast5_tar_file = split_fast5_tar
}
}
}
# gather??
output {
Array[File] bams = flatten(guppyGPU.pass_bam)
Array[File] fastqs = flatten(guppyGPU.pass_fastq)
Array[File] summaries = flatten(guppyGPU.summary)
}
}
task splitFast5s {
input {
File file_to_split_tar
Int desired_size_GB
String dockerImage = "jiminpark/guppy-wdl:latest"
# runtime
Int memSizeGB = 85
Int threadCount = 12
Int diskSizeGB = 500
Int gpuCount = 1
Int maxRetries = 4
String gpuType = "nvidia-tesla-v100"
String nvidiaDriverVersion = "418.87.00"
String zones = "us-west1-b"
}
command <<<
## Extract tar file to
mkdir input
# place all extracted files into directory input
tar xvf "~{file_to_split_tar}" --directory input
cd input
OUTPUT_IDX=0
OUTPUT_DIR=fast5_tar_$OUTPUT_IDX
mkdir $OUTPUT_DIR
for FILE in *.fast5
do
if [[ $(du -s -BG $OUTPUT_DIR | sed 's/G.*//') > ~{desired_size_GB} ]]
then
tar -czvf fast5_tarball_$OUTPUT_IDX.tar.gz $OUTPUT_DIR/*
rm -r $OUTPUT_DIR
OUTPUT_IDX=$(($OUTPUT_IDX + 1))
OUTPUT_DIR=fast5_tar_$OUTPUT_IDX
mkdir $OUTPUT_DIR
fi
echo $(du -s -BG $OUTPUT_DIR | sed 's/G.*//')
mv $FILE $OUTPUT_DIR
done
# tar remaining directory
tar -czvf fast5_tarball_$OUTPUT_IDX.tar.gz $OUTPUT_DIR/*
>>>
output {
Array[File] split_fast5_tar = glob("input/*tar.gz")
}
runtime {
memory: memSizeGB + " GB"
cpu: threadCount
disks: "local-disk " + diskSizeGB + " SSD"
gpuCount: gpuCount
gpuType: gpuType
maxRetries : maxRetries
nvidiaDriverVersion: nvidiaDriverVersion
docker: dockerImage
zones: zones
}
}
task guppyGPU {
input {
File fast5_tar_file
String CONFIG_FILE = "dna_r9.4.1_450bps_modbases_5mc_cg_sup_prom.cfg"
Int READ_BATCH_SIZE = 250000
Int q = 250000
String dockerImage = "jiminpark/guppy-wdl:latest"
String? additionalArgs
Int memSizeGB = 85
Int threadCount = 12
Int diskSizeGB = 500
Int gpuCount = 1
Int maxRetries = 4
String gpuType = "nvidia-tesla-v100"
String nvidiaDriverVersion = "418.87.00"
String zones = "us-west1-b"
}
command <<<
# Set the exit code of a pipeline to that of the rightmost command
# to exit with a non-zero status, or zero if all commands of the pipeline exit
set -o pipefail
# cause a bash script to exit immediately when a command fails
set -e
# cause the bash shell to treat unset variables as an error and exit immediately
set -u
# echo each line of the script to stdout so we can see what is happening
# to turn off echo do 'set +o xtrace'
set -o xtrace
## Extract tar file to
mkdir input
# place all extracted files into directory input
tar xvf "~{fast5_tar_file}" --directory input
mkdir output
# check if length of "additionalArgs" is zero
if [[ "~{additionalArgs}" == "" ]]
then
ADDITIONAL_ARGS=""
else
ADDITIONAL_ARGS="~{additionalArgs}"
fi
guppy_basecaller \
-i input/ \
-s output/ \
-c /opt/ont/guppy/data/"~{CONFIG_FILE}" \
--bam_out \
-x cuda:all:100% \
-r \
--read_batch_size "~{READ_BATCH_SIZE}" \
-q "~{q}" \
${ADDITIONAL_ARGS}
>>>
output {
File pass_bam = glob("output/pass/*.bam")[0]
File pass_fastq = glob("output/pass/*.fastq")[0]
File summary = glob("output/sequencing_summary.txt")[0]
}
runtime {
memory: memSizeGB + " GB"
cpu: threadCount
disks: "local-disk " + diskSizeGB + " SSD"
gpuCount: gpuCount
gpuType: gpuType
maxRetries : maxRetries
nvidiaDriverVersion: nvidiaDriverVersion
docker: dockerImage
zones: zones
}
}