-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.nf
149 lines (134 loc) · 5.23 KB
/
main.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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
date = new Date().format( 'yyyyMMdd' )
log.info """\
L O G A N P I P E L I N E
=============================
genome: ${params.genome}
outdir: ${params.outdir}
Sample Sheet: ${params.sample_sheet}
Samples: ${params.fastq_input} ${params.fastq_file_input} ${params.bam_input} ${params.bam_file_input}
"""
.stripIndent()
include {DETERMINEBAM; INPUT; INPUT_BAM; ALIGN; GL;
VC; SV; CNVmouse; CNVhuman; CNVhuman_novc;
QC_GL; QC_NOGL} from "./subworkflows/local/workflows.nf"
include {INPUT_TONLY; INPUT_TONLY_BAM;
ALIGN_TONLY;
VC_TONLY; SV_TONLY; CNVmouse_tonly; CNVhuman_tonly; CNVhuman_novc_tonly;
QC_TONLY } from "./subworkflows/local/workflows_tonly.nf"
workflow.onComplete {
if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) {
def message = Utils.spooker(workflow)
if (message) {
println message
}
}
}
//Final Workflow
workflow {
if ([params.fastq_input,params.fastq_file_input].any() && params.sample_sheet){
println "Tumor-Normal FASTQ"
INPUT()
ALIGN(INPUT.out.fastqinput,INPUT.out.sample_sheet)
//Germline
if (params.gl){
GL(ALIGN.out.bambyinterval)
}
//Tumor-Normal VC, SV, CNV
if (params.vc){
VC(ALIGN.out.bamwithsample,ALIGN.out.splitout,ALIGN.out.sample_sheet)
}
if (params.sv){
SV(ALIGN.out.bamwithsample)
}
if (params.cnv){
if (params.genome == "mm10"){
CNVmouse(ALIGN.out.bamwithsample)
} else if (params.genome== "hg38" |params.genome== "hg19"){
if (!params.vc){
CNVhuman_novc(ALIGN.out.bamwithsample)
} else {
CNVhuman(ALIGN.out.bamwithsample,VC.out.somaticcall_input)
}
}
}
if (params.qc && params.gl){
QC_GL(ALIGN.out.fastqin,ALIGN.out.fastpout,ALIGN.out.bqsrout,GL.out.glnexusout,GL.out.bcfout)
} else if (params.qc){
QC_NOGL(ALIGN.out.fastqin,ALIGN.out.fastpout,ALIGN.out.bqsrout)
}
}
//TUMOR-NOMRAL BAM INPUT
if ([params.bam_input,params.bam_file_input].any() && params.sample_sheet){
println "Tumor-Normal BAM"
INPUT_BAM()
if (params.vc){
VC(INPUT_BAM.out.bamwithsample,INPUT_BAM.out.splitout,INPUT_BAM.out.sample_sheet)
}
if (params.sv){
SV(INPUT_BAM.out.bamwithsample)
}
if (params.cnv){
if (params.genome == "mm10"){
CNVmouse(INPUT_BAM.out.bamwithsample)
} else if (params.genome == "hg38"|params.genome== "hg19"){
if (!params.vc){
CNVhuman_novc(INPUT_BAM.out.bamwithsample)
}else {
CNVhuman(INPUT_BAM.out.bamwithsample,VC.out.somaticcall_input)
}
}
}
}
///Tumor Only Pipelines
if ([params.fastq_input,params.fastq_file_input].any() && !params.sample_sheet){
println "Tumor-Only FASTQ"
INPUT_TONLY()
ALIGN_TONLY(INPUT_TONLY.out.fastqinput,INPUT_TONLY.out.sample_sheet)
if (params.vc){
VC_TONLY(ALIGN_TONLY.out.bamwithsample,ALIGN_TONLY.out.splitout,ALIGN_TONLY.out.sample_sheet)
}
if (params.sv){
SV_TONLY(ALIGN_TONLY.out.bamwithsample)
}
if (params.cnv){
if (params.genome == "mm10"){
CNVmouse_tonly(ALIGN_TONLY.out.bamwithsample)
} else if (params.genome== "hg38"|params.genome== "hg19"){
if (!params.vc){
VC_TONLY(ALIGN_TONLY.out.bamwithsample,ALIGN_TONLY.out.splitout,ALIGN_TONLY.out.sample_sheet)
CNVhuman_tonly(ALIGN_TONLY.out.bamwithsample,VC_TONLY.out.somaticcall_input)
} else {
CNVhuman_tonly(ALIGN_TONLY.out.bamwithsample,VC_TONLY.out.somaticcall_input)
}
}
}
if (params.qc){
QC_TONLY(ALIGN_TONLY.out.fastqin,ALIGN_TONLY.out.fastpout,ALIGN_TONLY.out.bqsrout)
}
}
//Variant Calling from BAM-Tumor Only Mode
if ([params.bam_input,params.bam_file_input].any() && !params.sample_sheet){
println "Tumor-Only BAM"
INPUT_TONLY_BAM()
if (params.vc){
VC_TONLY(INPUT_TONLY_BAM.out.bamwithsample,INPUT_TONLY_BAM.out.splitout,INPUT_TONLY_BAM.out.sample_sheet)
}
if (params.sv){
SV_TONLY(INPUT_TONLY_BAM.out.bamwithsample)
}
if (params.cnv){
if (params.genome == "mm10"){
CNVmouse_tonly(INPUT_TONLY_BAM.out.bamwithsample)
} else if (params.genome== "hg38" | params.genome== "hg19"){
if (!params.vc){
VC_TONLY(INPUT_TONLY_BAM.out.bamwithsample,INPUT_TONLY_BAM.out.splitout,INPUT_TONLY_BAM.out.sample_sheet)
CNVhuman_tonly(INPUT_TONLY_BAM.out.bamwithsample,VC_TONLY.out.somaticcall_input)
} else {
CNVhuman_tonly(INPUT_TONLY_BAM.out.bamwithsample,VC_TONLY.out.somaticcall_input)
}
}
}
}
}