-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtalon.wdl
571 lines (493 loc) · 21.8 KB
/
talon.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
version 1.0
# Copyright (c) 2019 Leiden University Medical Center
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
task CreateAbundanceFileFromDatabase {
input {
File databaseFile
String annotationVersion
String genomeBuild
String outputPrefix
File? whitelistFile
File? datasetsFile
String memory = "4GiB"
Int timeMinutes = 30
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_abundance \
--db=~{databaseFile} \
-a ~{annotationVersion} \
-b ~{genomeBuild} \
--o=~{outputPrefix} \
~{"--whitelist=" + whitelistFile} \
~{"-d " + datasetsFile}
}
output {
File abundanceFile = outputPrefix + "_talon_abundance.tsv"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
databaseFile: {description: "Talon database.", category: "required"}
annotationVersion: {description: "Which annotation version to use.", category: "required"}
genomeBuild: {description: "Genome build to use.", category: "required"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
whitelistFile: {description: "Whitelist file of transcripts to include in the output.", category: "advanced"}
datasetsFile: {description: "A file indicating which datasets should be included.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
abundanceFile: {description: "Abundance for each transcript in the talon database across datasets."}
}
}
task CreateGtfFromDatabase {
input {
File databaseFile
String genomeBuild
String annotationVersion
String outputPrefix
Boolean observedInDataset = false
File? whitelistFile
File? datasetFile
String memory = "4GiB"
Int timeMinutes = 30
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_create_GTF \
--db=~{databaseFile} \
-b ~{genomeBuild} \
-a ~{annotationVersion} \
--o=~{outputPrefix} \
~{true="--observed" false="" observedInDataset} \
~{"--whitelist=" + whitelistFile} \
~{"-d " + datasetFile}
}
output {
File gtfFile = outputPrefix + "_talon.gtf"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
databaseFile: {description: "Talon database.", category: "required"}
genomeBuild: {description: "Genome build to use.", category: "required"}
annotationVersion: {description: "Which annotation version to use.", category: "required"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
observedInDataset: {description: "The output will only include transcripts that were observed at least once.", category: "advanced"}
whitelistFile: {description: "Whitelist file of transcripts to include in the output.", category: "advanced"}
datasetFile: {description: "A file indicating which datasets should be included.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
gtfFile: {description: "The genes, transcripts, and exons stored a talon database in gtf format."}
}
}
task FilterTalonTranscripts {
input {
File databaseFile
String annotationVersion
String outputPrefix
Float maxFracA = 0.5
Int minCount = 5
Boolean allowGenomic = false
File? datasetsFile
Int? minDatasets
String memory = "4GiB"
Int timeMinutes = 30
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_filter_transcripts \
--db=~{databaseFile} \
-a ~{annotationVersion} \
~{"--o=" + outputPrefix + "_whitelist.csv"} \
--maxFracA=~{maxFracA} \
--minCount=~{minCount} \
~{true="--allowGenomic" false="" allowGenomic} \
--datasets=~{datasetsFile} \
--minDatasets=~{minDatasets}
}
output {
File transcriptWhitelist = outputPrefix + "_whitelist.csv"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
databaseFile: {description: "Talon database.", category: "required"}
annotationVersion: {description: "Which annotation version to use.", category: "required"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
maxFracA: {description: "Maximum fraction of As to allow in the window located immediately after any read assigned to a novel transcript.", category: "advanced"}
minCount: {description: "Number of minimum occurrences required for a novel transcript per dataset.", category: "advanced"}
allowGenomic: {description: "If this option is set, transcripts from the Genomic novelty category will be permitted in the output.", category: "advanced"}
datasetsFile: {description: "Datasets to include.", category: "advanced"}
minDatasets: {description: "Minimum number of datasets novel transcripts must be found in.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
transcriptWhitelist: {description: "Transcript whitelist produced from the talon database."}
}
}
task GetReadAnnotations {
input {
File databaseFile
String genomeBuild
String outputPrefix
File? datasetFile
String memory = "4GiB"
Int timeMinutes = 30
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_fetch_reads \
--db ~{databaseFile} \
--build ~{genomeBuild} \
--o ~{outputPrefix} \
~{"--datasets " + datasetFile}
}
output {
File readAnnotations = outputPrefix + "_talon_read_annot.tsv"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
databaseFile: { description: "Talon database.", category: "required"}
genomeBuild: {description: "Genome build to use.", category: "required"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
datasetFile: {description: "A file indicating which datasets should be included.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
readAnnotations: {description: "Read-specific annotation information from a talon database."}
}
}
task GetSpliceJunctions {
input {
File sjInformationFile
String inputFileType = "db"
File referenceGtf
String runMode = "intron"
String outputPrefix
String memory = "4GiB"
Int timeMinutes = 30
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
Map[String, String] SJfileType = {"db": "--db", "gtf": "--gtf"}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_get_sjs \
~{SJfileType[inputFileType] + sjInformationFile} \
--ref ~{referenceGtf} \
--mode ~{runMode} \
--outprefix ~{outputPrefix}
}
output {
File spliceJunctions = outputPrefix + "_" + runMode + "s.tsv"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
sjInformationFile: {description: "Talon gtf file or database from which to extract exons/introns.", category: "required"}
inputFileType: {description: "The file type of sjInformationFile.", category: "common"}
referenceGtf: {description: "Gtf reference file (ie gencode).", category: "required"}
runMode: {description: "Determines whether to include introns or exons in the output.", category: "common"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
spliceJunctions: {description: "File containing locations, novelty and transcript assignments of exons/introns."}
}
}
task InitializeTalonDatabase {
input {
File gtfFile
String genomeBuild
String annotationVersion
Int minimumLength = 300
String novelPrefix = "TALON"
Int cutOff5p = 500
Int cutOff3p = 300
String outputPrefix
String memory = "10GiB"
Int timeMinutes = 60
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_initialize_database \
--f=~{gtfFile} \
--g=~{genomeBuild} \
--a=~{annotationVersion} \
--l=~{minimumLength} \
--idprefix=~{novelPrefix} \
--5p=~{cutOff5p} \
--3p=~{cutOff3p} \
--o=~{outputPrefix}
}
output {
File databaseFile = outputPrefix + ".db"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
gtfFile: {description: "Gtf annotation containing genes, transcripts, and edges.", category: "required"}
genomeBuild: {description: "Name of genome build that the gtf file is based on (ie hg38).", category: "required"}
annotationVersion: {description: "Name of supplied annotation (will be used to label data).", category: "required"}
minimumLength: { description: "Minimum required transcript length.", category: "common"}
novelPrefix: {description: "Prefix for naming novel discoveries in eventual talon runs.", category: "common"}
cutOff5p: { description: "Maximum allowable distance (bp) at the 5' end during annotation.", category: "advanced"}
cutOff3p: {description: "Maximum allowable distance (bp) at the 3' end during annotation.", category: "advanced"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
databaseFile: {description: "Talon database."}
}
}
task LabelReads {
input {
File inputSam
File referenceGenome
Int fracaRangeSize = 20
String tmpDir = "./tmp_label_reads"
Boolean deleteTmp = true
String outputPrefix
Int threads = 4
String memory = "25GiB"
Int timeMinutes = 2880
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_label_reads \
--f=~{inputSam} \
--g=~{referenceGenome} \
--t=~{threads} \
--ar=~{fracaRangeSize} \
--tmpDir=~{tmpDir} \
~{true="--deleteTmp" false="" deleteTmp} \
--o=~{outputPrefix}
}
output {
File labeledSam = outputPrefix + "_labeled.sam"
File readLabels = outputPrefix + "_read_labels.tsv"
}
runtime {
cpu: threads
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
inputSam: {description: "Sam file of transcripts.", category: "required"}
referenceGenome: {description: "Reference genome fasta file.", category: "required"}
fracaRangeSize: {description: "Size of post-transcript interval to compute fraction.", category: "common"}
tmpDir: {description: "Path to directory for tmp files.", category: "advanced"}
deleteTmp: {description: "If set, tmp dir will be removed.", category: "advanced"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
threads: {description: "The number of threads to be used.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
labeledSam: {description: "Sam file with labeled transcripts."}
readLabels: {description: "Tabular file with fraction description per read."}
}
}
task ReformatGtf {
input {
File gtfFile
String memory = "4GiB"
Int timeMinutes = 30
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
talon_reformat_gtf \
-gtf ~{gtfFile}
}
output {
File reformattedGtf = gtfFile
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
gtfFile: {description: "Gtf annotation containing genes, transcripts, and edges.", category: "required"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
reformattedGtf: {description: "Reformatted gtf file."}
}
}
task SummarizeDatasets {
input {
File databaseFile
Boolean setVerbose = false
String outputPrefix
File? datasetGroupsCsv
String memory = "4GiB"
Int timeMinutes = 50
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command {
set -e
mkdir -p "$(dirname ~{outputPrefix})"
talon_summarize \
--db ~{databaseFile} \
~{true="--verbose" false="" setVerbose} \
--o ~{outputPrefix} \
~{"--groups " + datasetGroupsCsv}
}
output {
File summaryFile = outputPrefix + "_talon_summary.tsv"
}
runtime {
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
databaseFile: {description: "Talon database.", category: "required"}
setVerbose: {description: "Print out the counts in terminal.", category: "advanced"}
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
datasetGroupsCsv: {description: "File of comma-delimited dataset groups to process together.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
summaryFile: {description: "Tab-delimited file of gene and transcript counts for each dataset."}
}
}
task Talon {
input {
Array[File] samFiles
String organism
String sequencingPlatform = "PacBio-RS-II"
File databaseFile
String genomeBuild
Float minimumCoverage = 0.9
Float minimumIdentity = 0.8
String outputPrefix
Int threads = 4
String memory = "25GiB"
Int timeMinutes = 2880
String dockerImage = "biocontainers/talon:v5.0_cv1"
}
command <<<
set -e
mkdir -p "$(dirname ~{outputPrefix})"
mkdir -p $PWD/tmp #Standard /tmp fills up which makes the SQLite process crash.
ln -s $PWD/tmp /tmp/sqltmp #Multiprocessing will crash if the absolute path is too long.
export TMPDIR=/tmp/sqltmp
printf "" > ~{outputPrefix}/talonConfigFile.csv #File needs to be emptied when task is rerun.
for file in ~{sep=" " samFiles}
do
configFileLine="$(basename ${file%.*}),~{organism},~{sequencingPlatform},${file}"
echo ${configFileLine} >> ~{outputPrefix}/talonConfigFile.csv
done
talon \
~{"--f " + outputPrefix + "/talonConfigFile.csv"} \
--db ~{databaseFile} \
--build ~{genomeBuild} \
--threads ~{threads} \
--cov ~{minimumCoverage} \
--identity ~{minimumIdentity} \
~{"--o " + outputPrefix + "/run"}
>>>
output {
File updatedDatabase = databaseFile
File talonLog = outputPrefix + "/run_QC.log"
File talonAnnotation = outputPrefix + "/run_talon_read_annot.tsv"
File talonConfigFile = outputPrefix + "/talonConfigFile.csv"
}
runtime {
cpu: threads
memory: memory
time_minutes: timeMinutes
docker: dockerImage
}
parameter_meta {
# inputs
samFiles: {description: "Input sam files.", category: "required"}
organism: {description: "The name of the organism from which the samples originated.", category: "required"}
sequencingPlatform: {description: "The sequencing platform used to generate long reads.", category: "required"}
databaseFile: {description: "Talon database. Created using initialize_talon_database.py.", category: "required"}
genomeBuild: {description: "Genome build (i.e. hg38) to use.", category: "required"}
minimumCoverage: {description: "Minimum alignment coverage in order to use a sam entry.", category: "common"}
minimumIdentity: {description: "Minimum alignment identity in order to use a sam entry.", category: "common" }
outputPrefix: {description: "Output directory path + output file prefix.", category: "required"}
threads: {description: "The number of threads to be used.", category: "advanced"}
memory: {description: "The amount of memory available to the job.", category: "advanced"}
timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
# outputs
updatedDatabase: {description: "Updated talon database."}
talonLog: {description: "Log file from talon run."}
talonAnnotation: {description: "Read annotation file from talon run."}
talonConfigFile: {description: "The talon configuration file."}
}
}