-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresequencing-human-complete.yml
420 lines (420 loc) · 18.2 KB
/
resequencing-human-complete.yml
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
---
global:
# Initial Directory Setup
- indir: "data/processed"
- outdir: "data/analysis"
# Find Samples
- sample_rule: (Sample.*)$
- find_by_dir: 1
# Output Directory Structure
- by_sample_outdir: 1
# Processed Dirs
- trimmomatic_dir: "data/processed/{$sample}/trimmomatic"
- raw_fastqc_dir: "data/processed/{$sample}"
# Analysis Dirs
- bowtie2_dir: "data/analysis/{$sample}/bowtie2"
- samtools_dir: "data/analysis/{$sample}/samtools"
- picard_dir: "data/analysis/{$sample}/picard"
- gatk_dir: "data/analysis/{$sample}/gatk"
- freebayes_dir: "data/analysis/{$sample}/freebayes"
# Tmp Dir - Reference it as the environmental variable TMPDIR
- bowtie2_tmp_dir: "{$ENV{TMPDIR}}/{$sample}/bowtie2_tmp/tmp"
# Reference Data
- bowtie2_reference: "/scratch/Reference_Genomes/Public/Vertebrate_mammalian/Homo_sapiens/ENSEMBL-release-81-GRCh38/Homo_sapiens.GRCh38.dna.toplevel"
- reference: "{$self->bowtie2_reference}.fa"
# GATK Args
- library: 1
- pcrModel: 0
- goldenVcf: 0
- ploidy: 2
# Shortcuts for long read names
- READ1: "{$self->raw_fastqc_dir}/{$sample}_read1.fastq.gz"
- READ2: "{$self->raw_fastqc_dir}/{$sample}_read2.fastq.gz"
- TR1: "{$self->trimmomatic_dir}/{$sample}_read1_trimmomatic"
- TR2: "{$self->trimmomatic_dir}/{$sample}_read2_trimmomatic"
# HPC Directives
- HPC:
- account: 'gencore'
- partition: 'serial'
- module: 'gencore gencore_dev gencore_variant_detection/1.0'
- cpus_per_task: 1
- commands_per_node: 1
rules:
- bowtie2:
local:
- indir: "{$self->trimmomatic_dir}"
- INPUT: "{$self->trimmomatic_dir}/{$sample}"
- OUTPUT: "{$self->bowtie2_dir}/{$sample}_aligned.sam"
- HPC:
- mem: '50GB'
- cpus_per_task: 12
- walltime: '12:00:00'
process: |
#TASK tags={$sample}
bowtie2 -p 12 -x {$self->bowtie2_reference} \
-1 {$self->INPUT}_read1_trimmomatic_1PE.fastq.gz \
-2 {$self->INPUT}_read2_trimmomatic_2PE.fastq.gz \
-S {$self->OUTPUT}
- samtools_view:
local:
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->bowtie2_dir}/{$sample}_aligned.sam"
- OUTPUT: "{$self->samtools_dir}/{$sample}_aligned.bam"
- HPC:
- deps: 'bowtie2'
- mem: '28GB'
- walltime: '12:00:00'
process: |
#TASK tags={$sample}
samtools view -b -S {$self->INPUT} \
> {$self->OUTPUT}
- remove_SAM:
local:
- indir: "{$self->bowtie2_dir}"
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->bowtie2_dir}/{$sample}_aligned.sam"
- HPC:
- deps: 'samtools_view'
- mem: '10GB'
- walltime: '12:00:00'
- commands_per_node: 10
process: |
#TASK tags={$sample}
rm -rf {$self->INPUT}
- picard_cleansam:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->samtools_dir}/{$sample}_aligned.bam"
- OUTPUT: "{$self->picard_dir}/{$sample}_cleaned.aligned.bam"
- HPC:
- deps: 'samtools_view'
- mem: '25GB'
- walltime: '10:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g CleanSam \
INPUT={$self->INPUT} \
O={$self->OUTPUT} \
TMP_DIR={$self->bowtie2_tmp_dir}
- picard_sortsam:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- OUTPUT: "{$self->picard_dir}/{$sample}_csorted.cleaned.aligned.bam"
- HPC:
- deps: 'picard_cleansam'
- mem: '25GB'
- walltime: '10:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g SortSam \
INPUT={$self->INPUT} \
O={$self->OUTPUT} \
SO=coordinate \
TMP_DIR={$self->bowtie2_tmp_dir}
- picard_collect_multiple_metrics:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->picard_dir}/{$sample}_collmulmetr.csorted.cleaned.aligned"
- PROGRAM: "PROGRAM=CollectAlignmentSummaryMetrics PROGRAM=CollectInsertSizeMetrics PROGRAM=QualityScoreDistribution PROGRAM=MeanQualityByCycle"
- HPC:
- deps: 'picard_sortsam'
- mem: '25GB'
- walltime: '03:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g CollectMultipleMetrics \
TMP_DIR={$self->bowtie2_tmp_dir} \
I={$self->INPUT} \
O={$self->OUTPUT} \
{$self->PROGRAM}
- picard_add_or_replace_groups:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->picard_dir}/{$sample}_withrg.csorted.cleaned.aligned.bam"
- ARGS: "SORT_ORDER=coordinate RGID=1 RGLB={$self->library} RGPL=illumina RGPU=unit1 RGSM={$sample} RGCN=NYUAD"
- HPC:
- deps: 'picard_sortsam'
- mem: '25GB'
- walltime: '10:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g AddOrReplaceReadGroups \
I={$self->INPUT} \
O={$self->OUTPUT} \
{$self->ARGS}
- picard_bamindex:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_withrg.csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->picard_dir}/{$sample}_withrg.csorted.cleaned.aligned.bam"
- HPC:
- deps: 'picard_add_or_replace_groups'
- mem: '25GB'
- walltime: '10:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g BuildBamIndex \
I={$self->INPUT} \
TMP_DIR={$self->bowtie2_tmp_dir}
- picard_markdups:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_withrg.csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->picard_dir}/{$sample}_mdup.withrg.csorted.cleaned.aligned.bam"
- metrics_file: "{$self->picard_dir}/{$sample}_markDup_metrics_file.txt"
- HPC:
- deps: 'picard_bamindex'
- mem: '28GB'
- walltime: '18:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g MarkDuplicates \
M={$self->metrics_file} \
I={$self->INPUT} \
O={$self->OUTPUT} \
MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=100 \
TMP_DIR={$self->bowtie2_tmp_dir}
- picard_bamindex2:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_mdup.withrg.csorted.cleaned.aligned.bam"
- HPC:
- deps: 'picard_markdups'
- mem: '25GB'
- walltime: '10:00:00'
process: |
#TASK tags={$sample}
picard -Xmx2g BuildBamIndex \
I={$self->INPUT} \
TMP_DIR={$self->bowtie2_tmp_dir}
- gatk_bqsr_1:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_mdup.withrg.csorted.cleaned.aligned.bam"
- recal_data: "{$self->picard_dir}/{$sample}_recal_data.txt"
- HPC:
- deps: 'picard_bamindex2'
- mem: '60GB'
- walltime: '10:00:00'
- cpus_per_task: 12
process: |
#TASK tags={$sample}
gatk -Xmx25g -T BaseRecalibrator \
-nct 12 \
-R {$self->reference} \
-I {$self->INPUT} \
-knownSites /scratch/Reference_Genomes/Public/Vertebrate_mammalian/Homo_sapiens/dbSNP/GRCh38/00-All.vcf.gz \
-o {$self->recal_data}
- gatk_bqsr_2:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_mdup.withrg.csorted.cleaned.aligned.bam"
- recal_data: "{$self->picard_dir}/{$sample}_recal_data.txt"
- recal_data2: "{$self->picard_dir}/{$sample}_post_recal_data.txt"
- HPC:
- deps: 'gatk_bqsr_1'
- mem: '60GB'
- walltime: '14:00:00'
- cpus_per_task: 12
process: |
#TASK tags={$sample}
gatk -Xmx25g -T BaseRecalibrator \
-nct 12 \
-R {$self->reference} \
-I {$self->INPUT} \
-knownSites /scratch/Reference_Genomes/Public/Vertebrate_mammalian/Homo_sapiens/dbSNP/GRCh38/00-All.vcf.gz \
-BQSR {$self->recal_data} \
-o {$self->recal_data2}
- gatk_analyzeCovariates:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- recal_data: "{$self->picard_dir}/{$sample}_recal_data.txt"
- recal_data2: "{$self->picard_dir}/{$sample}_post_recal_data.txt"
- recalib_plots: "{$self->picard_dir}/{$sample}_recalibration_plots.pdf"
- HPC:
- deps: 'gatk_bqsr_2'
- mem: '60GB'
- walltime: '14:00:00'
process: |
#TASK tags={$sample}
gatk -Xmx25g -T AnalyzeCovariates \
-R {$self->reference} \
-before {$self->recal_data} \
-after {$self->recal_data2} \
-plots {$self->recalib_plots}
- gatk_printreads:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->picard_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_mdup.withrg.csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->picard_dir}/{$sample}_recalibrated.mdup.withrg.csorted.cleaned.aligned.bam"
- recal_data: "{$self->picard_dir}/{$sample}_recal_data.txt"
- HPC:
- deps: 'gatk_bqsr_2'
- mem: '60GB'
- walltime: '14:00:00'
- cpus_per_task: 12
process: |
#TASK tags={$sample}
gatk -Xmx25g -T PrintReads \
-nct 12 \
-R {$self->reference} \
-I {$self->INPUT} \
-BQSR {$self->recal_data} \
-o {$self->OUTPUT}
- samtools_mpileup:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_recalibrated.mdup.withrg.csorted.cleaned.aligned.bam"
- SAM: "{$self->samtools_dir}/{$sample}_recalibrated.mdup.withrg.csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->samtools_dir}/{$sample}_aligned.sorted.vcf.gz"
- HPC:
- deps: 'gatk_printreads'
- mem: '30GB'
- walltime: '14:00:00'
process: |
#TASK tags={$sample}
rm -rf {$self->OUTPUT} && \
ln -s {$self->INPUT} {$self->SAM} && \
samtools index {$self->SAM} && \
samtools mpileup -ugf {$self->reference} \
{$self->INPUT} | bcftools call -vmO z -o \
{$self->OUTPUT}
- tabix_index:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->samtools_dir}/{$sample}_aligned.sorted.vcf.gz"
- OUTPUT: "{$self->samtools_dir}/{$sample}_aligned.sorted.vcf.gz"
- HPC:
- deps: 'samtools_mpileup'
- mem: '20GB'
- walltime: '14:00:00'
process: |
#TASK tags={$sample}
tabix -p vcf {$self->INPUT}
- bcftools_stats:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->samtools_dir}/{$sample}_aligned.sorted.vcf.gz"
- OUTPUT: "{$self->samtools_dir}/{$sample}_aligned.sorted.vcf.stats"
- HPC:
- deps: 'tabix_index'
- mem: '20GB'
- walltime: '05:00:00'
process: |
#TASK tags={$sample}
bcftools stats -F {$self->reference} -s - {$self->INPUT} \
> {$self->OUTPUT}
- bcftools_filter:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->samtools_dir}/{$sample}_aligned.sorted.vcf.gz"
- OUTPUT: "{$self->samtools_dir}/{$sample}_filteredQ10.aligned.sorted.vcf.gz"
- HPC:
- deps: 'tabix_index'
- mem: '40GB'
- walltime: '32:00:00'
process: |
#TASK tags={$sample}
bcftools filter -O z \
-o {$self->OUTPUT} \
-s LOWQUAL -i'%QUAL>10' \
{$self->INPUT}
- bcftools_snpeff:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->samtools_dir}"
- INPUT: "{$self->samtools_dir}/{$sample}_filteredQ10.aligned.sorted.vcf.gz"
- OUTPUT: "{$self->samtools_dir}/{$sample}_snpeff.filteredQ10.aligned.sorted.vcf"
- REPORT: "{$self->samtools_dir}/{$sample}_snpeff.filteredQ10.aligned.sorted.html"
- HPC:
- deps: 'bcftools_filter'
- mem: '40GB'
- walltime: '32:00:00'
process: |
#TASK tags={$sample}
snpEff -Xmx25G GRCh38.82 -v \
-s {$self->REPORT} \
{$self->INPUT} > {$self->OUTPUT}
- freebayes_vcf_calling:
local:
- indir: "{$self->samtools_dir}"
- outdir: "{$self->freebayes_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_recalibrated.mdup.withrg.csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->freebayes_dir}/{$sample}_freebayes_raw.vcf"
- HPC:
- deps: 'samtools_mpileup'
- mem: '40GB'
- walltime: '32:00:00'
process: |
#TASK tags={$sample}
freebayes -f {$self->reference} \
{$self->INPUT} \
> {$self->OUTPUT}
- freebayes_vcffilter:
local:
- indir: "{$self->freebayes_dir}"
- outdir: "{$self->freebayes_dir}"
- INPUT: "{$self->freebayes_dir}/{$sample}_freebayes_raw.vcf"
- OUTPUT: "{$self->freebayes_dir}/{$sample}_filtered.freebayes.vcf"
- HPC:
- deps: 'freebayes_vcf_calling'
- mem: '30GB'
- walltime: '32:00:00'
process: |
#TASK tags={$sample}
vcffilter -f "QUAL > 1 & QUAL / AO > 10 & SAF > 0 & SAR > 0 & RPR > 1 & RPL > 1" \
{$self->INPUT} > {$self->OUTPUT}
- freebayes_snpeff:
local:
- indir: "{$self->freebayes_dir}"
- outdir: "{$self->freebayes_dir}"
- INPUT: "{$self->freebayes_dir}/{$sample}_filtered.freebayes.vcf"
- OUTPUT: "{$self->freebayes_dir}/{$sample}_snpeff.filtered.freebayes.vcf"
- REPORT: "{$self->freebayes_dir}/{$sample}_snpeff.filtered.freebayes.html"
- HPC:
- deps: 'freebayes_vcffilter'
- mem: '30GB'
- walltime: '32:00:00'
process: |
#TASK tags={$sample}
snpEff -Xmx25G GRCh38.82 -v \
-s {$self->REPORT} \
{$self->INPUT} > {$self->OUTPUT}
- gatk_haplotypecaller:
local:
- indir: "{$self->picard_dir}"
- outdir: "{$self->gatk_dir}"
- INPUT: "{$self->picard_dir}/{$sample}_recalibrated.mdup.withrg.csorted.cleaned.aligned.bam"
- OUTPUT: "{$self->gatk_dir}/{$sample}_haplotype.realigned.withrg.csorted.cleaned.aligned.vcf"
- ARGS: "-stand_emit_conf 10 -stand_call_conf 30 --genotyping_mode DISCOVERY"
- HPC:
- deps: 'gatk_printreads'
- mem: '60GB'
- walltime: '40:00:00'
- cpus_per_task: 12
process: |
#TASK tags={$sample}
gatk -T HaplotypeCaller \
-R {$self->reference} \
-nct 12 \
--dbsnp /scratch/Reference_Genomes/Public/Vertebrate_mammalian/Homo_sapiens/dbSNP/GRCh38/00-All.vcf.gz \
-I {$self->INPUT} \
{$self->ARGS} \
-o {$self->OUTPUT}