-
Notifications
You must be signed in to change notification settings - Fork 0
/
xrbs_ultima.wdl
220 lines (190 loc) · 5.2 KB
/
xrbs_ultima.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
version 1.0
workflow XRBS {
String pipeline_ver = 'dev'
String image_id = sub(pipeline_ver, "dev", "latest")
input {
String sample_id
File fastq1
File reference
File reference_index
File reference_positions
}
call fastqc { input:
fastq1 = fastq1,
sample_id = sample_id
}
call trimming {input:
fastq1_in = fastq1,
sample_id = sample_id
}
call fqconv {input:
fastq1 = trimming.fastq1,
sample_id = sample_id
}
call align {input:
fastq = fqconv.fastq,
reference_index = reference_index,
sample_id = sample_id
}
call bconv {input:
bam = align.bam_out,
sample_id = sample_id
}
# call filter {input:
# bam = bconv.sorted_bam_out,
# sample_id = sample_id
# }
call methylation {input:
#bam = filter.filter_bam_out,
filtered_bam = bconv.sorted_bam_out,
reference_pos = reference_positions,
sample_id = sample_id
}
output {
File meth_calls = methylation.calls
File meth_metrics = methylation.metrics
File flagstat = bconv.flagstat
File bconv_metrics = bconv.metrics
File fastqc_out = fastqc.fastqc_out
File cutadapt_report = trimming.cutadapt_report
}
}
task fastqc {
input {
File fastq1
String sample_id
}
command {
mkdir ${sample_id}_fastqc_out
fastqc -o ${sample_id}_fastqc_out ${fastq1}
zip -r ${sample_id}_fastqc_out.zip ${sample_id}_fastqc_out
}
runtime {
docker: "salvacasani/fastqc"
}
output {
File fastqc_out = "${sample_id}_fastqc_out.zip"
}
}
task trimming {
input {
File fastq1_in
String sample_id
}
command {
cutadapt --discard -a CTGTCTCTTATACACATCT -o ${sample_id}.cutadapt.fastq.gz ${fastq1_in} > ${sample_id}_cutadapt_report.txt
/TrimGalore-0.6.10/trim_galore --path_to_cutadapt cutadapt --nextera --nextseq 20 ${sample_id}.cutadapt.fastq.gz
}
runtime {
docker: "salvacasani/trimming:latest"
}
output {
File cutadapt_report = "${sample_id}_cutadapt_report.txt"
File fastq1 = "${sample_id}.cutadapt_trimmed.fq.gz"
}
}
task fqconv {
input {
File fastq1
String sample_id
}
command {
/methylCtools/methylCtools fqconv -1 ${fastq1} ${sample_id}.conv.fq
}
runtime {
docker: "salvacasani/methylctools:latest"
bootDiskSizeGb: 40
memory: "20GB"
disks: "local-disk " + "500" + " SSD"
}
output {
File fastq = "${sample_id}.conv.fq"
}
}
task align {
input {
File reference_index
File fastq
String sample_id
}
command {
mkdir genome_index
tar zxvf ${reference_index} -C genome_index
# Get genome index fasta name.
BWT=$(find genome_index -name '*.bwt')
GENOME_INDEX_FA="$(dirname $BWT)"/"$(basename $BWT .bwt)"
echo "Using bwa index: $GENOME_INDEX_FA"
bwa mem -t 4 -p -M -T 0 $GENOME_INDEX_FA ${fastq} > align.sam
samtools view -Sb align.sam > ${sample_id}.reads.conv.bam
}
runtime {
docker: "salvacasani/bwa:latest"
bootDiskSizeGb: 40
memory: "20GB"
disks: "local-disk " + "500" + " SSD"
}
output {
File bam_out = "${sample_id}.reads.conv.bam"
}
}
task bconv {
input {
File bam
String sample_id
}
command {
/methylCtools/methylCtools bconv ${bam} -m ${sample_id}.human.conv.sort.metrics.txt - | samtools sort -T ${sample_id}.human.sort -@ 4 - > ${sample_id}.sorted.bam
samtools index ${sample_id}.sorted.bam
samtools flagstat ${sample_id}.sorted.bam > ${sample_id}.sorted.bam.flagstat
}
runtime {
docker: "salvacasani/methylctools:latest"
bootDiskSizeGb: 40
memory: "20GB"
disks: "local-disk " + "500" + " SSD"
}
output {
File sorted_bam_out = "${sample_id}.sorted.bam"
File metrics = "${sample_id}.human.conv.sort.metrics.txt"
File flagstat = "${sample_id}.sorted.bam.flagstat"
}
}
task filter {
input {
File sorted_bam
String sample_id
}
command {
Rscript filter.vh20200112.R ${sorted_bam}
}
runtime {
docker: "salvacasani/r_filter:latest"
bootDiskSizeGb: 40
memory: "20GB"
disks: "local-disk " + "500" + " SSD"
}
output {
File fastq = "${sample_id}.filter.sorted.bam"
}
}
task methylation {
input {
File filtered_bam
File reference_pos
String sample_id
}
command {
unzip ${reference_pos}
/methylCtools/methylCtools bcall --trimPE --metrics ${sample_id}.human.sort.filter.call.metrics GRCh38.pos.gz ${filtered_bam} - | bgzip > ${sample_id}.call.gz
}
runtime {
docker: "salvacasani/methylctools:latest"
bootDiskSizeGb: 40
memory: "20GB"
disks: "local-disk " + "500" + " SSD"
}
output {
File metrics = "${sample_id}.human.sort.filter.call.metrics"
File calls = "${sample_id}.call.gz"
}
}