-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bestie.wdl
186 lines (169 loc) · 7.03 KB
/
Bestie.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
version 1.0
import "structs.wdl" as structs
import "tasks/common.wdl" as common
import "tasks/trimgalore.wdl" as trimgalore
import "tasks/cutadapt.wdl" as cutadapt
import "tasks/fastqc.wdl" as fastqc
import "tasks/picard.wdl" as picard
import "tasks/fgbio.wdl" as fgbio
import "tasks/alignment.wdl" as align
import "tasks/gatk.wdl" as gatk
import "tasks/ichorcna.wdl" as ichorcna
import "workflows/qc.wdl" as qc
import "workflows/fastqToBam.wdl" as fastqToBam
import "tasks/multiqc.wdl" as multiqc
workflow FastqToVariants {
input {
String fastqcModule = "FastQC/0.11.9-Java-11"
String trimgaloreModule = "Trim_Galore/0.6.6-GCCcore-9.3.0-Python-3.8.2"
String multiqcModule = "multiqc/1.12-GCCcore-11.3.0"
String bwaModule = "BWA/0.7.17-GCCcore-11.3.0"
String picardModule = "picard/2.26.10-Java-8-LTS"
String gatkModule = "GATK/4.2.4.1-Java-8-LTS"
String hmmcopyutilsModule = "hmmcopy_utils/5911bf69f1-foss-2022a"
String samtoolsModule = "SAMtools/1.15.1-GCC-11.3.0"
String fgbioModule = "fgbio/1.5.1"
Boolean runCutadapt = false
String cutadaptModule = "cutadapt/4.2-GCCcore-11.3.0"
Array[String] read1Adapters = ["AGATCGGAAGAGC"]
Array[String] read2Adapters = ["AGATCGGAAGAGC"]
Boolean runTwistUmi = false
Boolean runReadcounter = true
Boolean runBaseQualityRecalibration = true
File sampleJson
Reference reference
IndexedFile dbsnp
IndexedFile cosmic
Array[IndexedFile] knownSites
File targetIntervalList
Int targetScatter
BwaIndex referenceBwaIndex
}
SampleConfig sampleConfig = read_json(sampleJson)
call common.CheckModules as checkModules {
input:
modules = [fastqcModule,trimgaloreModule,multiqcModule,bwaModule,picardModule,gatkModule,hmmcopyutilsModule,samtoolsModule,fgbioModule]
}
call picard.SplitAndPadIntervals as splitIntervals {
input:
picardModule = picardModule,
inputIntervalListFile = targetIntervalList,
outputPrefix = "Targets_padded_and_split",
targetScatter = targetScatter,
padding = 200
}
scatter (sample in sampleConfig.samples) {
call fastqToBam.FastqToBam as fqToBam {
input:
sample = sample,
fastqcModule = fastqcModule,
trimgaloreModule = trimgaloreModule,
bwaModule = bwaModule,
picardModule = picardModule,
gatkModule = gatkModule,
samtoolsModule = samtoolsModule,
fgbioModule = fgbioModule,
runCutadapt = runCutadapt,
cutadaptModule = cutadaptModule,
read1Adapters = read1Adapters,
read2Adapters = read2Adapters,
runBaseQualityRecalibration = runBaseQualityRecalibration,
reference = reference,
referenceBwaIndex = referenceBwaIndex,
runCutadapt = runCutadapt,
dbsnp = dbsnp,
knownSites = knownSites,
targetIntervalList = targetIntervalList,
runTwistUmi = runTwistUmi
}
#Does not work: sample.alignedReads = fqToBam. That is why I added this task to serialise/deserialise the json object and add the variables.
call common.AddAlignedReadsToSampleDescriptor as addBamToSample {
input:
sample=sample,
bam=fqToBam.bam
}
SampleDescriptor sampleNew = addBamToSample.sampleUpdated
if(runReadcounter){
call ichorcna.HmmcopyReadcounter as readcounter500kbp {
input:
inputBam=fqToBam.bam.file,
inputBai=fqToBam.bam.index,
outputPrefix=sample.name,
windowkilobase=500,
referencefai=reference.fai,
hmmcopyutilsModule=hmmcopyutilsModule,
samtoolsModule=samtoolsModule
}
call ichorcna.HmmcopyReadcounter as readcounter1000kbp {
input:
inputBam=fqToBam.bam.file,
inputBai=fqToBam.bam.index,
outputPrefix=sample.name,
windowkilobase=1000,
referencefai=reference.fai,
hmmcopyutilsModule=hmmcopyutilsModule,
samtoolsModule=samtoolsModule
}
}
#variant callin to sub pipeline
#scatter by sequencing targets intervals
#scatter (scatteredtargetsIdx in range(length(splitIntervals.paddedScatteredIntervalList))) {
#haplotypecallergvcf
# call gatk.HaplotypeCallerGVcf as haplotypeCallerGvcf {
# input:
# gatkModule = gatkModule,
# reference = reference,
# inputBam = fqToBam.bam,
# outputVcfBasename = sample.name + ".idx_" + scatteredtargetsIdx,
# targetIntervalList = splitIntervals.paddedScatteredIntervalList[scatteredtargetsIdx]
# }
#genotypegvcf per sample?
#mutect
#Lofreq
#}
}
#run multiqc to bundle outputs
Array[File] files = flatten(
flatten(
[
fqToBam.fastqcZip,
[
fqToBam.markdupLog,
fqToBam.qcZip,
]
]
)
)
Array[File?] optionalPerSampleFiles = flatten([select_all(fqToBam.umiQcZip),select_all(fqToBam.preUmiQcZip),select_all(fqToBam.bqsrQcZip),select_all(fqToBam.umiFamilySizeHistogram)])
Array[File?] optionalPerReadgroupFiles = select_all(flatten(fqToBam.cutadaptLogs))
#add fqToBam.fastqcZip or not???
Array[File?] optionalFiles = select_all(flatten([optionalPerSampleFiles,optionalPerReadgroupFiles]))
call multiqc.MultiQC as multiqc {
input:
multiqcModule = multiqcModule,
files = files,
prefix = "project_multiqc",
#This might be a miss on mixed data so try to include a file 'fqToBam.qcZip' to make it work (hopefully).
optionalFiles = optionalFiles
}
output {
#output files of workflow
#needs to be debugged probably
#fastqtobam certain output
Array [File] markdupLogs = fqToBam.markdupLog
Array [File] qcZips = fqToBam.qcZip
#fastqtobam optional output
Array [File?] cutadaptLogs = flatten(fqToBam.cutadaptLogs)
Array [File?] cutadaptFastqcZip = flatten(fqToBam.cutadaptFastqcZip)
Array [File?] umiQcZips = fqToBam.umiQcZip
Array [IndexedFile] bams = fqToBam.bam
Array[SampleDescriptor] samples = sampleNew
#This depends on fastqToBam
File multiqcHtml = multiqc.html
File multiqcDir = multiqc.dir
}
meta {
author: "MMTerpstra"
description: "This is the single samples fastqs to aligned bam workflow."
}
}