-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrust4.wdl
234 lines (192 loc) · 5.32 KB
/
trust4.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
task TRUST4_TASK {
File? gene_reference
File? gene_annotation
String sample_id
File? input_bam
File? fq_1
File? fq_2
String? barcode_10x
String Docker
Int preemptible
Int maxRetries
String memory
String disks
Int cpu
String dollar = "$"
command <<<
set -e
# define reference files
if [[ -z "${gene_reference}" ]]; then
gene_reference_run="/opt2/TRUST4/hg38_bcrtcr.fa"
else
gene_reference_run="${gene_reference}"
fi
if [[ -z "${gene_annotation}" ]]; then
gene_annotation_run="/opt2/TRUST4/human_IMGT+C.fa"
else
gene_annotation_run="${gene_annotation}"
fi
# check 10x
if [[ ! -z "${barcode_10x}" ]]; then
support_barcode_10x="--barcode ${barcode_10x}"
else
support_barcode_10x=""
fi
# trust4
if [[ ! -z "${input_bam}" ]]; then
run-trust4 \
-b ${input_bam} \
-t ${cpu} \
${dollar}{support_barcode_10x} \
-f ${dollar}{gene_reference_run} \
--ref ${dollar}{gene_annotation_run} \
-o ${sample_id}
elif [[ -z "${fq_2}" ]]; then
run-trust4 \
-u ${fq_1} \
-t ${cpu} \
-f ${dollar}{gene_reference_run} \
--ref ${dollar}{gene_annotation_run} \
-o ${sample_id}
else
run-trust4 \
-1 ${fq_1} \
-2 ${fq_2} \
-t ${cpu} \
-f ${dollar}{gene_reference_run} \
--ref ${dollar}{gene_annotation_run} \
-o ${sample_id}
fi
gzip ${sample_id}_annot.fa
gzip ${sample_id}_cdr3.out
gzip ${sample_id}_report.tsv
if [[ ! -z "${barcode_10x}" ]]; then
gzip ${sample_id}_barcode_report.tsv
fi
>>>
output {
File annot="${sample_id}_annot.fa.gz"
File report="${sample_id}_cdr3.out.gz"
File simpleReport="${sample_id}_report.tsv.gz"
File? barcodeReport="${sample_id}_barcode_report.tsv.gz"
}
runtime {
docker: Docker
disks: disks
memory: memory
cpu: cpu
preemptible: preemptible
maxRetries: maxRetries
}
}
task TRUST4_SMART_TASK {
File? gene_reference
File? gene_annotation
String sample_id
Array[File]? smart_1
Array[File]? smart_2
String Docker
Int preemptible
Int maxRetries
String memory
String disks
Int cpu
Boolean defined_smart_2 = defined(smart_2)
String dollar = "$"
command <<<
set -e
# define reference files
if [[ -z "${gene_reference}" ]]; then
gene_reference_run="/opt2/TRUST4/hg38_bcrtcr.fa"
else
gene_reference_run="${gene_reference}"
fi
if [[ -z "${gene_annotation}" ]]; then
gene_annotation_run="/opt2/TRUST4/human_IMGT+C.fa"
else
gene_annotation_run="${gene_annotation}"
fi
# trust4
if [ "${defined_smart_2}" = true ]; then
perl /opt2/TRUST4/trust-smartseq.pl \
-1 "${write_lines(smart_1)}" \
-2 "${write_lines(smart_2)}" \
-t ${cpu} \
-f ${dollar}{gene_reference_run} \
--ref ${dollar}{gene_annotation_run} \
-o ${sample_id}
else
perl /opt2/TRUST4/trust-smartseq.pl \
-1 "${write_lines(smart_1)}" \
-t ${cpu} \
-f ${dollar}{gene_reference_run} \
--ref ${dollar}{gene_annotation_run} \
-o ${sample_id}
fi
gzip ${sample_id}_annot.fa
gzip ${sample_id}_report.tsv
>>>
output {
File annot="${sample_id}_annot.fa.gz"
File simpleReport="${sample_id}_report.tsv.gz"
}
runtime {
docker: Docker
disks: disks
memory: memory
cpu: cpu
preemptible: preemptible
maxRetries: maxRetries
}
}
workflow trust4_wf {
String sample_id
File? gene_reference
File? gene_annotation
File? bam
File? fq_1
File? fq_2
Array[File]? smart_1
Array[File]? smart_2
String? barcode_10x
String? Docker = "dscohen/trust4:v1.0.4"
Int preemptible = 2
Int maxRetries = 1
String memory = "10GB"
String disks = "local-disk 20 SSD"
Int cpu = "8"
if (defined(bam)||defined(fq_1)) {
call TRUST4_TASK {
input:
input_bam=bam,
fq_1=fq_1,
fq_2=fq_2,
sample_id=sample_id,
barcode_10x=barcode_10x,
gene_reference=gene_reference,
gene_annotation=gene_annotation,
Docker=Docker,
preemptible=preemptible,
maxRetries=maxRetries,
disks=disks,
memory=memory,
cpu=cpu
}
}
if ((defined(smart_1))&&(!(defined(bam)||defined(fq_1)))) {
call TRUST4_SMART_TASK {
input:
smart_1=smart_1,
smart_2=smart_2,
sample_id=sample_id,
gene_reference=gene_reference,
gene_annotation=gene_annotation,
Docker=Docker,
preemptible=preemptible,
maxRetries=maxRetries,
disks=disks,
memory=memory,
cpu=cpu
}
}
}