-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.nf
102 lines (98 loc) · 4.95 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
include { NEXTFLOW_RUN as NFCORE_DEMO } from "$projectDir/modules/local/nextflow/run/main"
include { NEXTFLOW_RUN as NFCORE_FETCHNGS } from "$projectDir/modules/local/nextflow/run/main"
include { NEXTFLOW_RUN as NFCORE_RNASEQ } from "$projectDir/modules/local/nextflow/run/main"
include { NEXTFLOW_RUN as NFCORE_TAXPROFILER } from "$projectDir/modules/local/nextflow/run/main"
include { NEXTFLOW_RUN as NFCORE_MAG } from "$projectDir/modules/local/nextflow/run/main"
include { NEXTFLOW_RUN as NFCORE_FUNCSCAN } from "$projectDir/modules/local/nextflow/run/main"
include { readWithDefault } from "$projectDir/functions/local/utils"
include { resolveFileFromDir as getSamplesheet } from "$projectDir/functions/local/utils"
include { createMagSamplesheet } from "$projectDir/functions/local/utils"
include { createFuncscanSamplesheet } from "$projectDir/functions/local/utils"
workflow {
// Validate possible pipeline chains
def valid_chains = [
'demo',
'fetchngs',
'fetchngs,rnaseq',
'fetchngs,taxprofiler',
'fetchngs,taxprofiler,mag',
'fetchngs,taxprofiler,mag,funcscan',
'fetchngs,mag,funcscan',
'rnaseq',
'taxprofiler',
'mag',
'funcscan',
]
assert params.workflows in valid_chains
def wf_chain = params.workflows.tokenize(',')
// Initialise undefined channels
def fetchngs_output_samplesheet = null
def fetchngs_output = null
def mag_output = null
// Run pipelines
if ( 'demo' in wf_chain ) {
NFCORE_DEMO (
'nf-core/demo',
[
params.general.wf_opts?: '',
params.demo.wf_opts?: '',
].join(" ").trim(), // workflow opts
readWithDefault( params.demo.params_file, Channel.value([]) ), // params file
readWithDefault( params.demo.input, Channel.value([]) ), // samplesheet
readWithDefault( params.demo.add_config, Channel.value([]) ), // custom config
)
}
if ( 'fetchngs' in wf_chain ){
// FETCHNGS
NFCORE_FETCHNGS (
'nf-core/fetchngs',
"${params.general.wf_opts?: ''} ${params.fetchngs.wf_opts?: ''}", // workflow opts
readWithDefault( params.fetchngs.params_file, Channel.value([]) ), // params file
readWithDefault( params.fetchngs.input, Channel.value([]) ), // samplesheet
readWithDefault( params.fetchngs.add_config, Channel.value([]) ), // custom config
)
fetchngs_output_samplesheet = getSamplesheet( 'samplesheet/samplesheet.csv', NFCORE_FETCHNGS.out.output )
fetchngs_output = NFCORE_FETCHNGS.out.output
}
if ('rnaseq' in wf_chain ){
// RNASEQ
NFCORE_RNASEQ (
'nf-core/rnaseq',
"${ params.general.wf_opts?: ''} ${params.rnaseq.wf_opts?: ''}", // workflow opts
readWithDefault( params.rnaseq.params_file, Channel.value([]) ), // params file
readWithDefault( params.rnaseq.input, fetchngs_output_samplesheet ), // samplesheet
readWithDefault( params.rnaseq.add_config, Channel.value([]) ), // custom config
)
}
if ('taxprofiler' in wf_chain ){
// TAXPROFILER
NFCORE_TAXPROFILER (
'nf-core/taxprofiler',
"${ params.general.wf_opts?: ''} ${params.taxprofiler.wf_opts?: ''}", // workflow opts
readWithDefault( params.taxprofiler.params_file, Channel.value([]) ), // params file
readWithDefault( params.taxprofiler.input, fetchngs_output_samplesheet ), // samplesheet
readWithDefault( params.taxprofiler.add_config, Channel.value([]) ), // custom config
)
}
if ('mag' in wf_chain ){
// MAG
NFCORE_MAG (
'nf-core/mag',
"${ params.general.wf_opts?: ''} ${params.mag.wf_opts?: ''}", // workflow opts
readWithDefault( params.mag.params_file, Channel.value([]) ), // params file
readWithDefault( params.mag.input, createMagSamplesheet(fetchngs_output) ), // input
readWithDefault( params.mag.add_config, Channel.value([]) ), // custom config
)
mag_output = NFCORE_MAG.out.output
}
if ('funcscan' in wf_chain ){
// FUNCSCAN
NFCORE_FUNCSCAN (
'nf-core/funcscan',
"${ params.general.wf_opts?: ''} ${params.funcscan.wf_opts?: ''}", // workflow opts
readWithDefault( params.funcscan.params_file, Channel.value([]) ), // params file
readWithDefault( params.funcscan.input, createFuncscanSamplesheet(mag_output) ), // samplesheet
readWithDefault( params.funcscan.add_config, Channel.value([]) ), // custom config
)
}
}