-
Notifications
You must be signed in to change notification settings - Fork 17
/
03-map-pe-umis.cwl
338 lines (338 loc) · 8.6 KB
/
03-map-pe-umis.cwl
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
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.0
doc: 'STARR-seq 03 mapping - reads: PE'
requirements:
- class: ScatterFeatureRequirement
- class: SubworkflowFeatureRequirement
- class: StepInputExpressionRequirement
- class: InlineJavascriptRequirement
inputs:
input_fastq_read1_files:
doc: Input fastq paired-end read 1 files
type: File[]
input_fastq_read2_files:
doc: Input fastq paired-end read 2 files
type: File[]
input_fastq_umi_files:
doc: Input fastq with UMIs files
type: File[]
fgbio_jar_path:
default: /opt/fgbio.jar
doc: fgbio Java jar file
type: string
genome_sizes_file:
doc: Genome sizes tab-delimited file (used in samtools)
type: File
regions_bed_file:
doc: Regions bed file used to filter-in reads (used in samtools)
type: File
picard_jar_path:
default: /usr/picard/picard.jar
doc: Picard Java jar file
type: string
picard_java_opts:
doc: JVM arguments should be a quoted, space separated list (e.g. "-Xms128m -Xmx512m")
type: string?
ENCODE_blacklist_bedfile:
doc: Bedfile containing ENCODE consensus blacklist regions to be excluded.
type: File
genome_ref_first_index_file:
doc: Bowtie first index files for reference genome (e.g. *1.bt2). The rest of the files should be in the same folder.
type: File
secondaryFiles:
- ^^.2.bt2
- ^^.3.bt2
- ^^.4.bt2
- ^^.rev.1.bt2
- ^^.rev.2.bt2
nthreads:
default: 1
type: int
steps:
basename:
run: ../utils/basename.cwl
scatter: file_path
in:
file_path:
source: input_fastq_read1_files
valueFrom: $(self.basename)
sep:
valueFrom: '[\._]R1'
do_not_escape_sep:
valueFrom: ${return true}
out:
- basename
extract_basename_1:
run: ../utils/extract-basename.cwl
in:
input_file: input_fastq_read1_files
scatter: input_file
out:
- output_basename
extract_basename_2:
run: ../utils/remove-extension.cwl
in:
file_path: extract_basename_1/output_basename
scatter: file_path
out:
- output_path
bowtie2:
run: ../map/bowtie2.cwl
scatterMethod: dotproduct
scatter:
- input_fastq_read1_file
- input_fastq_read2_file
- ungz
- output_filename
in:
input_fastq_read1_file: input_fastq_read1_files
input_fastq_read2_file: input_fastq_read2_files
ungz:
source: basename/basename
valueFrom: ${return self + ".unmmaped.fastq.gz"}
output_filename: basename/basename
sensitive:
valueFrom: ${return true}
v:
valueFrom: ${return 2}
X:
valueFrom: ${return 2000}
genome_ref_first_index_file: genome_ref_first_index_file
nthreads: nthreads
out:
- outfile
- output_bowtie_log
- output_unmapped_reads
sort_bams:
run: ../map/samtools-sort.cwl
scatter:
- input_file
in:
nthreads: nthreads
input_file: bowtie2/outfile
out:
- sorted_file
index_bams:
run: ../map/samtools-index.cwl
scatter:
- input_file
in:
input_file: sort_bams/sorted_file
out:
- indexed_file
filter_quality_alignments:
run: ../map/samtools-view.cwl
scatter:
- input_file
in:
input_file: bowtie2/outfile
nthreads: nthreads
b:
valueFrom: ${return true}
u:
valueFrom: ${return true}
header:
valueFrom: ${return true}
S:
valueFrom: ${return true}
f:
valueFrom: ${return 3}
q:
valueFrom: ${return 10}
L: regions_bed_file
out:
- outfile
sort_bams_by_tag_name:
run: ../map/samtools-sort.cwl
scatter:
- input_file
in:
nthreads: nthreads
n:
valueFrom: ${return true}
suffix:
valueFrom: .f3q10.nsorted_bam
input_file: filter_quality_alignments/outfile
out:
- sorted_file
remove_encode_blacklist:
run: ../map/bedtools-pairtobed.cwl
scatterMethod: dotproduct
scatter:
- abam
in:
abam: sort_bams_by_tag_name/sorted_file
bFile: ENCODE_blacklist_bedfile
type:
valueFrom: neither
out:
- filtered
sort_masked_bams:
run: ../map/samtools-sort.cwl
scatter:
- input_file
in:
nthreads: nthreads
input_file: remove_encode_blacklist/filtered
out:
- sorted_file
index_masked_bams:
run: ../map/samtools-index.cwl
scatter:
- input_file
in:
input_file: sort_masked_bams/sorted_file
out:
- indexed_file
bam_to_bepe:
run: ../map/bedtools-bamtobed.cwl
scatterMethod: dotproduct
scatter:
- bam
in:
bam: sort_bams_by_tag_name/sorted_file
bedpe:
valueFrom: ${return true}
out:
- output_bedfile
cut_to_bepe:
run: ../utils/cut.cwl
scatterMethod: dotproduct
scatter:
- input_file
in:
input_file: bam_to_bepe/output_bedfile
suffix:
valueFrom: .fragments.txt
columns:
valueFrom: 1,2,6
out:
- output_file
sort_to_bepe:
run: ../utils/sort.cwl
scatterMethod: dotproduct
scatter:
- input_file
in:
input_file: cut_to_bepe/output_file
suffix:
valueFrom: .bedpe
k:
valueFrom: $(["1,1", "2,2g"])
out:
- outfile
annotate_bams_with_umis:
run: ../map/fgbio-AnnotateBamWithUmis.cwl
scatterMethod: dotproduct
scatter:
- input
- fastq
in:
java_opts: picard_java_opts
fgbio_jar_path: fgbio_jar_path
input: index_masked_bams/indexed_file
fastq: input_fastq_umi_files
out:
- output
mark_duplicates:
run: ../map/picard-MarkDuplicates.cwl
scatterMethod: dotproduct
scatter:
- input_file
in:
java_opts: picard_java_opts
picard_jar_path: picard_jar_path
input_file: annotate_bams_with_umis/output
barcode_tag:
valueFrom: RX
output_filename:
valueFrom: $(inputs.input_file.nameroot + ".dups_marked")
output_suffix:
valueFrom: bam
out:
- output_metrics_file
- output_dedup_bam_file
index_dups_marked_bams:
run: ../map/samtools-index.cwl
scatter:
- input_file
in:
input_file: mark_duplicates/output_dedup_bam_file
out:
- indexed_file
remove_duplicates:
run: ../map/samtools-view.cwl
scatter:
- input_file
in:
input_file: index_dups_marked_bams/indexed_file
F:
valueFrom: ${return 1024}
suffix:
valueFrom: .dedup.bam
b:
valueFrom: ${return true}
outfile_name:
valueFrom: ${return inputs.input_file.basename.replace('dups_marked', 'dedup')}
out:
- outfile
sort_dedup_bams:
run: ../map/samtools-sort.cwl
scatter:
- input_file
in:
nthreads: nthreads
input_file: remove_duplicates/outfile
out:
- sorted_file
index_dedup_bams:
run: ../map/samtools-index.cwl
scatter:
- input_file
in:
input_file: sort_dedup_bams/sorted_file
out:
- indexed_file
preseq-c-curve:
run: ../map/preseq-c_curve.cwl
scatterMethod: dotproduct
scatter:
- input_sorted_file
in:
input_sorted_file: index_masked_bams/indexed_file
output_file_basename:
valueFrom: $(inputs.input_sorted_file.nameroot + ".preseq_ccurve.txt")
pe:
valueFrom: ${return true}
out:
- output_file
outputs:
output_picard_mark_duplicates_files:
doc: Picard MarkDuplicates metrics files.
type: File[]
outputSource: mark_duplicates/output_metrics_file
output_bowtie_log:
doc: Bowtie log file.
type: File[]
outputSource: bowtie2/output_bowtie_log
output_data_bam_files:
doc: BAM files with aligned reads.
type: File[]
outputSource: index_dups_marked_bams/indexed_file
output_data_dedup_bam_files:
doc: Dedup BAM files with aligned reads.
type: File[]
outputSource: index_dedup_bams/indexed_file
output_data_unmapped_fastq_files:
doc: FASTQ gzipped files with unmapped reads.
type: File[]
outputSource: bowtie2/output_unmapped_reads
output_templates_files:
doc: Tags/templates coordinates, sorted by chromosome and position (sort -k1,1 -k2,2g).
type: File[]
outputSource: sort_to_bepe/outfile
output_preseq_c_curve_files:
doc: Preseq c_curve output files.
type: File[]
outputSource: preseq-c-curve/output_file