-
Notifications
You must be signed in to change notification settings - Fork 1
/
nanopolish.wdl
executable file
·244 lines (239 loc) · 6.45 KB
/
nanopolish.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
version 1.0
workflow guppytonanopolish {
input {
File reads
String type
String typeagain
File genome
File config
File model
File sortedbed
File pythonscript
File chromsizes
}
call guppy {
input:
reads=reads,
model=model,
config=config
}
call nanopolish {
input:
reads=reads,
allguppy=guppy.allguppy
}
call minimapalign {
input:
genome=genome,
allguppy=guppy.allguppy
}
call filter {
input:
sortedbam=minimapalign.sortedbam
}
call methylation {
input:
filteredbam=filter.filteredbam,
genome=genome,
reads=reads,
type=type,
nanoindex=nanopolish.nanoindex,
allguppy=guppy.allguppy,
filteredbai=filter.filteredbai,
nanofastaindex=nanopolish.nanofastaindex,
nanoindexgzi=nanopolish.nanoindexgzi,
nanoreaddb=nanopolish.nanoreaddb
}
call nanotobed {
input:
sortedbed=sortedbed,
typeagain=typeagain,
pythonscript=pythonscript,
methylationcalls=methylation.methylationcalls
}
call bedtobigwig {
input:
chromsizes=chromsizes,
FivemCavgbedgraph=nanotobed.FivemCavgbedgraph,
FivemCbedgraph=nanotobed.FivemCbedgraph
}
output {
File allguppy = guppy.allguppy
File filteredbam = filter.filteredbam
File methylationfreq = methylation.methylationcalls
File FivemCbed = nanotobed.FivemCbed
File FivemCavgbedgraph = nanotobed.FivemCavgbedgraph
File FivemCavgbw = bedtobigwig.FivemCavgbw
}
meta {
author: ""
email:""
description: "Workflow for using guppy and nanopolish to process nanopore output"
}
}
task guppy {
input {
File reads
File config
File model
}
command <<<
mkdir ./samples
tar zxvf ~{reads} --strip-components=1 -C ./samples
mkdir ./out
guppy_basecaller -i ./samples -s ./out -c ~{config} -m ~{model} -x "cuda:all" --num_callers 4 --gpu_runners_per_device 8
cat ./out/**/*.fastq > ./out/allguppy.fastq
>>>
runtime {
gpuType: "nvidia-tesla-v100"
gpuCount: 1
nvidiaDriverVersion: "470.161.03"
zones: ["us-central1-a"]
docker: "us-central1-docker.pkg.dev/aryeelab/docker/megalodon"
memory: "64 GB"
disks: "local-disk 1000 SSD"
cpu: 12
}
output {
File allguppy = "./out/allguppy.fastq"
}
}
task nanopolish {
input {
File allguppy
File reads
}
command <<<
mkdir ./index
cp ~{allguppy} ./index/
mkdir ./samples
tar zxvf ~{reads} --strip-components=1 -C ./samples
nanopolish index -d ./samples ./index/allguppy.fastq
>>>
runtime {
docker: "us-central1-docker.pkg.dev/aryeelab/docker/nanopolish:latest"
memory: "64G"
disks: "local-disk 1000 SSD"
cpu: 16
}
output {
File nanoindex = "./index/allguppy.fastq.index"
File nanofastaindex = "./index/allguppy.fastq.index.fai"
File nanoindexgzi = "./index/allguppy.fastq.index.gzi"
File nanoreaddb = "./index/allguppy.fastq.index.readdb"
}
}
task minimapalign {
input {
File allguppy
File genome
}
command <<<
minimap2 -a -x map-ont ~{genome} ~{allguppy} | samtools sort -T tmp -o sorted.bam
samtools index sorted.bam
>>>
runtime {
docker: "us-central1-docker.pkg.dev/aryeelab/docker/minimap2:latest"
memory: "64G"
disks: "local-disk 500 SSD"
cpu: 8
}
output {
File sortedbam = "sorted.bam"
}
}
task filter {
input {
File sortedbam
}
command <<<
samtools view -bh -q 50 ~{sortedbam} > filtered.bam
samtools index filtered.bam
>>>
runtime {
docker: "us-central1-docker.pkg.dev/aryeelab/docker/samtools:latest"
memory: "64G"
disks: "local-disk 500 SSD"
cpu: 8
}
output {
File filteredbam = "filtered.bam"
File filteredbai = "filtered.bam.bai"
}
}
task methylation {
input {
File reads
File allguppy
File filteredbam
File filteredbai
File nanoindex
File nanofastaindex
File nanoindexgzi
File nanoreaddb
File genome
String type
}
command <<<
mkdir ./samples
tar zxvf ~{reads} --strip-components=1 -C ./samples
mkdir ./temp
cp ~{allguppy} ~{filteredbam} ~{filteredbai} ~{nanoindex} ~{nanofastaindex} ~{nanoindexgzi} ~{nanoreaddb} ./temp/
nanopolish call-methylation --methylation=~{type} -t 8 -r ./temp/allguppy.fastq -b ./temp/filtered.bam -g ~{genome} > methylationcalls.tsv
>>>
runtime {
docker: "us-central1-docker.pkg.dev/aryeelab/docker/nanopolish:latest"
memory: "64G"
disks: "local-disk 500 SSD"
cpu: 8
}
output {
File methylationcalls = "methylationcalls.tsv"
}
}
task nanotobed {
input {
File pythonscript
File methylationcalls
File sortedbed
String typeagain
}
command <<<
python3 ~{pythonscript} -s -m ~{typeagain} ~{methylationcalls} > methylationfrequency.tsv
tail -n +2 methylationfrequency.tsv | awk '{ print $1"\t"$2"\t"$3+1"\tid-"NR"\t"$7; }' | sort-bed - > FivemC.percentage.bed
cat FivemC.percentage.bed | cut -f 1,2,3,5 | sort -k1,1 -k2,2n > nanopolish5mC.bedgraph
bedops --chop 100 ~{sortedbed} | bedmap --faster --echo --mean --count --delim "\t" --skip-unmapped - FivemC.percentage.bed | cat | cut -f 1,2,3,4 | sort -k1,1 -k2,2n > nanopolish5mC.1k.bedgraph
>>>
runtime {
docker: "us-central1-docker.pkg.dev/aryeelab/docker/bedops:latest"
memory: "64G"
disks: "local-disk 500 SSD"
cpu: 8
}
output {
File FivemCbed = "FivemC.percentage.bed"
File FivemCbedgraph = "nanopolish5mC.bedgraph"
File FivemCavgbedgraph = "nanopolish5mC.1k.bedgraph"
}
}
task bedtobigwig {
input {
File FivemCavgbedgraph
File FivemCbedgraph
File chromsizes
}
command <<<
bedGraphToBigWig ~{FivemCavgbedgraph} ~{chromsizes} FivemCavg.bw
bedGraphToBigWig ~{FivemCbedgraph} ~{chromsizes} FivemC.bw
>>>
runtime {
docker: "us-central1-docker.pkg.dev/aryeelab/docker/bedtools:latest"
memory: "64G"
disks: "local-disk 500 SSD"
cpu: 8
}
output {
File FivemCavgbw = "FivemCavg.bw"
File FivemCbw = "FivemC.bw"
}
}