Repository navigation
Expand file tree
/
Copy pathmain.nf
More file actions
193 lines (175 loc) · 6.78 KB
/
Copy pathmain.nf
File metadata and controls
193 lines (175 loc) · 6.78 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/usr/bin/env nextflow
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sanger-tol/ascc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Github : https://github.com/sanger-tol/ascc
Website: https://pipelines.tol.sanger.ac.uk/ascc
----------------------------------------------------------------------------------------
*/
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { ASCC } from './workflows/ascc'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_ascc_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_ascc_pipeline'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
//
// WORKFLOW: Run main analysis pipeline depending on type of input
//
workflow SANGERTOL_ASCC {
take:
genomic // Genomic fasta tuples
organelles // Organellar fasta tuples
fcs_override // bool
genomic_fcs_samplesheet // genomic data tuple from fcs_override samplesheet generated from external fcs process
organellar_fcs_samplesheet // organellar data tuple from fcs_override samplesheet generated from external fcs process
fcs_db // [path(path)]
read_files // Read files
scientific_name // Scientific name
pacbio_db // Pacbio database
ncbi_taxonomy_path // NCBI taxonomy path
ncbi_ranked_lineage_path // ranked_lineage file path
nt_database_path // NT database path
diamond_nr_db_path // NR database path
diamond_uniprot_db_path // UNIPROT database path
taxid // taxid of input assembly
nt_kraken_db_path // path to custom kraken database
vecscreen_database_path // Path to custom VECSCREEN database
reads_path // tuple of paths to input read files
reads_layout // Layout of input reads [SINGLE, PAIRED]
reads_type // Type of input reads [HIFI, CLR, ILLUMINA, etc...]
btk_lineages // [1_odb10, 2_odb10] ODB10 lineages to run against the assembly
btk_lineages_path // Path to the ODB10 lineages
barcodes // ["barcode_1,barcode_2"]
val_reads_per_chunk // int: number of reads per chunk to map when estimating coverage
main:
//
// WORKFLOW: Run pipeline
//
ASCC (
genomic,
organelles,
fcs_override,
genomic_fcs_samplesheet,
organellar_fcs_samplesheet,
fcs_db,
read_files,
scientific_name,
pacbio_db,
ncbi_taxonomy_path,
ncbi_ranked_lineage_path,
nt_database_path,
diamond_nr_db_path,
diamond_uniprot_db_path,
taxid,
nt_kraken_db_path,
vecscreen_database_path,
reads_path,
reads_layout,
reads_type,
btk_lineages,
btk_lineages_path,
barcodes,
val_reads_per_chunk
)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow {
main:
//
// SUBWORKFLOW: Run initialisation tasks
//
PIPELINE_INITIALISATION (
params.version,
params.validate_params,
params.monochrome_logs,
args,
params.outdir,
params.input,
params.help,
params.help_full,
params.show_hidden
)
//
// WORKFLOW: MAIN ASCC WORKFLOW FILE THAT SEPERATES INTO GENOMIC AND ORGANELLAR
//
SANGERTOL_ASCC (
PIPELINE_INITIALISATION.out.main_genomes,
PIPELINE_INITIALISATION.out.organellar_genomes,
params.fcs_override,
PIPELINE_INITIALISATION.out.geno_fcs_samplesheet,
PIPELINE_INITIALISATION.out.orga_fcs_samplesheet,
PIPELINE_INITIALISATION.out.fcs_gx_database,
PIPELINE_INITIALISATION.out.collected_reads,
params.scientific_name,
PIPELINE_INITIALISATION.out.pacbio_db,
channel.fromPath(params.ncbi_taxonomy_path),
channel.fromPath(params.ncbi_ranked_lineage_path),
channel.fromPath(params.nt_database_path),
channel.fromPath(params.diamond_nr_database_path),
channel.fromPath(params.diamond_uniprot_database_path),
channel.of(params.taxid),
channel.fromPath(params.nt_kraken_database_path),
channel.fromPath(params.vecscreen_database_path),
channel.from(params.reads_path),
channel.of(params.reads_layout),
params.reads_type,
channel.of(params.busco_lineages),
channel.fromPath(params.busco_lineages_folder),
PIPELINE_INITIALISATION.out.barcodes,
params.coverage_reads_per_chunk
)
//
// SUBWORKFLOW: Run completion tasks
//
PIPELINE_COMPLETION (
params.email,
params.email_on_fail,
params.plaintext_email,
params.outdir,
params.monochrome_logs,
params.hook_url,
)
}
workflow.onComplete {
if (workflow.success) {
try {
def completionFile = file("${params.outdir}/workflow_completed.txt")
def du = ["du", "-sh", workflow.workDir.toString()].execute()
du.waitFor()
completionFile.text = """
Workflow completed successfully!
Completed at: ${workflow.complete}
Duration: ${workflow.duration}
Success: ${workflow.success}
Work directory: ${workflow.workDir}
Work directory size: ${du.text.trim()}
Exit status: ${workflow.exitStatus}
Run name: ${workflow.runName}
Session ID: ${workflow.sessionId}
Project directory: ${workflow.projectDir}
Launch directory: ${workflow.launchDir}
Command line: ${workflow.commandLine}
""".stripIndent()
log.info "[ASCC INFO] Completion file created: ${completionFile}"
} catch (Exception e) {
log.warn "[ASCC WARN] Failed to create completion file: ${e.message}"
}
}
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/