Repository navigation
Expand file tree
/
Copy pathmain.nf
More file actions
161 lines (142 loc) · 6.01 KB
/
Copy pathmain.nf
File metadata and controls
161 lines (142 loc) · 6.01 KB
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
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nf-core/msproteomics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/nf-core/msproteomics
Website: https://nf-co.re/msproteomics
Slack : https://nfcore.slack.com/channels/msproteomics
----------------------------------------------------------------------------------------
*/
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { MSPROTEOMICS_DIANN } from './workflows/diann'
include { MSPROTEOMICS_TMT_LABELCHECK } from './workflows/tmt_labelcheck'
include { MSPROTEOMICS_FRAGPIPE } from './workflows/fragpipe'
include { MULTIQC } from './modules/nf-core/multiqc/main'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_msproteomics_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_msproteomics_pipeline'
include { methodsDescriptionText } from './subworkflows/local/utils_nfcore_msproteomics_pipeline'
include { paramsSummaryMap } from 'plugin/nf-schema'
include { paramsSummaryMultiqc } from './subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from './subworkflows/nf-core/utils_nfcore_pipeline'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//
// WORKFLOW: Route on --mode / --tmt_mode, then collate versions and run MultiQC.
// Each mode workflow parses the samplesheet itself (samplesheetToList with
// assets/schema_input.json, see parseSamplesheet), because FragPipe's group rule
// depends on the mode's .workflow file.
//
workflow NFCORE_MSPROTEOMICS {
take:
outdir // string: output directory
main:
if (params.mode == 'diann') {
MSPROTEOMICS_DIANN()
ch_multiqc_files = MSPROTEOMICS_DIANN.out.multiqc_files
} else if (params.mode == 'fragpipe' && params.tmt_mode == 'labelcheck') {
MSPROTEOMICS_TMT_LABELCHECK()
ch_multiqc_files = MSPROTEOMICS_TMT_LABELCHECK.out.multiqc_files
} else if (params.mode == 'fragpipe') {
MSPROTEOMICS_FRAGPIPE()
ch_multiqc_files = MSPROTEOMICS_FRAGPIPE.out.multiqc_files
} else {
error("--mode must be 'diann' or 'fragpipe', got '${params.mode}'")
}
//
// Collate and save software versions
//
def topic_versions = channel.topic("versions")
.distinct()
.branch { entry ->
versions_file: entry instanceof Path
versions_tuple: true
}
def topic_versions_string = topic_versions.versions_tuple
.map { process, tool, version ->
[ process[process.lastIndexOf(':')+1..-1], " ${tool}: ${version}" ]
}
.groupTuple(by:0)
.map { process, tool_versions ->
tool_versions.unique().sort()
"${process}:\n${tool_versions.join('\n')}"
}
def ch_collated_versions = softwareVersionsToYAML(topic_versions.versions_file)
.mix(topic_versions_string)
.collectFile(
storeDir: "${outdir}/pipeline_info",
name: 'nf_core_' + 'msproteomics_software_' + 'mqc_' + 'versions.yml',
sort: true,
newLine: true
)
//
// MODULE: MultiQC
//
def multiqc_configs = [file("${projectDir}/assets/multiqc_config.yml", checkIfExists: true)] +
(params.multiqc_config ? [file(params.multiqc_config, checkIfExists: true)] : [])
def multiqc_logo = params.multiqc_logo ? file(params.multiqc_logo, checkIfExists: true) : []
def methods_description_file = params.multiqc_methods_description
? file(params.multiqc_methods_description, checkIfExists: true)
: file("${projectDir}/assets/methods_description_template.yml", checkIfExists: true)
def summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json")
def ch_workflow_summary = channel.value(paramsSummaryMultiqc(summary_params))
.collectFile(name: 'workflow_summary_mqc.yaml')
def ch_methods_description = channel.value(methodsDescriptionText(methods_description_file))
.collectFile(name: 'methods_description_mqc.yaml', sort: true)
MULTIQC(
ch_multiqc_files
.mix(ch_workflow_summary, ch_collated_versions, ch_methods_description)
.collect()
.map { files -> [[id: 'msproteomics'], files, multiqc_configs, multiqc_logo, [], []] }
)
emit:
multiqc_report = MULTIQC.out.report.map { _meta, report -> report } // channel: /path/to/multiqc_report.html
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
main:
//
// SUBWORKFLOW: Version, help, parameter validation (nextflow_schema.json) and config checks
//
PIPELINE_INITIALISATION(
params.version,
params.validate_params,
params.monochrome_logs,
args,
params.outdir,
params.help,
params.help_full,
params.show_hidden
)
//
// WORKFLOW: Run main workflow
//
NFCORE_MSPROTEOMICS(params.outdir)
//
// SUBWORKFLOW: Completion email and summary
//
PIPELINE_COMPLETION(
params.email,
params.email_on_fail,
params.plaintext_email,
params.outdir,
params.monochrome_logs,
NFCORE_MSPROTEOMICS.out.multiqc_report
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/