-
Notifications
You must be signed in to change notification settings - Fork 0
/
somatic_vardict_pindel.nf
2486 lines (1903 loc) · 86.8 KB
/
somatic_vardict_pindel.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 somatic_vardict_pindel.nf -c nextflow_basic.conf -profile docker --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: fastq1 basename)"
log.info " --PanelName STRING Panel name, used for exported gene filter (required)"
log.info " --fq1 FILE tumor fastq(.gz) file for read1 (required)"
log.info " --fq2 FILE tumor fastq(.gz) file for read2 (required)"
log.info " --ctl_fq1 FILE control fastq(.gz) file for read1 (required for paired sample)"
log.info " --ctl_fq2 FILE control fastq(.gz) file for read2 (required for paired sample)"
log.info " --bed FILE target_bed_file (required)"
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/)"
log.info " --RG STRING Read group tag (dafault: fastq1 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.threads = 16
params.remove_dup = true
params.pindel_mark = 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"
pcr_panel_mark = params.SampleId =~ /PCR_/ ? true : false
somatic_process_mark = (params.bed =~ /H.bed$/ || params.bed =~ /MSI.bed$/ || params.bed =~ /M.bed$/) ? false : true
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
pindel_process_mark = somatic_process_mark ? true : false
germline_process_mark = (params.bed =~ /M.bed$/ || params.bed =~ /MSI.bed$/) ? false : true
dedup_process_mark = (params.SampleId =~ /ct_447$/ || params.SampleId =~ /ct_580$/ || params.SampleId =~ /ct_113$/) ? true : false
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)
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"
ref_fa = params.SampleId =~ /_M$/ ? "${genome_dir}mgmt/mgmt.fa" : ref_fa
def ref_elfa = "${genome_dir}b37_Homo_sapiens_assembly19.elfasta"
ref_elfa = params.SampleId =~ /_M$/ ? "${genome_dir}mgmt/mgmt.elfa" : ref_elfa
def gatk_db_dir = "${genome_dir}gatk"
def oncocnv_db_dir = "${genome_dir}oncocnv"
def snpeff_db_dir = "${genome_dir}snpeff"
def realignment_bed = "${gatk_db_dir}/core_realignment.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 rs_1p19q_bed = file("${genome_dir}mgmt/1p19q.rs.bed")
def cosmic_database = "${genome_dir}snpsift/CosmicCodingMuts.vcf.gz"
def clinvar_database = "${genome_dir}snpsift/clinvar_20210828.vcf.gz"
def gnomad_database = "${genome_dir}snpsift/b37_af-only-gnomad.raw.sites.vcf"
def dbsnp_database = "${genome_dir}snpsift/dbsnp_138.b37.vcf"
def core_hotspots_bed = "${genome_dir}variation_hotspots/core_hotspots_v1.0.bed"
def core_hotspots_vcf = "${genome_dir}variation_hotspots/core_hotspots_v1.0.vcf"
def snp_hotspots_vcf = "${genome_dir}variation_hotspots/snp_hotspots_v1.0.vcf"
def vardict_hotspots_list = file("${genome_dir}variation_hotspots/core_hotspots_v1.0.list")
def msi_database_dir = "${genome_dir}/msi/${params.msi_db}"
def hg19_ref_fa = "/yunying/ref/human/hg19/hg19.fa"
def rna_fusion_conf = "${genome_dir}/genefuse/cancer.hg19.csv"
def rna_fusion_fa = "${genome_dir}rna_fusion/6gene_RNA_fusion.fa"
def rna_fusion_bed = "/yunying/data/product/bed/yunying_bed/6gene_bed9.bed"
// 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 genefuse_standard_conf = "${prefix_conf_dir}/software/sv/genefuse/conf/genefuse_standard.conf"
def pcr_preprocess_conf = file("${prefix_conf_dir}/software/preprocess/fastp/conf/fastp_pcr_amplicon.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 pcr_align_conf = file("${prefix_conf_dir}/toolkit/align_sambam_vcf/conf/align_pcr_amplicon.conf")
def gatk_toolkit_dir = "${prefix_conf_dir}/toolkit/gatk/"
def recal_conf = file("${gatk_toolkit_dir}refinement/conf/refinement_standard.conf")
def samtools_mpileup_conf = file("${prefix_conf_dir}/toolkit/varscan/conf/samtools_mpileup.conf")
def pcr_mpileup_conf = file("${prefix_conf_dir}/toolkit/varscan/conf/samtools_pcr_mpileup.conf")
def germline_calling_conf = file("${gatk_toolkit_dir}germline/conf/haplotype_caller.conf")
def somatic_varscan_conf = file("${prefix_conf_dir}/toolkit/varscan/conf/somatic_high_depth_ctdna.conf")
def somatic_varscan_paired_conf = file("${prefix_conf_dir}/toolkit/varscan/conf/somatic_paired_ctdna.conf")
def pcr_varscan_conf = file("${prefix_conf_dir}/toolkit/varscan/conf/somatic_pcr_ctdna.conf")
def indels_pindel_conf = file("${prefix_conf_dir}/software/indels/pindel/conf/pindel_tumor_standard.conf")
def indel_hotspots_bed = file("${prefix_conf_dir}/software/indels/pindel/conf/indel_hotspots.bed")
def sv_svaba_conf = file("${prefix_conf_dir}/software/sv/svaba/conf/somatic_sv_high_recall.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 variation_hotspots_conf = file("${genome_dir}variation_hotspots/yunying_hotspots_GRCh37_v1.0.txt")
def cnv_oncocnv_conf = file("${prefix_conf_dir}/software/cnv/oncocnv/conf/somatic_cnv_tumor.conf")
def anno_snpeff_conf = file("${prefix_conf_dir}/software/annotation/SnpEff/conf/snpeff_canon_only.conf")
def perbase_conf = file("${prefix_conf_dir}/software/calling/perbase/conf/perbase_standard.conf")
def somatic_vardict_conf = "${prefix_conf_dir}/software/calling/VarDict/conf/ctdna_standard.conf"
def secondary_annotate_conf = file("${gatk_toolkit_dir}annotation/conf/secondary_bam_annotate.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 1
input:
file tumor_fq1
file tumor_fq2
output:
path "${tumor_fastq_r1}" into trimmed_tumor_fq_r1_ch, trimmed_tumor_fq_r1_ch2, trimmed_tumor_fq_r1_ch3
path "${tumor_fastq_r2}" into trimmed_tumor_fq_r2_ch, trimmed_tumor_fq_r2_ch2, trimmed_tumor_fq_r2_ch3
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"
if (params.SampleId =~ "PCR_g_MSI" || params.SampleId =~ "PCR_ct_MSI")
"""
cp ${tumor_fq1} ${tumor_fastq_r1}
cp ${tumor_fq2} ${tumor_fastq_r2}
touch ${fastp_qc_json}
"""
else if (params.SampleId =~ "PCR_")
"""
cat ${pcr_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}
"""
else
"""
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 fusion_rna_call {
container '10.168.2.67:5000/fusion_rna_py:v1.0'
publishDir "${unified_bam_dir}", mode: 'copy', pattern: '*sorted.bam'
publishDir "${unified_bam_dir}", mode: 'copy', pattern: '*sorted.bam.bai'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*_fusion.txt'
cpus params.threads
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'ignore' }
maxRetries 1
when:
params.SampleId =~ /PCR_g_12$/ || params.SampleId =~ /PCR_ct_12$/
input:
file "fastq_r1.fq" from trimmed_tumor_fq_r1_ch3
file "fastq_r2.fq" from trimmed_tumor_fq_r2_ch3
output:
path "${fusion_result_file}" into fusion_result_file_ch
script:
fusion_bam = "${params.SampleId}_fusion_sorted.bam"
fusion_result_file = "${params.SampleId}_rna_fusion.txt"
"""
set -o pipefail
cat ${pcr_align_conf} | xargs \
bwa mem -R '@RG\\tID:${params.SampleId}\\tSM:${params.SampleId}\\tLB:YUNYING\\tPL:Illumina' -t 4 ${rna_fusion_fa} \
fastq_r1.fq fastq_r2.fq | samtools fixmate -m - - | samtools sort -m 2G -@4 -T /tmp/${params.SampleId} -o ${fusion_bam} -
samtools index ${fusion_bam}
python3 /script/fusion_check.py ${rna_fusion_fa} ${fusion_bam} > ${fusion_result_file}
"""
}
process genefuse_rna_tumor_only {
container '10.168.2.67:5000/genefuse-yy:1.0'
publishDir "${filtered_review_dir}", mode: 'copy', pattern: '*_report.*'
cpus 2
memory { 16.GB * task.attempt }
errorStrategy { task.exitStatus in 137..140 ? 'retry' : 'terminate' }
maxRetries 2
when:
params.SampleId =~ /PCR_g_12$/ || params.SampleId =~ /PCR_ct_12$/
input:
path 'tumor_r1.fq.gz' from trimmed_tumor_fq_r1_ch2
path 'tumor_r2.fq.gz' from trimmed_tumor_fq_r2_ch2
path 'fusion.csv' from file("${rna_fusion_conf}")
output:
path '*' into genefuse_rna_ch
script:
report_html = "${params.SampleId}_rna_fusion_report.html"
report_plain_txt = "${params.SampleId}_rna_fusion_report.txt"
"""
cat ${genefuse_standard_conf} | xargs \
genefuse -r ${hg19_ref_fa} -t 1 -f fusion.csv -1 tumor_r1.fq.gz -2 tumor_r2.fq.gz -h ${report_html} > ${report_plain_txt}
"""
}
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 1
when:
params.ctl_fq1 != ""
input:
file ctl_fq1
file ctl_fq2
output:
path "${ctl_fastq_r1}" into trimmed_ctl_fq_r1_ch, trimmed_ctl_fq_r1_ch2
path "${ctl_fastq_r2}" into trimmed_ctl_fq_r2_ch, trimmed_ctl_fq_r2_ch2
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 2
input:
path 'trimmed_fastq_r1' from trimmed_tumor_fq_r1_ch
path 'trimmed_fastq_r2' from trimmed_tumor_fq_r2_ch
output:
path "${tumor_sorted_bam}" into tumor_sorted_bam_ch
path "${tumor_sorted_bai}" into tumor_sorted_bai_ch
script:
tumor_sorted_bam = "${params.SampleId}_tumor_sorted.bam"
tumor_sorted_bai = "${params.SampleId}_tumor_sorted.bam.bai"
if (params.SampleId =~ "PCR_")
"""
cat ${pcr_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 10 -o ${tumor_sorted_bam} /dev/stdin
"""
else
"""
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 10 -o ${tumor_sorted_bam} /dev/stdin
"""
}
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 2
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 "${ctl_sorted_bam}" into ctl_sorted_bam_ch
path "${ctl_sorted_bai}" into ctl_sorted_bai_ch
script:
ctl_sorted_bam = "${params.SampleId}_ctl_sorted.bam"
ctl_sorted_bai = "${params.SampleId}_ctl_sorted.bam.bai"
"""
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 10 -o ${ctl_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 ${ctl_sorted_bam} /dev/stdin
# samtools index ${ctl_sorted_bam}
"""
}
process refinement_process_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 'tumor_sorted.bam' from tumor_sorted_bam_ch
path 'tumor_sorted.bai' from tumor_sorted_bai_ch
path 'target.bed' from bed_target
output:
path "${tumor_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 "${tumor_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:
tumor_recal_bam = "${params.SampleId}_tumor_recal.bam"
tumor_recal_bai = "${params.SampleId}_tumor_recal.bai"
"""
elprep filter tumor_sorted.bam ${tumor_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 ${tumor_recal_bam}
"""
}
process dedup_refinement_process_tumor {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${unified_bam_dir}", mode: 'copy'
cpus params.threads
memory { 20.GB * memory_scale1 * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
pcr_panel_mark == false
input:
path 'tumor_recal.bam' from tumor_recal_bam_ch8
path 'tumor_recal.bai' from tumor_recal_bai_ch8
path 'target.bed' from bed_target
output:
path "${tumor_dedup_bam}" into tumor_dedup_bam_ch1, tumor_dedup_bam_ch2
path "${tumor_dedup_bai}" into tumor_dedup_bai_ch1, tumor_dedup_bai_ch2
script:
tumor_dedup_bam = "${params.SampleId}_tumor_dedup.bam"
tumor_dedup_bai = "${params.SampleId}_tumor_dedup.bai"
"""
gencore -i tumor_recal.bam -o tumor_deduped.bam -r ${ref_fa} -b target.bed
gatk SortSam -SO coordinate -I tumor_deduped.bam -O ${tumor_dedup_bam}
gatk BuildBamIndex -I ${tumor_dedup_bam}
"""
}
process refinement_process_control_standard {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${unified_bam_dir}", mode: 'copy'
cpus params.threads/2
memory { 15.GB * memory_scale2 * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 != ""
input:
path 'ctl_sorted.bam' from ctl_sorted_bam_ch
path 'ctl_sorted.bai' from ctl_sorted_bai_ch
path 'ctl_target.bed' from bed_target
output:
path "${ctl_recal_bam}" into ctl_recal_bam_ch1, ctl_recal_bam_ch2, ctl_recal_bam_ch3, ctl_recal_bam_ch4, ctl_recal_bam_ch5, ctl_recal_bam_ch6, ctl_recal_bam_ch7, ctl_recal_bam_ch10
path "${ctl_recal_bai}" into ctl_recal_bai_ch1, ctl_recal_bai_ch2, ctl_recal_bai_ch3, ctl_recal_bai_ch4, ctl_recal_bai_ch5, ctl_recal_bai_ch6, ctl_recal_bai_ch7, ctl_recal_bai_ch10
script:
ctl_recal_bam = "${params.SampleId}_ctl_recal.bam"
ctl_recal_bai = "${params.SampleId}_ctl_recal.bai"
"""
java -Xmx16G -jar /opt/abra2.jar --in ctl_sorted.bam --out ctl_realigned.bam --ref ${ref_fa} --threads 6 --targets ${realignment_bed}
elprep filter ctl_realigned.bam ${ctl_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 ${ctl_recal_bam}
"""
}
process dedup_refinement_process_control {
container '10.168.2.67:5000/gatk-yy:4.2.0.0'
publishDir "${unified_bam_dir}", mode: 'copy'
cpus params.threads
memory { 15.GB * memory_scale2 * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 5
when:
params.ctl_fq1 != "" && pcr_panel_mark == false
input:
path 'ctl_recal.bam' from ctl_recal_bam_ch6
path 'ctl_recal.bai' from ctl_recal_bai_ch6
path 'target.bed' from bed_target
output:
path "${ctl_dedup_bam}" into ctl_dedup_bam_ch1
path "${ctl_dedup_bai}" into ctl_dedup_bai_ch1
script:
ctl_dedup_bam = "${params.SampleId}_ctl_dedup.bam"
ctl_dedup_bai = "${params.SampleId}_ctl_dedup.bai"
"""
gencore -i ctl_recal.bam -o ctl_deduped.bam -r ${ref_fa} -b target.bed
gatk SortSam -SO coordinate -I ctl_deduped.bam -O ${ctl_dedup_bam}
gatk BuildBamIndex -I ${ctl_dedup_bam}
"""
}
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 2
when:
somatic_process_mark == true
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_refined_bam_ch1, tumor_refined_bam_ch2, tumor_refined_bam_ch3
path "${tumor_correct_bai}" into tumor_refined_bai_ch1, tumor_refined_bai_ch2, tumor_refined_bai_ch3
// path "${tumor_correct_bam}" into tumor_correct_bam_ch
// path "${tumor_correct_bai}" into tumor_correct_bai_ch
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}
"""
}
// TODO: long time consuming realignment process
// process realignment_abra2_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 1..140 ? 'retry' : 'terminate' }
// maxRetries 2
//
// input:
// path 'tumor_correct.bam' from tumor_correct_bam_ch
// path 'tumor_correct.bai' from tumor_correct_bai_ch
//
// output:
// path "${tumor_realign_bam}" into tumor_refined_bam_ch1, tumor_refined_bam_ch2, tumor_refined_bam_ch3
// path "${tumor_realign_bai}" into tumor_refined_bai_ch1, tumor_refined_bai_ch2, tumor_refined_bai_ch3
//
// script:
// tumor_realign_bam = "${params.SampleId}_tumor_recal.bam"
// tumor_realign_bai = "${params.SampleId}_tumor_recal.bai"
// """
// java -Xmx16G -jar /opt/abra2.jar --in tumor_correct.bam --out ${tumor_realign_bam} --ref ${ref_fa} --threads 6 --targets ${realignment_bed}
// gatk BuildBamIndex -I ${tumor_realign_bam}
// """
// }
process vardict_variation_tumor_only {
container '10.168.2.67:5000/vardict-yy:1.8.2m'
cpus 6
memory { 16.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.ctl_fq1 == ""
input:
path "refined.bam" from tumor_refined_bam_ch2
path "target.bed" from bed_target
output:
path "${vardict_out_vcf}" into vardict_out_ch
script:
vardict_out_vcf = "${params.SampleId}_raw_vardict.vcf"
"""
cat ${somatic_vardict_conf} | xargs java -Xmx12g -XX:-UseParallelGC -jar /opt/VarDict-1.8.2.jar -b refined.bam -G ${ref_fa} -th ${task.cpus} -N ${params.SampleId} -hotspot ${vardict_hotspots_list} -c 1 -S 2 -E 3 target.bed > "${params.SampleId}_vardict.var"
cat "${params.SampleId}_vardict.var" | /opt/teststrandbias.R | /opt/var2vcf_valid.pl -N ${params.SampleId} -A -E -f 0.00085 > raw_vardict_tumor.vcf
bcftools sort raw_vardict_tumor.vcf | awk -F "\t" '{if (\$4 != "." && \$5 != "." && \$5 !~ /^</) print \$0}' > ${vardict_out_vcf}
"""
}
process secondary_filter_annotation_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 125..140 ? 'retry' : 'ignore' }
maxRetries 3
when:
params.ctl_fq1 == ""
input:
path 'tumor_deduped.bam' from tumor_dedup_bam_ch2
path 'tumor_deduped.bai' from tumor_dedup_bai_ch2
path 'raw_sorted.vcf' from vardict_out_ch
output:
path "${secondary_stats_vcf}" into vardict_add_stats_ch
script:
secondary_stats_vcf = "${params.SampleId}_vardict_stats.vcf"
"""
cat ${secondary_annotate_conf} | xargs \
gatk VariantAnnotator -I tumor_deduped.bam -R ${ref_fa} -V raw_sorted.vcf -O ${secondary_stats_vcf}
"""
}
process anno_snpeff_tumor_only2 {
container '10.168.2.67:5000/snpeff-yy:4.4m'
cpus 2
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 120..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.ctl_fq1 == ""
input:
path "raw_vardict_var.vcf" from vardict_add_stats_ch
path 'anno_snpeff.conf' from anno_snpeff_conf
output:
path "${prefix_anno_vcf}_vardict_hgvs.vcf" into tumor_anno_vcf_ch2
path "${prefix_anno_vcf}.haplotype.anno" into haplotype_anno_tumor_ch
script:
prefix_anno_vcf = "${params.SampleId}_raw"
"""
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 raw_vardict_var.vcf > ${prefix_anno_vcf}_vardict_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 120..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 == ""
input:
path 'hgvs.vcf' from tumor_anno_vcf_ch2
output:
path "${tumor_anno_vcf}" into tumor_hgvs_clinvar_ch
script:
tumor_anno_vcf = "${params.SampleId}_filter_marked_hgvs_db.vcf"
"""
java -Xmx4g -jar /opt/SnpSift.jar annotate -info CLNSIG,CLNSIGCONF,CLNDN ${clinvar_database} hgvs.vcf > ${tumor_anno_vcf}
"""
}
process vardict_report_tumor_only {
container '10.168.2.67:5000/filter2report-yy:2.0'
publishDir "${filtered_review_dir}", mode: 'copy'
cpus 1
memory { 2.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.ctl_fq1 == ""
input:
path 'marked_all_anno.vcf' from tumor_hgvs_clinvar_ch
path 'haplotype.anno' from haplotype_anno_tumor_ch
output:
path '*.xls' into vardict_report_ch
script:
report_output = "${params.SampleId}_vardict_for_report.xls"
"""
python3 /opt/vcf2mut_report_review.py marked_all_anno.vcf haplotype.anno ${variation_hotspots_conf} all_sites.mpileup ${report_output} cfdna
"""
}
process samtools_tumor_mpileup {
container '10.168.2.67:5000/varscan-yy:1.0'
cpus 2
memory { 6.GB * task.attempt }
time { 2.hour * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 2
when:
somatic_process_mark == true
input:
path "recal.bam" from tumor_refined_bam_ch1
path "recal.bai" from tumor_refined_bai_ch1
path "samtools_mpileup_conf" from samtools_mpileup_conf
path "pcr_mpileup_conf" from pcr_mpileup_conf
path "target.bed" from bed_target
output:
path "${tumor_mpileup_file}" into tumor_mpileup_ch1, tumor_mpileup_ch2
script:
tumor_mpileup_file = "${params.SampleId}_T_mpileup"
if (params.SampleId =~ "PCR_")
"""
cat pcr_mpileup_conf | xargs \
samtools mpileup -f ${ref_fa} -l target.bed recal.bam -o ${tumor_mpileup_file}
"""
else
"""
awk '{print \$1"\t"\$2-20"\t"\$3+20}' target.bed > target.ext20.bed
cat samtools_mpileup_conf | xargs \
samtools mpileup -f ${ref_fa} -l target.ext20.bed recal.bam -o ${tumor_mpileup_file}
"""
}
process samtools_tumor_dedup_mpileup {
container '10.168.2.67:5000/varscan-yy:1.0'
cpus 2
memory { 6.GB * task.attempt }
time { 2.hour * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 2
when:
dedup_process_mark == true && somatic_process_mark == true
input:
path "dedup.bam" from tumor_dedup_bam_ch1
path "dedup.bai" from tumor_dedup_bai_ch1
path "samtools_mpileup_conf" from samtools_mpileup_conf
path "target.bed" from bed_target
output:
path "${tumor_dedup_mpileup_file}" into tumor_dedup_mpileup_ch1, tumor_dedup_mpileup_ch2
script:
tumor_dedup_mpileup_file = "${params.SampleId}_dedup_T_mpileup"
"""
cat samtools_mpileup_conf | xargs \
samtools mpileup -f ${ref_fa} -l target.bed dedup.bam -o ${tumor_dedup_mpileup_file}
"""
}
process samtools_control_mpileup {
container '10.168.2.67:5000/varscan-yy:1.0'
cpus 2
memory { 6.GB * task.attempt }
time { 2.hour * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 2
when:
params.ctl_fq1 != ""
input:
path "ctl.bam" from ctl_recal_bam_ch1
path "ctl.bai" from ctl_recal_bai_ch1
path "samtools_mpileup_conf" from samtools_mpileup_conf
path "target.bed" from bed_target
output:
path "${control_mpileup_file}" into control_mpileup_ch
script:
control_mpileup_file = "${params.SampleId}_N_mpileup"
"""
awk '{print \$1"\t"\$2-20"\t"\$3+20}' target.bed > target.ext20.bed
cat samtools_mpileup_conf | xargs \
samtools mpileup -f ${ref_fa} -l target.ext20.bed ctl.bam -o ${control_mpileup_file}
"""
}
process samtools_control_dedup_mpileup {
container '10.168.2.67:5000/varscan-yy:1.0'
cpus 2
memory { 6.GB * task.attempt }
time { 2.hour * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 2
when:
params.ctl_fq1 != "" && dedup_process_mark == true
input:
path "ctl_dedup.bam" from ctl_dedup_bam_ch1
path "ctl_dedup.bai" from ctl_dedup_bai_ch1
path "samtools_mpileup_conf" from samtools_mpileup_conf
path "target.bed" from bed_target
output:
path "${ctl_dedup_mpileup_file}" into ctl_dedup_mpileup_ch
script:
ctl_dedup_mpileup_file = "${params.SampleId}_dedup_N_mpileup"
"""
cat samtools_mpileup_conf | xargs \
samtools mpileup -f ${ref_fa} -l target.bed ctl_dedup.bam -o ${ctl_dedup_mpileup_file}
"""
}
process somatic_varscan_tumor_paired {
container '10.168.2.67:5000/varscan-yy:1.0'
cpus 2
memory { 4.GB * task.attempt }
time { 2.hour * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'terminate' }
maxRetries 2
when:
params.ctl_fq1 != ""
input:
path "${params.SampleId}_T_mpileup" from tumor_mpileup_ch1
path "${params.SampleId}_N_mpileup" from control_mpileup_ch
path "somatic_varscan_conf" from somatic_varscan_paired_conf
output:
path "${raw_snp_vcf}" into raw_snp_vcf_ch1
path "${raw_indel_vcf}" into raw_indel_vcf_ch1
path "${germline_snp_vcf}" into germline_snp_vcf_ch1
path "${germline_indel_vcf}" into germline_indel_vcf_ch1
script:
raw_snp_vcf = "${params.SampleId}_raw.snp.Somatic.hc.vcf"
raw_indel_vcf = "${params.SampleId}_raw.indel.Somatic.hc.vcf"
germline_snp_vcf = "${params.SampleId}_raw.snp.Germline.hc.vcf"
germline_indel_vcf = "${params.SampleId}_raw.indel.Germline.hc.vcf"
"""
cat somatic_varscan_conf | xargs \
java -jar /opt/VarScan.v2.3.11.jar somatic ${params.SampleId}_N_mpileup ${params.SampleId}_T_mpileup ${params.SampleId}_raw --hotspot-vcf ${core_hotspots_vcf}
java -jar /opt/VarScan.v2.3.11.jar processSomatic ${params.SampleId}_raw.snp.vcf --min-tumor-freq 0.001 --max-normal-freq 0.02 --p-value 0.05 --hotspot-vcf ${snp_hotspots_vcf}
java -jar /opt/VarScan.v2.3.11.jar processSomatic ${params.SampleId}_raw.indel.vcf --min-tumor-freq 0.001 --max-normal-freq 0.02 --p-value 0.05 --hotspot-vcf ${core_hotspots_vcf}
"""
}
process somatic_vardict_paired_parallel {
container '10.168.2.67:5000/vardict-yy:1.8.2m'
cpus 6
memory { 16.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.ctl_fq1 != "" && somatic_process_mark == true
input:
path "refined.bam" from tumor_refined_bam_ch2
path "control.bam" from ctl_recal_bam_ch7
path "control.bai" from ctl_recal_bai_ch7
path "target.bed" from bed_target
output:
path "${vardict_out_vcf}" into paired_vardict_ch
script:
vardict_out_vcf = "${params.SampleId}_raw_vardict.vcf"
"""
cat ${somatic_vardict_conf} | xargs java -Xmx12g -XX:-UseParallelGC -jar /opt/VarDict-1.8.2.jar -b "refined.bam|control.bam" -G ${ref_fa} -th ${task.cpus} -N ${params.SampleId} -hotspot ${vardict_hotspots_list} -c 1 -S 2 -E 3 target.bed > "${params.SampleId}_vardict.var"
cat "${params.SampleId}_vardict.var" | /opt/testsomatic.R | /opt/var2vcf_paired.pl -N "${params.SampleId}|${params.SampleId}_X" -A -f 0.00085 > raw_vardict_tumor.vcf
bcftools sort raw_vardict_tumor.vcf | awk -F "\t" '{if (\$4 != "." && \$5 != "." && \$5 !~ /^</) print \$0}' > ${vardict_out_vcf}
"""
}
process secondary_filter_annotation_paired {
container '10.168.2.67:5000/gatk-yy:4.2.2.1'
cpus 2
memory { 8.GB * task.attempt }
errorStrategy { task.exitStatus in 125..140 ? 'retry' : 'ignore' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path 'tumor_deduped.bam' from tumor_dedup_bam_ch2
path 'tumor_deduped.bai' from tumor_dedup_bai_ch2
path 'paired_raw_sorted.vcf' from paired_vardict_ch
output:
path "${secondary_stats_vcf}" into vardict_stats_paired_ch
script:
secondary_stats_vcf = "${params.SampleId}_vardict_stats.vcf"
"""
cat ${secondary_annotate_conf} | xargs \
gatk VariantAnnotator -I tumor_deduped.bam -R ${ref_fa} -V paired_raw_sorted.vcf -O ${secondary_stats_vcf}
"""
}
process anno_snpeff_somatic_paired {
container '10.168.2.67:5000/snpeff-yy:4.4m'
cpus 2
memory { 4.GB * task.attempt }
errorStrategy { task.exitStatus in 120..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.ctl_fq1 != ""
input:
path "paired_vardict_var.vcf" from vardict_stats_paired_ch
path 'anno_snpeff.conf' from anno_snpeff_conf
output:
path "${prefix_anno_vcf}_vardict_hgvs.vcf" into paired_anno_vcf_ch
path "${prefix_anno_vcf}.haplotype.anno" into haplotype_pseudo_ch
script:
prefix_anno_vcf = "${params.SampleId}_raw"
"""
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 paired_vardict_var.vcf > ${prefix_anno_vcf}_vardict_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 120..140 ? 'retry' : 'terminate' }
maxRetries 3
when:
params.ctl_fq1 != ""
input:
path "hgvs.vcf" from paired_anno_vcf_ch
output:
path "${tumor_anno_vcf}" into paired_hgvs_clinvar_ch
script:
tumor_anno_vcf = "${params.SampleId}_filter_marked_hgvs_db.vcf"
"""
java -Xmx4g -jar /opt/SnpSift.jar annotate -info CLNSIG,CLNSIGCONF,CLNDN ${clinvar_database} hgvs.vcf > ${tumor_anno_vcf}
"""
}
process vardict_report_paired {
container '10.168.2.67:5000/filter2report-yy:2.0'
publishDir "${filtered_review_dir}", mode: 'copy'
cpus 1
memory { 2.GB * task.attempt }
errorStrategy { task.exitStatus in 1..140 ? 'retry' : 'ignore' }
maxRetries 2
when:
params.ctl_fq1 != ""
input:
path "marked_all_anno.vcf" from paired_hgvs_clinvar_ch
path "haplotype.anno" from haplotype_pseudo_ch
output:
path "*.xls" into vardict_paired_report