-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.nf
More file actions
174 lines (146 loc) · 6.2 KB
/
main.nf
File metadata and controls
174 lines (146 loc) · 6.2 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
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env nextflow
/*
==============================================================================
BCA Pre-processing Pipeline
==============================================================================
This pipeline handles the analysis of single-cell RNA sequencing data, including
quality control, demultiplexing, mapping, and reporting.
Pre-requisites:
- Created a samplesheet in CSV format (see conf/example_samplesheet.csv)
- Configured the custom config file (config/custom.config)
- Conda & Nextflow available in base environment
Run:
nextflow run -profile <institution_config>,conda -c /path/to/custom_config
------------------------------------------------------------------------------
*/
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { preprocessing_workflow } from './workflows/preprocessing_workflow'
include { QC_mapping_workflow } from './workflows/mapping_workflow'
include { filtering_workflow } from './workflows/filtering_workflow'
include { reporting_workflow } from './workflows/reporting_workflow'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_bca_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_bca_pipeline'
include { SAVE_RUN_CONFIG } from './modules/local/custom/save_configs/main'
include { MAPPING_STATS } from './modules/local/custom/dashboard/mapping_stats/main'
include { MULTIQC } from './modules/local/tools/multiqc/main'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MAIN WORKFLOW
Selects pre-processing workflow depending on the sequencing technique
and returns the pre-processed FASTQ files, and possibly results from
the equivalent commercial pipeline (depending on if the path to the
local installation is given). The pre-processed files are then used
for mapping and quality control, and once all outputs are finished,
the pipeline triggers MultiQC and the filtering workflow.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow BCA_PREPROCESSING {
take:
samplesheet // channel: samplesheet read in from --input
main:
// Initialize reporting channels
def multiqc_report_ch = Channel.empty()
// Save run configurations
SAVE_RUN_CONFIG(samplesheet.first())
// Pre-processing workflow
preprocessing_workflow(samplesheet)
if ( params.run_method != "exteral_pipeline_only" ) {
// Mapping using STARsolo, Alevin, and/or comparison to commercial pipelines
QC_mapping_workflow(preprocessing_workflow.out.data_output, preprocessing_workflow.out.bc_whitelist)
}
// Continue with filtering and MultiQC only with "standard" run_method
if (params.run_method == "standard") {
// Filtering raw matrices of ambient RNA
filter_out = filtering_workflow(QC_mapping_workflow.out.starsolo_genefull50_raw)
reporting_workflow(
preprocessing_workflow.out.merged_samplesheet,
SAVE_RUN_CONFIG.out.samplesheet,
SAVE_RUN_CONFIG.out.run_config,
QC_mapping_workflow.out.star_final_log,
QC_mapping_workflow.out.star_summaries,
QC_mapping_workflow.out.star_log,
QC_mapping_workflow.out.starsolo_bam,
QC_mapping_workflow.out.star_solodir,
QC_mapping_workflow.out.saturation_logs,
QC_mapping_workflow.out.star_cellreads,
QC_mapping_workflow.out.af_meta_info,
QC_mapping_workflow.out.af_quant_json,
QC_mapping_workflow.out.af_cell_meta,
QC_mapping_workflow.out.pavian_sankey,
QC_mapping_workflow.out.saturation_imgs,
QC_mapping_workflow.out.saturation_residual_imgs,
QC_mapping_workflow.out.star_umipercell,
QC_mapping_workflow.out.featurecount_txt
)
multiqc_report_ch = reporting_workflow.out.multiqc_report
}
emit:
preprocs_output = preprocessing_workflow.out.data_output
multiqc_report = multiqc_report_ch
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
main:
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.validate_params,
params.monochrome_logs,
args,
params.outdir,
params.input
)
//
// WORKFLOW: Run main workflow
//
BCA_PREPROCESSING (
PIPELINE_INITIALISATION.out.samplesheet
)
//
// SUBWORKFLOW: Run completion tasks
//
PIPELINE_COMPLETION (
params.email,
params.email_on_fail,
params.plaintext_email,
params.outdir,
params.monochrome_logs,
params.hook_url,
BCA_PREPROCESSING.out.multiqc_report
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WORKFLOWS TO DISPLAY RUNTIME INFORMATION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow.onComplete {
summary = """
Pipeline execution summary
---------------------------
Completed at: ${workflow.complete}
Duration : ${workflow.duration}
Success : ${workflow.success}
workDir : ${workflow.workDir}
exit status : ${workflow.exitStatus}
"""
println summary
}
workflow.onError {
println "Error: Pipeline execution stopped with the following message: ${workflow.errorMessage}"
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/