-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.nf
206 lines (188 loc) · 7.37 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
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
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-cmgg/structural
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/nf-cmgg/structural
----------------------------------------------------------------------------------------
*/
nextflow.preview.output = true
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { STRUCTURAL } from './workflows/structural'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_structural_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_structural_pipeline'
include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_structural_pipeline'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENOME PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
params.fasta = getGenomeAttribute('fasta')
params.fai = getGenomeAttribute('fai')
params.vep_cache = getGenomeAttribute('vep_cache')
// params.bwa = getGenomeAttribute('bwa')
params.annotsv_annotations = getGenomeAttribute('annotsv_annotations')
params.expansionhunter_catalog = getGenomeAttribute('expansionhunter_catalog')
params.qdnaseq_male = getGenomeAttribute("qdnaseq_male_${params.qdnaseq_bin_size.toInteger() / 1000}kbp".toString())
params.qdnaseq_female = getGenomeAttribute("qdnaseq_female_${params.qdnaseq_bin_size.toInteger() / 1000}kbp".toString())
params.wisecondorx_reference = getGenomeAttribute('wisecondorx_reference')
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
main:
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.validate_params,
args,
params.outdir,
params.input
)
def ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
def ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config, checkIfExists: true ) : Channel.empty()
def ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo, checkIfExists: true ) : Channel.empty()
def ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)
//
// WORKFLOW: Run main workflow
//
STRUCTURAL (
// channels
PIPELINE_INITIALISATION.out.samplesheet,
ch_multiqc_config,
ch_multiqc_custom_config,
ch_multiqc_logo,
ch_multiqc_custom_methods_description,
// files
params.fasta,
params.fai,
params.expansionhunter_catalog ?: "https://github.com/Illumina/ExpansionHunter/raw/master/variant_catalog/grch38/variant_catalog.json",
params.qdnaseq_female,
params.qdnaseq_male,
params.wisecondorx_reference,
params.vep_cache,
params.annotsv_annotations,
params.annotsv_candidate_genes,
params.annotsv_gene_transcripts,
params.vcfanno_lua,
params.vcfanno_resources,
params.vcfanno_toml,
params.blacklist,
params.manta_config ?: "${projectDir}/assets/manta_config.ini",
"${projectDir}/assets/svync",
"${projectDir}/assets/bedgovcf",
"${projectDir}/assets/vcfanno",
// booleans
params.annotate,
params.concat_output,
params.bedpe,
// values
params.callers,
params.sv_callers_support,
params.cnv_callers_support,
params.genome,
params.species,
params.vep_assembly,
params.vep_cache_version,
params.filter,
params.outdir
)
//
// SUBWORKFLOW: Run completion tasks
//
PIPELINE_COMPLETION (
params.email,
params.email_on_fail,
params.plaintext_email,
params.outdir,
params.monochrome_logs,
params.hook_url,
STRUCTURAL.out.multiqc_report
)
publish:
STRUCTURAL.out.caller_vcfs >> 'caller_vcfs'
STRUCTURAL.out.sample_vcfs >> 'sample_vcfs'
STRUCTURAL.out.family_vcfs >> 'family_vcfs'
STRUCTURAL.out.qdnaseq_out >> 'qdnaseq_out'
STRUCTURAL.out.wisecondorx_out >> 'wisecondorx_out'
STRUCTURAL.out.bedpe >> 'bedpe'
STRUCTURAL.out.multiqc_report >> 'multiqc'
STRUCTURAL.out.multiqc_data >> 'multiqc_data'
}
output {
'caller_vcfs' {
enabled params.output_callers
path { meta, vcf, _tbi -> { file ->
if(file == vcf.name) {
return "${meta.sample}/${meta.caller}/${meta.sample}.vcf.gz"
}
return "${meta.sample}/${meta.caller}/${meta.sample}.vcf.gz.tbi"
} }
}
'sample_vcfs' {
path { meta, vcf, _tbi -> { file ->
def base = "${meta.id}/${meta.id}${meta.variant_type ? '.' + meta.variant_type : ''}"
if(file == vcf.name) {
return "${base}.vcf.gz"
}
return "${base}.vcf.gz.tbi"
} }
}
'family_vcfs' {
path { meta, vcf, _tbi -> { file ->
def base = "${meta.id}/${meta.id}${meta.variant_type ? '.' + meta.variant_type : ''}"
if(file == vcf.name) {
return "${base}.vcf.gz"
}
return "${base}.vcf.gz.tbi"
} }
}
'qdnaseq_out' {
path { meta, _bed -> { file ->
if(file == "statistics.out") {
return "${meta.id}/${meta.id}.qdnaseq.statistics.out"
}
def new_name = file.replaceFirst(meta.id, "${meta.id}.qdnaseq")
return "${meta.id}/${new_name}"
} }
}
'wisecondorx_out' {
path { meta, _bed -> { file ->
if(file.endsWith(".png")) {
return "${meta.id}/${meta.id}.wisecondorx.${file}"
}
def new_name = file.replaceFirst(meta.id, "${meta.id}.wisecondorx")
return "${meta.id}/${new_name}"
} }
}
'bedpe' {
path { meta, _bedpe -> { file ->
def base = "${meta.id}/${meta.id}${meta.variant_type ? '.' + meta.variant_type : ''}"
return "${base}.bedpe"
} }
}
'multiqc' {
path { _report -> { _file -> "multiqc/multiqc_report.html"}}
}
'multiqc_data' {
path { _folder -> { _file -> "multiqc/multiqc_data"}}
}
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/