-
Notifications
You must be signed in to change notification settings - Fork 0
/
panel_somatic_gatk4.nf
1410 lines (1111 loc) · 53.1 KB
/
panel_somatic_gatk4.nf
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
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION="1.0"
log.info "===================================================="
log.info "YunYing NGS Analysis Nextflow Pipeline (v${VERSION})"
log.info "Process begins at ${workflow.start}!"
log.info "===================================================="
params.help = ""
if (params.help) {
log.info " "
log.info "USAGE: "
log.info " "
log.info "nextflow run panel_somatic_gatk4.nf -c nextflow_basic.conf -profile docker --SampleId *** --PanelName *** --fq1 R1.fq.gz --fq2 R2.fq.gz --ctl_fq1 X_R1.fq.gz --ctl_fq2 X_R2.fq.gz --bed target_bed_file"
log.info " "
log.info "Optional arguments:"
log.info " --SampleId STRING Sample name (dafault: fq1 basename)"
log.info " --PanelName STRING Panel name, used for exported gene filter (required)"
log.info " --fq1 FILE tumor fastq(.gz) file path for read R1 (required)"
log.info " --fq2 FILE tumor fastq(.gz) file path for read R2 (required)"
log.info " --ctl_fq1 FILE control fastq(.gz) file path for read R1 (required for paired sample)"
log.info " --ctl_fq2 FILE control fastq(.gz) file path for read R2 (required for paired sample)"
log.info " --bed FILE the (target) capture bed file (absolute) path (required)"
log.info " --st_bed FILE the bed file (absolute) path used for region statistics (optional)"
log.info " --sv_bed FILE the bed file (absolute) path used for sv analysis (optional)"
log.info " --baseline STRING ONCOCNV control clade flag (optional, for cnv is required)"
log.info " --msi_db STRING msi database subdir in related to directory /yunying/ref/... (optional, for msi is required)"
log.info " --msi_depth STRING msi locus depth threshold (optional, for msi is required)"
log.info " --output DIR Output directory (default: /yunying/data/product/result/dev_test/)"
log.info " --RG STRING Read group tag (dafault: fq1 basename)"
log.info " "
log.info "===================================================================="
exit 1
}
tumor_fq1 = file("$params.fq1")
tumor_fq2 = file("$params.fq2")
params.ctl_fq1 = ""
params.ctl_fq2 = ""
ctl_fq1 = params.ctl_fq1 ? file("$params.ctl_fq1") : ""
ctl_fq2 = params.ctl_fq2 ? file("$params.ctl_fq2") : ""
bed_target = Channel.value("$params.bed")
params.output = "/yunying/data/product/result/dev_test"
params.SampleId = tumor_fq1.name.split('\\_')[0]
params.RG = tumor_fq1.name.split('\\_')[0]
params.high_recall = false
params.threads = 16
params.remove_dup = true
params.recal = 'elprep'
params.st_bed = ''
params.sv_bed = ''
params.baseline = ''
params.msi_db = ''
params.codinglength = ''
params.queue_name = "dev"
params.update_db = "no"
def runID = "uuid"
def raw_unfilter_dir = "${params.output}/unfiltered_raw_vars"
def filtered_review_dir = "${params.output}/"
parent_top_dir = file("${params.output}").parent
def chip_batch_id = ("${parent_top_dir}" - ~/.*\\//)
def unified_bam_dir = "${parent_top_dir}/bam"
st_bed_ch = params.st_bed ? Channel.value("$params.st_bed") : Channel.value("$params.bed")
sv_bed_ch = params.sv_bed ? Channel.value("$params.sv_bed") : Channel.value("$params.bed")
sv_process_mark = params.sv_bed =~ /null.bed$/ ? false : true
memory_scale1 = Math.ceil(tumor_fq1.size()/1024/1024/1024 + tumor_fq2.size()/1024/1024/1024)
memory_scale2 = Math.ceil(ctl_fq1.size()/1024/1024/1024 + ctl_fq2.size()/1024/1024/1024)
memory_scale1 = params.high_recall ? memory_scale1 * 2 : memory_scale1
memory_scale2 = params.high_recall ? memory_scale2 * 2 : memory_scale2
println "The memory scale factor is ${memory_scale1}, ---, ${memory_scale2} * 15G for memory configuration!"
split_region_count = params.threads/2
log.info "Sample ${params.SampleId} was running ..."
log.info "And the result files will be put into directory ${filtered_review_dir}."
// alignment database and gatk bundle database
def genome_dir = "/yunying/ref/human/b37/"
def ref_fa = "${genome_dir}b37_Homo_sapiens_assembly19.fasta"
def ref_elfa = "${genome_dir}b37_Homo_sapiens_assembly19.elfasta"
def ref_fa_dict = "${genome_dir}b37_Homo_sapiens_assembly19.dict"
def gatk_db_dir = "${genome_dir}gatk"
def oncocnv_db_dir = "${genome_dir}oncocnv"
def snpeff_db_dir = "${genome_dir}snpeff"
def hotspots_mutscan_db = file("${genome_dir}mutscan/hotspots.csv")
def core_hotspots_conf = file("${genome_dir}variation_hotspots/core_hotspots_v1.0.vcf")
def core_hotspots_bed = file("${genome_dir}variation_hotspots/core_hotspots_v1.0.bed")
def complex_hotspot_bed = file("${genome_dir}variation_hotspots/complex_hotspot_mutation.bed")
def chemotherapy_rs_vcf = file("${genome_dir}variation_hotspots/chemotherapy_rs_v1.0.vcf")
def chemotherapy_rs_bed = file("${genome_dir}variation_hotspots/chemotherapy_rs_v1.0.bed")
def radiotherapy_rs_vcf = file("${genome_dir}variation_hotspots/radiotherapy_rs_v1.0.vcf")
def chemo_radio_rs_vcf = file("${genome_dir}variation_hotspots/chemotherapy_radiotherapy_rs_v1.0.vcf")
def chemo_radio_rs_bed = file("${genome_dir}variation_hotspots/chemotherapy_radiotherapy_rs_v1.0.bed")
def clinvar_vcf_conf = file("${genome_dir}snpsift/clinvar_20210828.vcf.gz")
def variation_hotspots_conf = file("${genome_dir}variation_hotspots/yunying_hotspots_GRCh37_v1.0.txt")
def msi_database_dir = "${genome_dir}/msi/${params.msi_db}"
// all configuration including qc, alignment, and gatk process configuration file (module ---> software/toolkit ---> conf)
def prefix_conf_dir = "/yunying/codes/product/module"
def preprocess_conf = file("${prefix_conf_dir}/software/preprocess/fastp/conf/fastp_standard.conf")
def mutscan_conf = file("${prefix_conf_dir}/software/somatic/Mutscan/conf/mutscan_filter.conf")
def align_conf = file("${prefix_conf_dir}/toolkit/align_sambam_vcf/conf/align_standard.conf")
def gatk_toolkit_dir = "${prefix_conf_dir}/toolkit/gatk/"
def recal_conf = file("${gatk_toolkit_dir}refinement/conf/refinement_standard.conf")
def sv_svaba_conf = file("${prefix_conf_dir}/software/sv/svaba/conf/somatic_sv_paired.conf")
def sv_hotspots_conf = file("${genome_dir}anno/sv_gene_extend_region.txt")
def sv_partner_conf = file("${genome_dir}anno/sv_hotspots_partner.txt")
def cnv_oncocnv_conf = file("${prefix_conf_dir}/software/cnv/oncocnv/conf/somatic_cnv_tumor.conf")
somatic_calling_conf = params.high_recall ? "somatic_high_depth_cfdna.conf" : "somatic_tumor_standard.conf"
trim_in_conf = params.high_recall ? "trim_include_conservative.conf" : "trim_include_standard.conf"
trim_ex_conf = params.high_recall ? "trim_exclude_conservative2.conf" : "trim_exclude_standard.conf"
def mutect2_conf = file("${gatk_toolkit_dir}somatic/conf/${somatic_calling_conf}")
def secondary_annotate_conf = file("${gatk_toolkit_dir}annotation/conf/secondary_bam_annotate.conf")
def germline_calling_conf = file("${gatk_toolkit_dir}germline/conf/haplotype_caller.conf")
def anno_snpeff_conf = file("${prefix_conf_dir}/software/annotation/SnpEff/conf/snpeff_canon_only.conf")
def somatic_filter_conf = file("${gatk_toolkit_dir}filter/conf/somatic_high_recall.conf")
def vcf_trim_in_conf = file("${prefix_conf_dir}/toolkit/align_sambam_vcf/conf/${trim_in_conf}")
def vcf_trim_ex_conf = file("${prefix_conf_dir}/toolkit/align_sambam_vcf/conf/${trim_ex_conf}")
def perbase_conf = file("${prefix_conf_dir}/software/calling/perbase/conf/perbase_standard.conf")
process preprocess_fastp_tumor_standard {
// use fastp to trim low quality bases from reads and do adapters trimming
container '10.168.2.67:5000/bromberglab/fastp:latest'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*qc.json'
cpus params.threads
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
input:
file tumor_fq1
file tumor_fq2
output:
path "${tumor_fastq_r1}" into trimmed_tumor_fq_r1_ch
path "${tumor_fastq_r2}" into trimmed_tumor_fq_r2_ch
path "${fastp_qc_json}" into fastq_qc_json
script:
tumor_fastq_r1 = "${params.SampleId}_tumor_r1_trimmed.fastq"
tumor_fastq_r2 = "${params.SampleId}_tumor_r2_trimmed.fastq"
fastp_qc_json = "${params.SampleId}_tumor_fastp_qc.json"
"""
cat ${preprocess_conf} | xargs \
fastp -i ${tumor_fq1} -I ${tumor_fq2} -w ${task.cpus} -j ${fastp_qc_json} -o ${tumor_fastq_r1} -O ${tumor_fastq_r2}
"""
}
process preprocess_fastp_control_standard {
// use fastp to trim low quality bases from reads and do adapters trimming
container '10.168.2.67:5000/bromberglab/fastp:latest'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*qc.json'
cpus params.threads
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
file ctl_fq1
file ctl_fq2
output:
path "${ctl_fastq_r1}" into trimmed_ctl_fq_r1_ch
path "${ctl_fastq_r2}" into trimmed_ctl_fq_r2_ch
path "${fastp_qc_json}" into ctl_fastq_qc_json
script:
ctl_fastq_r1 = "${params.SampleId}_ctl_r1_trimmed.fastq"
ctl_fastq_r2 = "${params.SampleId}_ctl_r2_trimmed.fastq"
fastp_qc_json = "${params.SampleId}_ctl_fastp_qc.json"
"""
cat ${preprocess_conf} | xargs \
fastp -i ${ctl_fq1} -I ${ctl_fq2} -w ${task.cpus} -j ${fastp_qc_json} -o ${ctl_fastq_r1} -O ${ctl_fastq_r2}
"""
}
process tumor_align_bwa_sort {
//container 'cmopipeline/bwa-samtools-gatk4-sambamba-samblaster:latest'
container '10.168.2.67:5000/align_sambam_vcf:1.0'
cpus params.threads
memory { 20.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
input:
path('trimmed_fastq_r1') from trimmed_tumor_fq_r1_ch
path('trimmed_fastq_r2') from trimmed_tumor_fq_r2_ch
output:
path("${sorted_bam}") into tumor_sorted_bam_ch
script:
sorted_bam = "${params.SampleId}_tumor_sorted.bam"
"""
cat ${align_conf} | xargs \
bwa mem -R '@RG\\tID:${params.SampleId}\\tSM:${params.SampleId}\\tLB:YUNYING\\tPL:Illumina' -t ${task.cpus} ${ref_fa} \
trimmed_fastq_r1 trimmed_fastq_r2 | sambamba view \
-l 0 -f bam -S -h /dev/stdin |sambamba sort -m 5G -t 8 -o ${sorted_bam} /dev/stdin
### alternatively, we would use samtools for sort bam file, but some restrictions occurs!
### argument "-Y" (or "-C") used by bwa does not support samtools sort directly, so we omit it (!!!)
### and some read with problemed coordinate sorted!
# cat ${align_conf} | xargs \
# bwa mem -R '@RG\\tID:${params.SampleId}\\tSM:${params.SampleId}\\tLB:YUNYING\\tPL:Illumina\\tPU:chip' \
# -M -t ${task.cpus} ${ref_fa} trimmed_fastq_r1 \
# trimmed_fastq_r2 | samtools sort -m 2G -t ${task.cpus} -O bam -o ${sorted_bam} /dev/stdin
# samtools index ${sorted_bam}
"""
}
process control_align_bwa_sort {
//container 'cmopipeline/bwa-samtools-gatk4-sambamba-samblaster:latest'
container '10.168.2.67:5000/align_sambam_vcf:1.0'
cpus params.threads
memory { 20.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path('trimmed_fastq_r1') from trimmed_ctl_fq_r1_ch
path('trimmed_fastq_r2') from trimmed_ctl_fq_r2_ch
output:
path("${sorted_bam}") into ctl_sorted_bam_ch
script:
sorted_bam = "${params.SampleId}_ctl_sorted.bam"
"""
cat ${align_conf} | xargs \
bwa mem -R '@RG\\tID:${params.SampleId}_X\\tSM:${params.SampleId}_X\\tLB:YUNYING\\tPL:Illumina' -t ${task.cpus} ${ref_fa} \
trimmed_fastq_r1 trimmed_fastq_r2 | sambamba view \
-l 0 -f bam -S -h /dev/stdin |sambamba sort -m 5G -t 8 -o ${sorted_bam} /dev/stdin
### alternatively, we would use samtools for sort bam file, but some restrictions occurs!
### argument "-Y" (or "-C") used by bwa does not support samtools sort directly, so we omit it (!!!)
### and some read with problemed coordinate sorted!
# cat ${align_conf} | xargs \
# bwa mem -R '@RG\\tID:${params.SampleId}\\tSM:${params.SampleId}\\tLB:YUNYING\\tPL:Illumina\\tPU:chip' \
# -M -t ${task.cpus} ${ref_fa} trimmed_fastq_r1 \
# trimmed_fastq_r2 | samtools sort -m 2G -t ${task.cpus} -O bam -o ${sorted_bam} /dev/stdin
# samtools index ${sorted_bam}
"""
}
process refinement_gatk_elprep_tumor_standard {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
cpus params.threads/2
memory { 20.GB * memory_scale1 * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
input:
path "sorted.bam" from tumor_sorted_bam_ch
path "target.bed" from bed_target
output:
path "${recal_bam}" into tumor_recal_bam_ch1, tumor_recal_bam_ch2, tumor_recal_bam_ch3, tumor_recal_bam_ch4, tumor_recal_bam_ch5, tumor_recal_bam_ch6, tumor_recal_bam_ch7, tumor_recal_bam_ch8, tumor_recal_bam_ch9, tumor_recal_bam_ch10
path "${recal_bai}" into tumor_recal_bai_ch1, tumor_recal_bai_ch2, tumor_recal_bai_ch3, tumor_recal_bai_ch4, tumor_recal_bai_ch5, tumor_recal_bai_ch6, tumor_recal_bai_ch7, tumor_recal_bai_ch8, tumor_recal_bai_ch9, tumor_recal_bai_ch10
script:
recal_bam = "${params.SampleId}_tumor_recal.bam"
recal_bai = "${params.SampleId}_tumor_recal.bai"
if (params.remove_dup == true && params.recal == 'elprep')
"""
elprep filter sorted.bam ${recal_bam} --mark-duplicates --mark-optical-duplicates output.metrics \
--sorting-order keep --bqsr output.recal --bqsr-reference ${ref_elfa} --known-sites ${gatk_db_dir}/dbsnp_138.b37.elsites,${gatk_db_dir}/1000G_phase1.indels.b37.elsites,${gatk_db_dir}/Mills_and_1000G_gold_standard.indels.b37.elsites --nr-of-threads ${task.cpus}
gatk BuildBamIndex -I ${recal_bam}
"""
else if (params.remove_dup == false && params.recal == 'elprep')
"""
elprep filter sorted.bam ${recal_bam} --sorting-order keep --bqsr output.recal \
--bqsr-reference ${ref_elfa} --known-sites ${gatk_db_dir}/dbsnp_138.b37.elsites,${gatk_db_dir}/1000G_phase1.indels.b37.elsites,${gatk_db_dir}/Mills_and_1000G_gold_standard.indels.b37.elsites --nr-of-threads ${task.cpus}
gatk BuildBamIndex -I ${recal_bam}
"""
else if (params.remove_dup == false && params.recal == 'gatk')
"""
cat ${recal_conf} | xargs \
gatk BaseRecalibrator -I sorted.bam -R ${ref_fa} --known-sites ${gatk_db_dir}/dbsnp_138.b37.vcf \
--known-sites ${gatk_db_dir}/1000G_phase1.indels.b37.vcf --known-sites ${gatk_db_dir}/Mills_and_1000G_gold_standard.indels.b37.vcf \
-L target.bed -O recal_table
gatk ApplyBQSR -R ${ref_fa} -I sorted.bam --bqsr-recal-file recal_table --create-output-bam-index true -O ${recal_bam}
"""
else
error "We does support other options for refinement process !!! >-<"
}
process refinement_gatk_elprep_control_standard {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
cpus params.threads/2
memory { 10.GB * memory_scale2 * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 != ""
input:
path 'sorted.bam' from ctl_sorted_bam_ch
path 'target.bed' from bed_target
output:
path "${recal_bam}" into ctl_recal_bam_ch1, ctl_recal_bam_ch2, ctl_recal_bam_ch4
path "${recal_bai}" into ctl_recal_bai_ch1, ctl_recal_bai_ch2, ctl_recal_bai_ch4
script:
recal_bam = "${params.SampleId}_ctl_recal.bam"
recal_bai = "${params.SampleId}_ctl_recal.bai"
if (params.remove_dup == true && params.recal == 'elprep')
"""
elprep filter sorted.bam ${recal_bam} --mark-duplicates --mark-optical-duplicates output.metrics \
--sorting-order keep --bqsr output.recal --bqsr-reference ${ref_elfa} --known-sites ${gatk_db_dir}/dbsnp_138.b37.elsites,${gatk_db_dir}/1000G_phase1.indels.b37.elsites,${gatk_db_dir}/Mills_and_1000G_gold_standard.indels.b37.elsites --nr-of-threads ${task.cpus}
gatk BuildBamIndex -I ${recal_bam}
"""
else if (params.remove_dup == false && params.recal == 'elprep')
"""
elprep filter sorted.bam ${recal_bam} --sorting-order keep --bqsr output.recal \
--bqsr-reference ${ref_elfa} --known-sites ${gatk_db_dir}/dbsnp_138.b37.elsites,${gatk_db_dir}/1000G_phase1.indels.b37.elsites,${gatk_db_dir}/Mills_and_1000G_gold_standard.indels.b37.elsites --nr-of-threads ${task.cpus}
gatk BuildBamIndex -I ${recal_bam}
"""
else if (params.remove_dup == false && params.recal == 'gatk')
"""
cat ${recal_conf} | xargs \
gatk BaseRecalibrator -I sorted.bam -R ${ref_fa} --known-sites ${gatk_db_dir}/dbsnp_138.b37.vcf \
--known-sites ${gatk_db_dir}/1000G_phase1.indels.b37.vcf --known-sites ${gatk_db_dir}/Mills_and_1000G_gold_standard.indels.b37.vcf \
-L target.bed -O recal_table
gatk ApplyBQSR -R ${ref_fa} -I sorted.bam --bqsr-recal-file recal_table --create-output-bam-index true -O ${recal_bam}
"""
else
error "We does support other options for refinement process !!! >-<"
}
process sv_svaba_paired {
container '10.168.2.67:5000/svaba-yy:1.1.2'
publishDir "${raw_unfilter_dir}", mode: 'copy'
cpus { params.threads/2 }
memory { 16.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 != "" && sv_process_mark == true
input:
path 'tumor_recal.bam' from tumor_recal_bam_ch2
path 'tumor_recal.bai' from tumor_recal_bai_ch2
path 'ctl_recal.bam' from ctl_recal_bam_ch2
path 'ctl_recal.bai' from ctl_recal_bai_ch2
path 'target.bed' from sv_bed_ch
output:
path '*.unfiltered.somatic.sv.vcf' into sv_svaba_somatic_ch
path '*.unfiltered.germline.sv.vcf' into sv_svaba_germline_ch
path '*.svaba.somatic.indel.vcf' into indel_svaba_somatic_ch
path '*.svaba.germline.indel.vcf' into indel_svaba_germline_ch
script:
prefix_svaba_vcf = "${params.SampleId}"
"""
cat ${sv_svaba_conf} | xargs \
svaba run -t tumor_recal.bam -n ctl_recal.bam -p ${task.cpus} -G ${ref_fa} -a `pwd`/${prefix_svaba_vcf} -k target.bed
"""
}
process sv_svaba_tumor_only {
container '10.168.2.67:5000/svaba-yy:1.1.2'
publishDir "${raw_unfilter_dir}", mode: 'copy'
cpus { params.threads/2 }
memory { 16.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 == "" && sv_process_mark == true
input:
path 'tumor_recal.bam' from tumor_recal_bam_ch2
path 'tumor_recal.bai' from tumor_recal_bai_ch2
path 'target.bed' from sv_bed_ch
output:
path '*.svaba.unfiltered.sv.vcf' into sv_svaba_tumor_ch
path '*.svaba.unfiltered.indel.vcf' into indel_svaba_tumor_ch
path '*.svaba.indel.vcf' into indel_svaba_ch
script:
prefix_svaba_vcf = "${params.SampleId}"
"""
cat ${sv_svaba_conf} | xargs \
svaba run -t tumor_recal.bam -p ${task.cpus} -G ${ref_fa} -a `pwd`/${prefix_svaba_vcf} -k target.bed
"""
}
process cnv_oncocnv_tumor_controls {
container '10.168.2.67:5000/oncocnv-yy:6.9m'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*.{summary.txt,profile.txt,profile.png}'
publishDir "${raw_unfilter_dir}", mode: 'copy', pattern: '*.stats.txt'
cpus 2
memory { 8.GB }
errorStrategy { task.exitStatus in 2..140 ? 'retry' : 'ignore' }
maxRetries 5
input:
path "${params.SampleId}_tumor_recal.bam" from tumor_recal_bam_ch3
path "${params.SampleId}_tumor_recal.bai" from tumor_recal_bai_ch3
path 'target.bed' from bed_target
when:
params.baseline =~ /^ZB.*/
output:
path '*' into cnv_oncocnv_ch
script:
prefix_cnv = "${params.SampleId}"
"""
IFS=','; read -ra clades <<< "${params.baseline}"
for clade in "\${clades[@]}"
do
#get normalized read counts for the tumor samples
perl /opt/ONCOCNV_getCounts.pl getSampleStats -m Ampli -c ${oncocnv_db_dir}/\${clade}.Control.stats.txt -s ${params.SampleId}_tumor_recal.bam -o `pwd`/${prefix_cnv}.\${clade}.Test.stats.txt
#process test samples and predict CNA and CNVs:
cat /opt/processSamples.v6.4.R | R --slave --args `pwd`/${prefix_cnv}.\${clade}.Test.stats.txt ${oncocnv_db_dir}/\${clade}.Control.stats.Processed.txt `pwd`/${prefix_cnv}.\${clade}.Test.output.txt cghseg
done
"""
}
process cnv_oncocnv_tumor_covers {
container '10.168.2.67:5000/oncocnv-yy:6.9m'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*.{summary.txt,profile.txt,profile.png}'
cpus 2
memory { 8.GB }
errorStrategy { task.exitStatus in 2..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.SampleId =~ /Q_g_639/
input:
path "${params.SampleId}_tumor_recal.bam" from tumor_recal_bam_ch9
path "${params.SampleId}_tumor_recal.bai" from tumor_recal_bai_ch9
val cover from Channel.from("cnv_cover_5", "cnv_cover_10", "cnv_cover_20")
output:
path '*summary.txt' into oncocnv_cover_summary
path '*profile.*' into oncocnv_cover_profile
script:
prefix_cnv = "${params.SampleId}"
"""
perl /opt/ONCOCNV_getCounts.pl getSampleStats -m Ampli -c ${oncocnv_db_dir}/panel_639_cover/${cover}.Control.stats.txt -s ${params.SampleId}_tumor_recal.bam -i ${cover}. -o `pwd`/${prefix_cnv}.${cover}.Test.stats.txt
cat /opt/processSamples.v6.4.R | R --slave --args `pwd`/${prefix_cnv}.${cover}.Test.stats.txt ${oncocnv_db_dir}/panel_639_cover/${cover}.Control.stats.Processed.txt `pwd`/${prefix_cnv}.${cover}.Test.output.txt cghseg
"""
}
process refinement_enzyme_correct_control {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${unified_bam_dir}", mode: 'copy', pattern: '*.{bam,bai}'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 != ""
input:
path 'ctl_recal.bam' from ctl_recal_bam_ch1
path 'ctl_recal.bai' from ctl_recal_bai_ch1
path 'target.bed' from bed_target
path 'chemo_radio_rs.bed' from chemo_radio_rs_bed
output:
path "${ctl_correct_bam}" into control_refined_bam_ch1, control_refined_bam_ch2
path "${ctl_correct_bai}" into control_refined_bai_ch1, control_refined_bai_ch2
path "merged.interval_list" into merged_region_ch
script:
ctl_correct_bam = "${params.SampleId}_ctl_recal.bam"
ctl_correct_bai = "${params.SampleId}_ctl_recal.bai"
if (params.SampleId =~ "PCR_")
"""
cp -d ctl_recal.bam ${ctl_correct_bam}
cp -d ctl_recal.bai ${ctl_correct_bai}
"""
else
"""
java -jar /gatk/gatk-package-4.1.7.0-local.jar BedToIntervalList -I target.bed -O germline.interval_list -SD ${ref_fa_dict}
java -jar /gatk/gatk-package-4.1.7.0-local.jar BedToIntervalList -I chemo_radio_rs.bed -O chemo_radio_therapy.interval_list -SD ${ref_fa_dict}
java -jar /gatk/gatk-package-4.1.7.0-local.jar IntervalListTools --ACTION UNION -I germline.interval_list -I chemo_radio_therapy.interval_list -O merged.interval_list
recsc -r ${ref_fa} -g merged.interval_list -i ctl_recal.bam -o ${ctl_correct_bam}
"""
}
process germline_gatk4_for_control {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 != ""
input:
path 'ctl_recal.bam' from control_refined_bam_ch2
path 'ctl_recal.bai' from control_refined_bai_ch2
path 'merged.interval_list' from merged_region_ch
output:
path "${germline_vcf}" into control_germline_ch
script:
germline_vcf = "${params.SampleId}_germline_for_control.vcf"
"""
gatk HaplotypeCaller -I ctl_recal.bam -R ${ref_fa} \
-D ${gatk_db_dir}/dbsnp_138.b37.vcf --alleles ${chemo_radio_rs_vcf} \
-L merged.interval_list -stand-call-conf 10 \
--interval-padding 20 -A AlleleFraction -O ${germline_vcf}
"""
}
process statistic_sinotools_paired {
container '10.168.2.67:5000/sinotools-yy:1.0'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*_qc.txt'
publishDir "${raw_unfilter_dir}", mode: 'copy', pattern: '*.cov'
cpus 2
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path "${params.SampleId}_tumor_recal.bam" from tumor_recal_bam_ch4
path "${params.SampleId}_tumor_recal.bai" from tumor_recal_bai_ch4
path "${params.SampleId}_ctl_recal.bam" from ctl_recal_bam_ch4
path "${params.SampleId}_ctl_recal.bai" from ctl_recal_bai_ch4
path 'target.bed' from st_bed_ch
output:
path "*_qc.txt" into statistic_paired_ch
path "*.cov" into coverage_paired_ch
script:
tumor_statistics = "${params.SampleId}_tumor_qc.txt"
ctl_statistics = "${params.SampleId}_ctl_qc.txt"
"""
sinotools bam_qc -i ${params.SampleId}_tumor_recal.bam -bed target.bed -hotspot ${core_hotspots_bed} -o ${tumor_statistics}
sinotools bam_qc -i ${params.SampleId}_ctl_recal.bam -bed target.bed -hotspot ${core_hotspots_bed} -o ${ctl_statistics}
"""
}
process statistic_sinotools_tumor_only {
container '10.168.2.67:5000/sinotools-yy:1.0'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*_qc.txt'
publishDir "${raw_unfilter_dir}", mode: 'copy', pattern: '*.cov'
cpus 2
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 == ""
input:
path "${params.SampleId}_tumor_recal.bam" from tumor_recal_bam_ch4
path "${params.SampleId}_tumor_recal.bai" from tumor_recal_bai_ch4
path "target.bed" from st_bed_ch
output:
path "*_qc.txt" into statistic_tumor_ch
path "*.cov" into coverage_tumor_ch
script:
tumor_statistics = "${params.SampleId}_tumor_qc.txt"
"""
sinotools bam_qc -i ${params.SampleId}_tumor_recal.bam -bed target.bed -hotspot ${core_hotspots_bed} -o ${tumor_statistics}
"""
}
process somatic_gatk_interval_split {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
cpus 1
memory { 2.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
input:
path 'target.bed' from bed_target
output:
path 'split_interval/*' into split_bed_ch
script:
"""
gatk SplitIntervals -R $ref_fa -L target.bed -scatter ${split_region_count} -O split_interval
"""
}
process refinement_enzyme_correct_tumor {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${unified_bam_dir}", mode: 'copy'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'terminate' }
maxRetries 5
input:
path "tumor_recal.bam" from tumor_recal_bam_ch1
path "tumor_recal.bai" from tumor_recal_bai_ch1
path "target.bed" from bed_target
output:
path "${tumor_correct_bam}" into tumor_correct_bam_ch1, tumor_correct_bam_ch2
path "${tumor_correct_bai}" into tumor_correct_bai_ch1, tumor_correct_bai_ch2
script:
tumor_correct_bam = "${params.SampleId}_tumor_recal.bam"
tumor_correct_bai = "${params.SampleId}_tumor_recal.bai"
if (params.SampleId =~ "PCR_")
"""
cp -d tumor_recal.bam ${tumor_correct_bam}
cp -d tumor_recal.bai ${tumor_correct_bai}
"""
else
"""
recsc -r ${ref_fa} -g target.bed -i tumor_recal.bam -o ${tumor_correct_bam}
"""
}
process germline_gatk4_for_tumor {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 == ""
input:
path "tumor_refined.bam" from tumor_correct_bam_ch2
path "tumor_refined.bai" from tumor_correct_bai_ch2
path "target.bed" from bed_target
path "chemo_radio_rs.bed" from chemo_radio_rs_bed
output:
path "${tumor_germline_vcf}" into tumor_germline_ch
script:
tumor_germline_vcf = "${params.SampleId}_germline_for_tumor.vcf"
"""
java -jar /gatk/gatk-package-4.2.2.0-local.jar BedToIntervalList -I target.bed -O germline.interval_list -SD ${ref_fa_dict}
java -jar /gatk/gatk-package-4.2.2.0-local.jar BedToIntervalList -I chemo_radio_rs.bed -O chemo_radio_therapy.interval_list -SD ${ref_fa_dict}
java -jar /gatk/gatk-package-4.2.2.0-local.jar IntervalListTools --ACTION UNION -I germline.interval_list -I chemo_radio_therapy.interval_list -O merged.interval_list
gatk HaplotypeCaller -I tumor_refined.bam -R ${ref_fa} \
-D ${gatk_db_dir}/dbsnp_138.b37.vcf --alleles ${chemo_radio_rs_vcf} \
-L merged.interval_list -stand-call-conf 10 \
--interval-padding 20 -A AlleleFraction -O ${tumor_germline_vcf}
"""
}
process somatic_gatk_mutect2_parallel_paired {
container '10.168.2.67:5000/gatk-yy:4.2.2.1'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 123..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path 'tumor_refined.bam' from tumor_correct_bam_ch1
path 'tumor_refined.bai' from tumor_correct_bai_ch1
path 'ctl_recal.bam' from control_refined_bam_ch1
path 'ctl_recal.bai' from control_refined_bai_ch1
path 'splited.interval_list' from split_bed_ch.flatten()
output:
path "${raw_vcf}" into raw_vcf_paired_ch
path "${vcf_stats}" into vcf_stat_paired_ch
path "${f1r2_stat}" into f1r2_stat_paired_ch
path "${pileup_stat}" into pileup_stat_paired_ch
script:
raw_vcf = "${params.SampleId}_mutect2_raw.vcf"
vcf_stats = "${params.SampleId}_mutect2.vcf.stats"
f1r2_stat = "${params.SampleId}_f1r2.tar.gz"
pileup_stat = "${params.SampleId}_getpileupsummaries.table"
"""
cat ${mutect2_conf} | xargs \
gatk Mutect2 -I tumor_refined.bam -I ctl_recal.bam -normal "${params.SampleId}_X" -R ${ref_fa} -alleles ${core_hotspots_conf} \
-germline-resource ${gatk_db_dir}/b37_af-only-gnomad.raw.sites.vcf -pon ${gatk_db_dir}/b37_yunying_pon.vcf \
--f1r2-tar-gz ${f1r2_stat} -L splited.interval_list --native-pair-hmm-threads ${task.cpus} -O "${params.SampleId}_mutect2.vcf"
cat ${secondary_annotate_conf} | xargs \
gatk VariantAnnotator -I tumor_refined.bam -R ${ref_fa} -V "${params.SampleId}_mutect2.vcf" -O ${raw_vcf}
gatk GetPileupSummaries -I tumor_refined.bam -V ${gatk_db_dir}/b37_small_exac_common_3.vcf \
--interval-set-rule UNION -L splited.interval_list -O ${pileup_stat}
"""
}
process somatic_gatk_mutect2_tumor_only {
container '10.168.2.67:5000/gatk-yy:4.2.2.1'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 123..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 == ""
input:
path 'tumor_refined.bam' from tumor_correct_bam_ch1
path 'tumor_refined.bai' from tumor_correct_bai_ch1
path 'splited.interval_list' from split_bed_ch.flatten()
output:
path "${raw_vcf}" into raw_vcf_tumor_ch
path "${vcf_stats}" into vcf_stat_tumor_ch
path "${f1r2_stat}" into f1r2_stat_tumor_ch
path "${pileup_stat}" into pileup_stat_tumor_ch
script:
raw_vcf = "${params.SampleId}_mutect2_raw.vcf"
vcf_stats = "${params.SampleId}_mutect2.vcf.stats"
f1r2_stat = "${params.SampleId}_f1r2.tar.gz"
pileup_stat = "${params.SampleId}_getpileupsummaries.table"
"""
cat ${mutect2_conf} | xargs \
gatk Mutect2 -I tumor_refined.bam -R ${ref_fa} -alleles ${core_hotspots_conf} \
-germline-resource ${gatk_db_dir}/b37_af-only-gnomad.raw.sites.vcf -pon ${gatk_db_dir}/b37_yunying_pon.vcf \
--f1r2-tar-gz ${f1r2_stat} -L splited.interval_list --native-pair-hmm-threads ${task.cpus} -O "${params.SampleId}_mutect2.vcf"
cat ${secondary_annotate_conf} | xargs \
gatk VariantAnnotator -I tumor_refined.bam -R ${ref_fa} -V "${params.SampleId}_mutect2.vcf" -O ${raw_vcf}
gatk GetPileupSummaries -I tumor_refined.bam -V ${gatk_db_dir}/b37_small_exac_common_3.vcf \
--interval-set-rule UNION -L splited.interval_list -O ${pileup_stat}
"""
}
process somatic_gatk_filter_mark_paired {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${raw_unfilter_dir}", mode: 'copy'
// *** this mount volume is used for local executation for docker, not necessary for kubernetes!!!
containerOptions '-v /home/yunying/:/home/yunying/'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
val vcf_items from raw_vcf_paired_ch.reduce{ previous, item -> previous + " -I " + item }
val stats_items from vcf_stat_paired_ch.reduce{ previous, item -> previous + " -stats " + item }
val f1r2_items from f1r2_stat_paired_ch.reduce{ previous, item -> previous + " -I " + item }
val pileup_items from pileup_stat_paired_ch.reduce{ previous, item -> previous + " -I " + item }
output:
path "${filter_marked_vcf}" into filter_marked_paired_ch
script:
filter_marked_vcf = "${params.SampleId}_mutect2_filter_marked.vcf"
"""
gatk MergeVcfs -I ${vcf_items} -O mutect2_merged.vcf
gatk MergeMutectStats -stats ${stats_items} -O mutect2_merged.vcf.stats
gatk LearnReadOrientationModel -I ${f1r2_items} -O read-orientation-model.tar.gz
gatk GatherPileupSummaries -I ${pileup_items} --sequence-dictionary ${ref_fa_dict} -O getpileupsummaries.table
gatk CalculateContamination -I getpileupsummaries.table \
-tumor-segmentation segments.table \
-O contamination.table
cat ${somatic_filter_conf} | xargs \
gatk FilterMutectCalls -R ${ref_fa} -V mutect2_merged.vcf --tumor-segmentation segments.table \
--contamination-table contamination.table --ob-priors read-orientation-model.tar.gz \
-O ${filter_marked_vcf}
"""
}
process somatic_gatk_filter_mark_tumor_only {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${raw_unfilter_dir}", mode: 'copy'
// *** this mount volume is used for local executation for docker, not necessary for kubernetes!!!
containerOptions '-v /home/yunying/:/home/yunying/'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 == ""
input:
val vcf_items from raw_vcf_tumor_ch.reduce{ previous, item -> previous + " -I " + item }
val stats_items from vcf_stat_tumor_ch.reduce{ previous, item -> previous + " -stats " + item }
val f1r2_items from f1r2_stat_tumor_ch.reduce{ previous, item -> previous + " -I " + item }
val pileup_items from pileup_stat_tumor_ch.reduce{ previous, item -> previous + " -I " + item }
output:
path "${filter_marked_vcf}" into filter_marked_tumor_ch
script:
filter_marked_vcf = "${params.SampleId}_mutect2_filter_marked.vcf"
"""
gatk MergeVcfs -I ${vcf_items} -O mutect2_merged.vcf
gatk MergeMutectStats -stats ${stats_items} -O mutect2_merged.vcf.stats
gatk LearnReadOrientationModel -I ${f1r2_items} -O read-orientation-model.tar.gz
gatk GatherPileupSummaries -I ${pileup_items} --sequence-dictionary ${ref_fa_dict} -O getpileupsummaries.table
gatk CalculateContamination -I getpileupsummaries.table \
-tumor-segmentation segments.table \
-O contamination.table
cat ${somatic_filter_conf} | xargs \
gatk FilterMutectCalls -R ${ref_fa} -V mutect2_merged.vcf --tumor-segmentation segments.table \
--contamination-table contamination.table --ob-priors read-orientation-model.tar.gz \
-O ${filter_marked_vcf}
"""
}
process anno_snpeff_hgvs_paired {
container '10.168.2.67:5000/snpeff-yy:4.4m'
cpus 4
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path 'all_marked.vcf' from filter_marked_paired_ch
path 'anno_snpeff.conf' from anno_snpeff_conf
output:
path '*.anno' into haplotype_anno_paired_ch
path "${prefix_anno_vcf}_hgvs.vcf" into hgvs_anno_paired_ch
script:
prefix_anno_vcf = "${params.SampleId}_filter_marked"
"""
python3 /opt/vcf_multiple_split.py all_marked.vcf all_marked_splitted.vcf
cat anno_snpeff.conf | xargs \
java -Xmx4g -jar /opt/SnpEff-4.4-jar-with-dependencies.jar -c /opt/snpEff.config \
-haplotype-ouput ${prefix_anno_vcf}.haplotype.anno GRCh37.p13.RefSeq all_marked_splitted.vcf > ${prefix_anno_vcf}_hgvs.vcf
"""
}
process anno_snpsift_database_paired {
container '10.168.2.67:5000/snpsift-yy:1.0'
publishDir "${raw_unfilter_dir}", mode: 'copy'
cpus 2
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path 'hgvs.vcf' from hgvs_anno_paired_ch
output:
path "${paired_anno_vcf}" into paired_anno_hgvs_db_ch
script:
paired_anno_vcf = "${params.SampleId}_filter_marked_hgvs_db.vcf"
"""
java -Xmx4g -jar /opt/SnpSift.jar annotate -info CLNSIG,CLNSIGCONF,CLNDN ${clinvar_vcf_conf} hgvs.vcf > ${paired_anno_vcf}
"""
}
process anno_snpeff_hgvs_tumor_only {
container '10.168.2.67:5000/snpeff-yy:4.4m'
cpus 4
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 == ""
input:
path 'all_marked.vcf' from filter_marked_tumor_ch
path 'anno_snpeff.conf' from anno_snpeff_conf
output:
path '*.anno' into haplotype_anno_tumor_ch
path "${prefix_anno_vcf}_hgvs.vcf" into hgvs_anno_tumor_ch
script:
prefix_anno_vcf = "${params.SampleId}_filter_marked"
"""
python3 /opt/vcf_multiple_split.py all_marked.vcf all_marked_splitted.vcf
cat anno_snpeff.conf | xargs \
java -Xmx4g -jar /opt/SnpEff-4.4-jar-with-dependencies.jar -c /opt/snpEff.config \
-haplotype-ouput ${prefix_anno_vcf}.haplotype.anno GRCh37.p13.RefSeq all_marked_splitted.vcf > ${prefix_anno_vcf}_hgvs.vcf
"""
}
process anno_snpsift_database_tumor_only {
container '10.168.2.67:5000/snpsift-yy:1.0'
publishDir "${raw_unfilter_dir}", mode: 'copy'
cpus 2
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 == ""
input:
path 'hgvs.vcf' from hgvs_anno_tumor_ch