-
Notifications
You must be signed in to change notification settings - Fork 0
/
eprint_ALS.wdl
342 lines (286 loc) · 6.61 KB
/
eprint_ALS.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
version 1.0
struct Samples {
File fastq_r2
Array[String] adapters
String bc_pattern
}
workflow Eprint {
input {
Samples samples
File hg19_dup_tar
File hg19_tar
}
call UmiTools {
input:
fastq_r2 = samples.fastq_r2,
bc_pattern = samples.bc_pattern
}
call CutAdapt {
input:
umi_r2 = UmiTools.umi_r2,
adapters = samples.adapters
}
call FastQC {
input:
cut_r2 = CutAdapt.cut_r2
}
call FastQ_sort {
input:
cut_r2 = CutAdapt.cut_r2
}
call STAR_rmRep {
input:
sorted_cut_r2 = FastQ_sort.fastq_sort_r2,
hg19_dup_tar = hg19_dup_tar
}
call FastQ_sort_STAR {
input:
star_r2 = STAR_rmRep.star_r2,
star_bam = STAR_rmRep.star_bam
}
call STAR_genome_map {
input:
sorted_start_r2 = FastQ_sort_STAR.sorted_start_r2,
star_bam = STAR_rmRep.star_bam,
hg19_tar =hg19_tar
}
call PCR_Dedup {
input:
star_hg19_bam = STAR_genome_map.star_hg19_bam
}
call Clipper {
input:
dedup_bam = PCR_Dedup.dedup_bam,
dedup_bai = PCR_Dedup.dedup_bai
}
}
task UmiTools {
input {
File fastq_r2
String bc_pattern
}
String r2 = basename(fastq_r2,'.fastq.gz')
command <<<
eval "$(conda shell.bash hook)"
conda activate eprint
umi_tools extract \
--random-seed 1 \
--bc-pattern ~{bc_pattern} \
--log ~{r2}.metrics \
--stdin ~{fastq_r2} \
--stdout ~{r2}.fastq.gz
>>>
runtime {
cpu: 6
memory: "16 GB"
}
output {
File umi_r2 = "~{r2}.fastq.gz"
}
}
task CutAdapt {
input {
File umi_r2
Array[String] adapters
}
String r2 = basename(umi_r2,'.fastq.gz')
command <<<
eval "$(conda shell.bash hook)"
conda activate eprint
cutadapt --match-read-wildcards --times 1 -e 0.1 -O 1 --quality-cutoff 6,6 -m 18 \
--cores=16 \
-g ~{sep="\\\n -g " adapters } \
-o ~{r2}.fastq.gz \
~{umi_r2}
>>>
runtime {
cpu: 16
memory: "6 GB"
}
output {
File cut_r2 = "~{r2}.fastq.gz"
}
}
task FastQC {
input {
File cut_r2
}
String r2 = basename(cut_r2,'.fastq.gz')
command <<<
eval "$(conda shell.bash hook)"
conda activate eprint
fastqc -t 2 --extract -k 7 ~{cut_r2} -o .
>>>
runtime {
cpu: 3
memory: "5 GB"
}
}
task FastQ_sort {
input {
File cut_r2
}
String sorted_r2 = basename(cut_r2,'.fastq.gz')
command <<<
eval "$(conda shell.bash hook)"
conda activate eprint
gunzip -c ~{cut_r2} > ~{sorted_r2}.fastq
fastq-sort --id ~{sorted_r2}.fastq > ~{sorted_r2}.fq
>>>
runtime {
cpu: 6
memory: "10 GB"
}
output {
File fastq_sort_r2 = "~{sorted_r2}.fq"
}
}
task STAR_rmRep {
input {
File sorted_cut_r2
File hg19_dup_tar
}
String prefix = basename(sorted_cut_r2,'fq')
command <<<
mkdir RepElements
tar -xf ~{hg19_dup_tar}
eval "$(conda shell.bash hook)"
conda activate eprint
STAR \
--runMode alignReads \
--runThreadN 40 \
--genomeDir RepElements \
--genomeLoad NoSharedMemory \
--alignEndsType EndToEnd \
--outSAMunmapped Within \
--outFilterMultimapNmax 30 \
--outFilterMultimapScoreRange 1 \
--outFileNamePrefix ~{prefix} \
--outSAMtype BAM Unsorted \
--outFilterType BySJout \
--outBAMcompression 10 \
--outReadsUnmapped Fastx \
--outFilterScoreMin 10 \
--outSAMattrRGline ID:~{prefix} \
--outSAMattributes All \
--outSAMmode Full \
--outStd Log \
--readFilesIn ~{sorted_cut_r2}
>>>
runtime {
cpu: 40
memory: "60 GB"
}
output {
File star_r2 = "~{prefix}Unmapped.out.mate1"
File star_bam = "~{prefix}Aligned.out.bam"
}
}
task FastQ_sort_STAR {
input {
File star_r2
File star_bam
}
String sorted_r2 = basename(star_r2,'.Unmapped.out.mate1') + '_r2_.fq'
command <<<
eval "$(conda shell.bash hook)"
conda activate eprint
fastq-sort --id ~{star_r2} > ~{sorted_r2}
>>>
runtime {
cpu: 6
memory: "10 GB"
}
output {
File sorted_start_r2 = "~{sorted_r2}"
}
}
task STAR_genome_map {
input {
File sorted_start_r2
File star_bam
File hg19_tar
}
String prefix = basename(sorted_start_r2,'_r2_.fq') + '_hg19'
command <<<
mkdir HG_19_DIR
tar -xf ~{hg19_tar}
eval "$(conda shell.bash hook)"
conda activate eprint
STAR \
--runMode alignReads \
--runThreadN 30 \
--genomeDir HG_19_DIR \
--genomeLoad NoSharedMemory \
--readFilesIn ~{sorted_start_r2} \
--outSAMunmapped Within \
--outFilterMultimapNmax 1 \
--outFilterMultimapScoreRange 1 \
--outFileNamePrefix ~{prefix}. \
--outSAMattributes All \
--outSAMtype BAM Unsorted \
--outFilterType BySJout \
--outReadsUnmapped Fastx \
--outFilterScoreMin 10 \
--outSAMattrRGline ID:~{prefix} \
--outStd Log \
--alignEndsType EndToEnd \
--outBAMcompression 10 \
--outSAMmode Full
>>>
runtime {
cpu: 30
memory: "50 GB"
}
output {
File star_hg19_r2 = "${prefix}.Unmapped.out.mate1"
File star_hg19_bam = "${prefix}.Aligned.out.bam"
}
}
task PCR_Dedup {
input {
File star_hg19_bam
}
String prefix = basename(star_hg19_bam,'_hg19.Aligned.out.bam')
command <<<
eval "$(conda shell.bash hook)"
conda activate eprint
samtools sort -O bam -m 2G -@ 20 -o ~{prefix}.bam ~{star_hg19_bam}
samtools index -b ~{prefix}.bam
umi_tools dedup \
--random-seed 1 \
-I ~{prefix}.bam \
--method unique \
--output-stats ~{prefix}.stats \
-S ~{prefix}.dedup.bam
>>>
runtime {
cpu: 20
memory: "40 GB"
}
output {
File dedup_bam = "~{prefix}.dedup.bam"
File dedup_bai = "~{prefix}.bam.bai"
}
}
task Clipper {
input {
File dedup_bam
File dedup_bai
}
String bed_peak_intervals = basename(dedup_bam,'.dedup.bam') + '.bed'
command <<<
clipper \
--species hg19 \
--processors=16 \
-v \
-q \
--bam ~{dedup_bam} \
--outfile ~{bed_peak_intervals}
>>>
runtime {
cpu: 16
memory: "60 GB"
docker: "brianyee/clipper@sha256:094ede2a0ee7a6f2c2e07f436a8b63486dc4a072dbccad136b7a450363ab1876"
}
}